尝试分析时,GENERIC_RELOC_SECTDIFF 缺少体系结构 i386 的以下对
我正在尝试分析(如 gcov 风格分析)我在 Snow Leopard (10.6) 上链接到 iOS 5.0 的 Xcode 4.2 项目的单元测试。我已打开 -fprofile-arcs -ftest-coverage 并且正在链接 -lprofile_rt。使用 LLVM 3.0 编译。
我的目标是一个静态库,正在由单元测试包进行测试。
一切都编译得很好,但在单元测试包的链接步骤中,我得到:
ld: in Foo/DerivedData/Foo/Build/Intermediates/Foo.build/Debug Profile-iphonesimulator/UnitTests.build/Objects-normal/ i386/TestUtilities.o,在 _DATA 部分,_const reloc 0:GENERIC_RELOC_SECTDIFF 缺少以下对架构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配置文件-iphonesimulator" -L/Developer/usr/lib"-FFoo/Build/Products/Debug 配置文件-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配置文件-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 -福-framework Foundation -framework SenTestingKit -lprofile_rt -o "Foo/DerivedData/Foo/Build/Products/Debug Profile-iphonesimulator/UnitTests.octest/UnitTests"
有人知道为什么我无法链接吗?
I am attempting to profile (as in gcov style profiling) my unit tests for an Xcode 4.2 project on Snow Leopard (10.6) linking against iOS 5.0. I have turned on -fprofile-arcs -ftest-coverage and I'm linking against -lprofile_rt. Compiling with LLVM 3.0.
My target is a static library that is being tested by a unit test bundle.
Everything compiles fine, but in the link step for the unit test bundle I get:
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
This is the actual link step:
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"
Anyone have any ideas why I can't link?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这似乎是编译器中的一个错误。我的 TestUtilities.m 文件非常复杂(有很多 STAssertEquals)。 STAssertEquals 宏通过 @try/catch 块扩展为相当复杂的代码块。通过定义我自己的 STAssertEquals(功能稍微少一些,但没有 @try 块),它足够简化我生成的代码,使编译器/链接器对此感到满意。我会提交一个合适的雷达。
Turns out that it appears to be a bug in the compiler. My TestUtilities.m file was quite complex (with a lot of STAssertEquals). The STAssertEquals macro expands to quite a complex chunk of code with a @try/catch block. By defining my own STAssertEquals that was slightly less featured but that didn't have an @try block, it simplified my generated code enough that the compiler/linker was happy with it. I'll file an appropriate radar.