Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top