2012-02-04 17 views
0

我試圖在Snow Leopard(10.6)上鍊接到iOS 5.0的Xcode 4.2項目中對我的單元測試進行配置文件(如在gcov樣式分析中)。我打開了-fprofile-arcs -ftest-coverage,並且我正在鏈接-lprofile_rt。使用LLVM 3.0編譯。GENERIC_RELOC_SECTDIFF在試圖配置文件時丟失以下配對用於體系結構i386

我的目標是一個靜態庫,正在通過單元測試包進行測試。

一切編譯罰款,但在單元測試包中的鏈接步驟獲得:

ld: in Foo/DerivedData/Foo/Build/Intermediates/Foo.build/Debug Profile-iphonesimulator/UnitTests.build/Objects-normal/i386/TestUtilities.o, in section _DATA,_const reloc 0: GENERIC_RELOC_SECTDIFF missing following pair for architecture i386

這是實際的鏈接步驟:

setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -bundle -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk "-LFoo/Build/Products/Debug Profile-iphonesimulator" -L/Developer/usr/lib "-FFoo/Build/Products/Debug Profile-iphonesimulator" -F/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Developer/Library/Frameworks -F/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Developer/Library/Frameworks -filelist "Foo/DerivedData/Foo/Build/Intermediates/Foo.build/Debug Profile-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fprofile-arcs -ftest-coverage -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -lFoo -framework Foundation -framework SenTestingKit -lprofile_rt -o "Foo/DerivedData/Foo/Build/Products/Debug Profile-iphonesimulator/UnitTests.octest/UnitTests"

任何人有任何想法爲什麼我不能鏈接?

回答

0

原來,它似乎是編譯器中的一個錯誤。我的TestUtilities.m文件非常複雜(有很多STAssertEquals)。 STAssertEquals宏通過@ try/catch塊擴展爲相當複雜的代碼塊。通過定義我自己的功能稍差的STAssertEquals,但沒有@try塊,它簡化了我生成的代碼,足以讓編譯器/鏈接器對它感到滿意。我將提交適當的雷達。

+0

歸檔爲http://openradar.appspot.com/radar?id=1499403 – dmaclach 2012-02-05 18:32:37

+0

這裏值得一提的是,這個問題正在Xcode 8中出現,它不一定是由xcode引起的,而是由LLVM本身和核心原因也可能是一個非常長的函數定義或文件實現。 – carbonr 2016-09-22 10:59:50

相關問題