2009-01-28 60 views
8

我试图移植一个Windows项目,其中包括升压1.37和wxwidgets到Mac。它编译好,但链接器给我一个“文件不是架构ppc的必需架构”的libz.1.dylib错误和相同的消息警告其他一些库。我还得到了libz.1.dylib的“duplicate dylib”警告。Xcode/GCC链接问题:文件不是必需的架构

连接器输出看起来是这样的:

建设目标“Gemsweeper机”项目的“Gemsweeper陆委会”与配置“调试”

检查依赖性

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 

我很新到Mac plattform,所以任何帮助将不胜感激!

感谢,

阿德里安

回答

2

从你得到的消息中,大多数Gemsweeper Mac和libboost已经被编译为只有ppc作为体系结构。您应该配置Xcode以生成通用二进制文件,并可能通过MacPorts重新编译libboost。最近的MacPorts有一个“通用”目标,虽然如果你不打算在ppc上运行它,你可以重新编译它。

您似乎还需要重新编译zlib和libiconv。

2

听起来像是你需要重新下载或重建提升为Mac。无论你需要做什么dylib。简单来说,你真的只需要重新安装库。

随着提升,你不需要重新下载整个事情,资源本身是多平台的,它只是从平台变为平台的二进制文件(libs等)。很可能你已经下载了所有的源代码,所以你只需要从源代码重建库。 http://www.boost.org/doc/libs/1_37_0/more/getting_started/unix-variants.html为您提供了一些关于使用bjam构建boost的信息。我知道在Windows上他们有预编译的二进制文件,但我在Mac的boost网站上看​​不到任何关于这个的信息。

0

使用sudo port xxx install + universal卸载并重新安装zlib和libiconv(以及十几个其他相关的库)。感谢您的快速回复! :-)

+0

4年是猎豹的速度。事实上,它的其他窥视使用asio在未来。我遇到了同样的问题,并花了我1天或更多的时间来解决混淆的问题。现在它的ssl错误。你尝试过SSL服务器吗? – 2013-01-29 19:46:25

0

你需要针对本地架构,而不是两个“普遍”的目标。

这涉及到根据您的xcode版本将xcode设置为“Build Machine的本地架构”,“仅构建活动架构”和“有效架构”。但清理所有可能的架构变体。

那是因为使用默认./b2 install的提升将只会得到本机架构。

尝试./b2 install toolset=intel

可能(和未经考验的)解决方案的两倍建设助推重新安装提升。

英特尔./b2 install --prefix=/usr/local/x64 toolset=intel

本地./b2 install --prefix=/usr/local/ppc