Hello,
I'm trying to install GCC 4.5.0 on Mac OS X 10.5.8 (by compiling gcc
from source). Everything works smoothly from the build side, but there
is a problem with the installed libgcc_s. Specifically, the wrong
libgcc_s (i.e. the old one that was installed by Apple in /usr/lib)
gets linked in, instead of the new one built with gcc 4.5.0 (which I
put in /usr/local/lib). Somehow this breaks exception handling in c++.
It seems that this is because the link line refers to -lgcc_s.10.x
depending on the Mac OS X version. However, from libgcc/config/t-
slibgcc-darwin:32
# we're only going to build the stubs if the target slib is /usr/lib
# there is no other case in which they're useful in a live system.
ifeq (/usr/lib,$(shlib_slibdir))
LGCC_STUBS = libgcc_s.10.4.dylib libgcc_s.10.5.dylib
else
LGCC_STUBS =
endif
So the stub libraries never get built, and so I think what happens is
that the stub library resolves to the old stub, which references the
old libgcc_s, and thus the problem. Of course, as a workaround, I can
symlink a fake stub library (/usr/local/lib/libgcc_s.10.5.dylib -> /
usr/local/lib/libgcc_s.1.dylib). However, this has a number of
problems. First, it will probably break the old compiler (though I
haven't checked this), because the old compiler would link against the
new libgcc_s now. Second, libstdc++ ends up linking against the old
libgcc_s, so c++ programs under the workaround have *both* versions of
libgcc_s included, which leaves exception handling broken. All these
troubles can be sidestepped at runtime through the use of
DYLD_LIBRARY_PATH, but that would need to be set on a per executable
basis based on which compiler was used to compile the program.
So, my question is, is there a good way to cause the newly compiled
gcc to
1) Produce libgcc_s with a name like libgcc_s-custom.dylib
2) Automatically link executables against that library (especially
libstdc++).
3) Ideally even libstdc++ would have a custom string to distinguish it.
I used the --program-suffix=-4.5 so that my executables wouldn't
overlap with the previous install, is there a way to do this for the
gcc libraries?
Thanks for any help,
Colin