I have a strange problem compiling a universal binary .dylib - or rather, the PPC-part of it.
Now, I have a G4 PPC machine running 10.4.11 here, and set up XCode (2.5) to use GCC 3.3 with the 10.3.9 - SDK for the PPC tree and GCC 4.0 with the 10.4u SDK for the intel architecture. This setup works fine for most libraries I created - but as soon as I use ANY STL-container (vector, list, ...) I get a strange error on linking about undefined symbols in the PPC compile run - the intel - run works flawlessly.
The strange thing? If I take the same code (and XCode project) and compile it on a friend's Mac (Intel-based, also 10.4, XCode 2.5), BOTH parts of the lib come up clean. Now that's no solution, of course.....
So, let's get the example code and error message:
Not much there to look at - but it's enough to trigger the following message:
And no, it's not additional libs - I disabled ALL external libs in XCode, compiled (the File list only contained the single .o file), and still the error stays.
I bet the error's simple - I just don't know where to look any more. Any hint is welcome.
(Yes, the final lib should be and is more than just the few lines, I already boiled it down to those lines as cause or at least best explanation of the bug. The lib also compiles if I drop the STL container from it, but that shouldn't be the solution either)
Now, I have a G4 PPC machine running 10.4.11 here, and set up XCode (2.5) to use GCC 3.3 with the 10.3.9 - SDK for the PPC tree and GCC 4.0 with the 10.4u SDK for the intel architecture. This setup works fine for most libraries I created - but as soon as I use ANY STL-container (vector, list, ...) I get a strange error on linking about undefined symbols in the PPC compile run - the intel - run works flawlessly.
The strange thing? If I take the same code (and XCode project) and compile it on a friend's Mac (Intel-based, also 10.4, XCode 2.5), BOTH parts of the lib come up clean. Now that's no solution, of course.....
So, let's get the example code and error message:
Code:
#include <list>
typedef std::list<int> proList;
proList profiles;
Not much there to look at - but it's enough to trigger the following message:
Code:
Checking Dependencies
CompileC build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/Objects-normal/ppc/pluginmain.o /Users/guandalug/transfer/guanRenderSetupStorage/pluginmain.cpp normal ppc c++ com.apple.compilers.gcc.3_3
cd /Users/guandalug/transfer/guanRenderSetupStorage
setenv MACOSX_DEPLOYMENT_TARGET 10.3
setenv NEXT_ROOT /Developer/SDKs/MacOSX10.3.9.sdk
/usr/bin/gcc-3.3 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -Wreturn-type -Wunused-variable -fmessage-length=0 -mtune=G5 -Wp,-header-mapfile,/Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/guanRenderSetupStorage.hmap -F/Users/guandalug/transfer/guanRenderSetupStorage/build/Release -I/Users/guandalug/transfer/guanRenderSetupStorage/build/Release/include -I/Applications/DAZStudio/sdk/include -I/Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/DerivedSources -DMAC_OS_X_VERSION_MIN_REQUIRED=1030 -fconstant-cfstrings -D__CONSTANT_CFSTRINGS__ -isystem /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3 -I/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++ -I/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin -isystem /Developer/SDKs/MacOSX10.3.9.sdk/usr/include -include /Library/Caches/com.apple.Xcode.501/SharedPrecompiledHeaders/guanRenderSetupStorage_Prefix-fipnmkgkdczsvmhhzdyrgrqyokjw/guanRenderSetupStorage_Prefix.pch -c /Users/guandalug/transfer/guanRenderSetupStorage/pluginmain.cpp -o /Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/Objects-normal/ppc/pluginmain.o
Ld /Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/Objects-normal/ppc/guanRenderSetupStorage.dylib normal ppc
cd /Users/guandalug/transfer/guanRenderSetupStorage
setenv MACOSX_DEPLOYMENT_TARGET 10.3
setenv NEXT_ROOT /Developer/SDKs/MacOSX10.3.9.sdk
/usr/bin/g++-3.3 -o /Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/Objects-normal/ppc/guanRenderSetupStorage.dylib -L/Users/guandalug/transfer/guanRenderSetupStorage/build/Release -L/Applications/DAZStudio/sdk/lib -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/gcc/darwin/3.3 -F/Users/guandalug/transfer/guanRenderSetupStorage/build/Release -filelist /Users/guandalug/transfer/guanRenderSetupStorage/build/guanRenderSetupStorage.build/Release/guanRenderSetupStorage.build/Objects-normal/ppc/guanRenderSetupStorage.LinkFileList -arch ppc -Wl,-single_module -compatibility_version 1 -current_version 1 -install_name /usr/local/lib/guanRenderSetupStorage.dylib -dynamiclib -mmacosx-version-min=10.3 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk
/usr/bin/libtool: NEXT_ROOT environment variable ignored because -syslibroot specified
ld: Undefined symbols:
__ZNSt24__default_alloc_templateILb1ELi0EE10deallocateEPvm
__ZNSt24__default_alloc_templateILb1ELi0EE8allocateEm
/usr/bin/libtool: internal link edit command failed
And no, it's not additional libs - I disabled ALL external libs in XCode, compiled (the File list only contained the single .o file), and still the error stays.
I bet the error's simple - I just don't know where to look any more. Any hint is welcome.
(Yes, the final lib should be and is more than just the few lines, I already boiled it down to those lines as cause or at least best explanation of the bug. The lib also compiles if I drop the STL container from it, but that shouldn't be the solution either)