2011-09-01 35 views
6

有沒有人知道這個警告是什麼意思?其次是錯誤:ld:warning:section __DATA/__ objc_imageinfo__DATA意外的大尺寸

Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

這是爲iPad的Xcode項目。我只在編譯模擬器時看到這一點,而不是設備。我已經將一個靜態庫(* .a)鏈接到這個項目,那就是我認爲這個失敗的地方。此外,它曾經在模擬器上運行,沒有問題,我不知道發生了什麼變化。

所有的編譯器輸出:

Ld /Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Products/Debug-iphonesimulator/IQ.app/IQ normal i386 
    cd /Users/cduckering/Desktop/LitePoint/Apps/App/IQ 
    setenv MACOSX_DEPLOYMENT_TARGET 10.6 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Products/Debug-iphonesimulator -F/Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Products/Debug-iphonesimulator -filelist /Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Intermediates/IQ.build/Debug-iphonesimulator/IQ.build/Objects-normal/i386/IQ.LinkFileList -mmacosx-version-min=10.6 -dead_strip -ObjC -all_load -fprofile-use -Xlinker -objc_abi_version -Xlinker 2 -lCorePlot-CocoaTouch -weak_framework QuickLook -weak_framework MessageUI -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -Xlinker -object_path_lto -Xlinker /Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Intermediates/IQ.build/Debug-iphonesimulator/IQ.build/Objects-normal/i386/IQ.lto_temporary.o -o /Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Products/Debug-iphonesimulator/IQ.app/IQ 

ld: warning: section __DATA/__objc_imageinfo__DATA has unexpectedly large size 368 in /Users/cduckering/Library/Developer/Xcode/DerivedData/IQ-bldfqilntfqfrccozykbqulagovx/Build/Intermediates/IQ.build/Debug-iphonesimulator/IQ.build/Objects-normal/i386/IQ.lto_temporary.o 
Assertion failed: (_mode == modeFinalAddress), function finalAddress, file /SourceCache/ld64/ld64-123.2/src/ld/ld.hpp, line 573. 
0 0x10001286c __assert_rtn + 76 
1 0x10008c71c ld::tool::OutputFile::addressOf(ld::Internal const&, ld::Fixup const*, ld::Atom const**) + 188 
2 0x10008ed58 ld::tool::OutputFile::applyFixUps(ld::Internal&, unsigned long long, ld::Atom const*, unsigned char*) + 2840 
3 0x10008b62e ld::tool::OutputFile::writeOutputFile(ld::Internal&) + 814 
4 0x10008431c ld::tool::OutputFile::write(ld::Internal&) + 156 
5 0x100012e3f main + 1247 
6 0x100000e14 start + 52 
collect2: ld returned 1 exit status 
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 

回答

2

錯誤是一個內部錯誤,當LLVM編譯器未找到它期望在最終鏈接時優化階段期間找到的符號時出現。一個常見的原因是鏈接到一個靜態庫,它有一些基本的符號被剝離(鏈接靜態庫本身時不會產生錯誤,但如果庫是動態鏈接的話就會產生錯誤)。

雖然也LLVM不報告的真實錯誤的錯誤,正確的解決方法是確保靜態庫鏈接過程中有助於他們應該在所有符號。嘗試檢查項目中包含的靜態庫的構建設置,確保禁用鏈接產品(.a文件)的剝離或設置爲僅剝離調試符號。

如果不控制靜態庫的建設,一個解決方法是禁用LLVM鏈接時優化,儘管這可能會導致生產的次優碼。

4

解決。

當我將名爲「C/C++編譯器版本」的構建設置從「LLVM GCC 4.2」更改爲「GCC 4.2」時,此警告和錯誤消失。

+0

的確如此。看起來新編譯器還沒有準備好黃金時間。我有一個編譯Mac代碼的類似問題。調試版本可以正常工作,但由於類似於您的問題而無法編譯發佈版本,並且鏈接動態庫時發生問題。 – adib

+1

使用Xcode 4.2,您應該使用Apple LLVM Compiler 3.0。 – LearnCocos2D

3

只有在生成設置「鏈接時間優化」(LLVM_LTO = YES)啓用時,纔會出現「意外的大尺寸」。我建議將其禁用(默認)。