This may not be the best list for this question, so feel free to direct
me to a better list...
I'm building programs using gcc 4.0.1 on Mac OS. These programs have
several shared libraries which we also build with 4.0.1 plus one or two
which are provided to us in binary form only. In order to get those
libraries to work, we've had to compile with the -fno-use-cxa-atexit
flag. Now everything run just fine on Mac OS X 10.4.
However if the end user is running Mac OS 10.3, the loader is apparently
not executing the initialization code for our shared libraries. We have
at least one module with a static instance of a C++ class who's
constructor is not getting called on startup.
I can't find any compiler flags that would seem to apply. Are there
linker flags that I need?
The compiler flags I'm using now are:
powerpc-apple-darwin8-g++-4.0.1 -mcpu=G5 -mtune=G5 -mpowerpc64
-mpowerpc-gpopt -faltivec -force_cpusubtype_ALL -isysroot
/Developer/SDKs/MacOSX10.3.9.sdk -fPIC -DMAC_OSX -I/Users/build/inc
-I/usr/local/tntsdk/tnt73/include -I/usr/local/include/mysql
-I/usr/local/pgsql/include -I/usr/local/pgsql/include/server
-I/usr/local/tntsdk/tnt73/include/contrib -I/usr/X11R6/include -I.
-I/usr/local/include/Frameworks_10.3.9 -I/usr/local/lesstif/include
-arch ppc -Wimplicit -Wcomment -Wformat -Wuninitialized -O2
-mmacosx-version-min=10.3.9 -fno-use-cxa-atexit -c -o bitsetd.o bitsetd.c
And the linker flags used when creating a shared library:
libtool -dynamic -Y 200 -arch_only ppc -install_name libmisystem.dylib
-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk -lc
-L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 -lstdc++ -lgcc -lgcc_eh
-lSystem -L/usr/local/lib/mysql -multiply_defined suppress -framework
Carbon -framework IOKit -dylib_file libz.dylib:/usr/lib/libz.dylib
-L/usr/local/tntsdk/tnt73/mac64/lib -L/usr/local/tntsdk/tnt73/mac64/priv
-L/usr/local/pgsql/lib -L/usr/local/lib/mysql -single_module -lxml2
-o libmisystem.dylib *.o