Problems compiling a library

Joined
Nov 19, 2008
Messages
3
Reaction score
0
Points
1
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:
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)
 
OP
G
Joined
Nov 19, 2008
Messages
3
Reaction score
0
Points
1
Additional information: The two symbols mentioned resolve to:

Code:
std::__default_alloc_template<true, 0>::deallocate(void*, unsigned long): 0
and
Code:
std::__default_alloc_template<true, 0>::allocate(unsigned long): 0

Not that THIS enlightens me a lot..... any hints where I should look?
 
OP
G
Joined
Nov 19, 2008
Messages
3
Reaction score
0
Points
1
I found a "Workaround" for now. After trying to use GCC 4.0 instead of 3.3 for the PPC compile (which failed because one of the project libraries I have to use are not GCC4 - compatible), I switches from STL std::list to QTs QValueList. Not a change I really welcome, but it solves the immediate problem. I now assume there's something fishy with my GCC 3.3 in combination with the SDK 10.3.9.

Ah well, it compiles now.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top