I am trying to port a windows project that includes boost 1.37 and wxwidgets to the Mac. It compiles ok, but the linker gives me a ‘file is not of required architecture for architecture ppc’ error for libz.1.dylib and the same message as a warning a few other libraries. I also get a ‘duplicate dylib’ warning for libz.1.dylib.
The linker output looks like this:
Building target “Gemsweeper Mac” of project “Gemsweeper Mac” with configuration “Debug”
Checking Dependencies
Ld '/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug/Gemsweeper Mac.app/Contents/MacOS/Gemsweeper Mac' normal i386 cd '/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac' setenv MACOSX_DEPLOYMENT_TARGET 10.4 /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk '-L/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug' -L/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib -L/opt/local/lib '-F/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug' -F/Users/adriangrigore/Library/Frameworks -F/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks -filelist '/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/Gemsweeper Mac.LinkFileList' -mmacosx-version-min=10.4 -L/opt/local/lib -L/Users/adriangrigore/wxwidgets-manual/wxMac-2.8.9/lib /opt/local/lib/libboost_system-mt.a /opt/local/lib/libboost_program_options-mt.a /opt/local/lib/libboost_thread-mt.a -arch ppc -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL /Users/adriangrigore/wxwidgets-manual/wxMac-2.8.9/lib/libwx_mac-2.8.a -framework WebKit -lwxexpat-2.8 -lwxtiff-2.8 -lwxjpeg-2.8 -lwxpng-2.8 -lz -lpthread -liconv -framework SDL -framework Cocoa -o '/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug/Gemsweeper Mac.app/Contents/MacOS/Gemsweeper Mac' ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/main.o, file is not of required architecture ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/variousfunctions-xcode.o, file is not of required architecture ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/ParticleLayers.o, file is not of required architecture ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/SDLMain.o, file is not of required architecture ld warning: in /opt/local/lib/libboost_system-mt.a, file is not of required architecture ld warning: in /opt/local/lib/libboost_program_options-mt.a, file is not of required architecture ld warning: in /opt/local/lib/libboost_thread-mt.a, file is not of required architecture ld warning: in /opt/local/lib/libz.dylib, file is not of required architecture ld warning: in /opt/local/lib/libiconv.dylib, file is not of required architecture ld: in /opt/local/lib/libz.1.dylib, file is not of required architecture for architecture ppc collect2: ld returned 1 exit status ld warning: duplicate dylib /opt/local/lib/libz.1.dylib ld warning: duplicate dylib /opt/local/lib/libiconv.2.dylib
I’m quite new to the Mac plattform, so any help would be greatly appreciated!
Thanks,
Adrian
From the messages you’ve got, most of Gemsweeper Mac and libboost have been compiled with only ppc as architecture. You should configure Xcode to generate universal binaries and probably recompile libboost through MacPorts. Recent MacPorts have a ‘universal’ target that could help although if you don’t plan to run it on ppc, you get just recompile it.
You seem to need to recompile zlib and libiconv as well.