2009-01-28 59 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