XCTest unable to link against arm64

I'm trying to us AppCode to run some tests for an iOS8 static framework. The tests compile, link and execute fine in Xcode6, but in AppCode 3.0.6 the linker warns with the following:

Warning:Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/XCTest', missing required architecture arm64 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/XCTest (2 slices)

After the warning, the linker fails with multiple errors similar to :

"Error:Undefined symbol '_OBJC_METACLASS_$_XCTestCase' referenced from:
...
Note:ld: symbol(s) not found for architecture arm64"

This makes sense as /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/XCTest doesn't support arm64 as an architecture:

lipo -info /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
Architectures in the fat file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/XCTest are: i386 x86_64

It's not clear to me why AppCode is attempting to link for that architecture, XCode does not and it's not an issue there.

3 comments
Comment actions Permalink

Hi,

I've tried to reproduce this by creating a new static framework project with Xcode 6.0.1, but everything worked as expected. Could you please also check that it works for you? If it does, then it means that the problem is specific to your project, so it would be great if you could try to reproduce the problem on a fresh project. Alternatively, you can send your .xcodeproj bundle to our support email (appcode-support@jetbrains.com) so we can take a look at it.

0
Comment actions Permalink

I ultimately started the same way you suggest but somewhere along the line, something diverged. By using the clean project you suggested, I was able to diagnose the following

  • The clean project had a setting to link XCTest. Specifically Target -> Build Settings -> Linking -> "Other Linker Flags" has a single value of "-framework XCTest"
  • When I add "-framework XCTest" to the test target in my problematic workspace, AppCode sees it and reloads the configuration.
  • At this point, AppCode functions as expected and is able to link against the XCTest library.
  • Despite my attempts to save this configuration to the Xcode project, it doesn't seem to persist. I've tried numerous times but the "-framework XCTest" linker flag seems to disappear from that project. So far, I haven't observed any negative side effects in AppCode but it does seem odd.


All said and done, the linker error is gone although I still can't run my tests. Now when I try and run my project tests, I get an error of "iOS Device is not selected". Not sure if this is related to the Xcode settings but the tests continue to run fine in Xcode but not AppCode.

0
Comment actions Permalink

Ok, figured out how to properly select a device so you can close this out.

The linker deficiency should be obvious but XCode hides it so deeply, not sure what to say about that.

As a suggestion, it would be much more JetBrains-like to have the simulator be a part of the Run configurations and not buried under the drop-down that only exits between the Build tool button and the Run button in a toolbar. That's not where I expcect to change a runtime configuration if say I'm in IntelliJ.

0

Please sign in to leave a comment.