Xcode / GCC linking issue: file is not of required architecture

14,155

Solution 1

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.

Solution 2

Sounds like you need to redownload or rebuild boost for Mac. And whatever dylib is you need to do that to. In simple terms you really just need to reinstall the libraries.

With boost you don't need to redownload the whole thing again, the sources themselves are multiplatform, it's just the binaries (the libs and such) which change from platform to platform. Chances are you already have downloaded all the sources, so you'll just need to rebuild the library from the sources. http://www.boost.org/doc/libs/1_37_0/more/getting_started/unix-variants.html gives you some information about building boost using bjam. I know on windows they have precompiled binaries but I can't see anything about that on the boost website for Mac.

Share:
14,155
Adrian Grigore
Author by

Adrian Grigore

I'm a freelancer software developer from Germany specializing in ASP.NET MVC and related technlogies. Send me a message if you are interested in hiring me for development / consulting services. My current main project is a web-based, team-oriented project time tracking software for desktop and mobile devices: LogMyTime Zeiterfassung. Adrian Grigore's Blog on Software Development

Updated on July 07, 2022

Comments

  • Adrian Grigore
    Adrian Grigore almost 2 years

    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

  • Gabe Rainbow
    Gabe Rainbow over 11 years
    4 years is cheetah pace. in fact, its for other peeps using asio in the future. i ran across the same problem and it took me 1 day or more to resolve the confounded problem. now its ssl error. did you try the ssl server.