8

我正在尝试将包含 boost 1.37 和 wxwidgets 的 Windows 项目移植到 Mac。它编译正常,但链接器给我一个 libz.1.dylib 的“文件不是架构 ppc 所需的架构”错误,并且与其他一些库的警告相同的消息。我还收到 libz.1.dylib 的“重复 dylib”警告。

链接器输出如下所示:

使用配置“Debug”构建项目“Gemsweeper Mac”的目标“Gemsweeper Mac”</p>

检查依赖关系

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 平台很陌生,因此将不胜感激任何帮助!

谢谢,

阿德里安

4

4 回答 4

2

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

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

于 2009-01-28T08:36:12.263 回答
2

从您收到的消息来看,大部分 Gemsweeper Mac 和 libboost 都是仅使用 ppc 作为架构编译的。您应该配置 Xcode 以生成通用二进制文件,并可能通过 MacPorts 重新编译 libboost。最近的 MacPorts 有一个“通用”目标可以提供帮助,但如果你不打算在 ppc 上运行它,你只需重新编译它。

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

于 2009-01-28T08:44:44.773 回答
0

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

于 2009-01-28T14:22:14.577 回答
0

您需要针对本机架构,而不是两个..“通用”架构。

这涉及将 xcode 设置为“构建机器的本机架构”、“仅构建活动架构”和“有效架构”,具体取决于您的 xcode 版本。但清除所有可能的架构变体。

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

尝试重新安装boost./b2 install toolset=intel

一个可能的(且未尝试过的)解决方案是两次构建提升。

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

本国的./b2 install --prefix=/usr/local/ppc

于 2013-01-29T17:56:16.507 回答