Search code examples
frameworksswift2xcode7commoncrypto

Xcode 7.3 beta 1 vs. CommonCrypto in Swift


I'm using CommonCrypto in a Swift framework - and it's been working fine for over a year.

I used solutions found here: Importing CommonCrypto in a Swift framework

Specifically, to reference CommonCrypto from the Swift framework, I had to:

Create a module.map file in a folder named CommonCrypto next to my framework's Xcode project. module.map contents:

module CommonCrypto [system]
{
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    link "CommonCrypto"
    export *
}
  • In my framework project's Swift Import Paths, I add CommonCrypto
  • In my framework project's Library Search Paths, I include: $(SDKROOT)/usr/lib/system
  • In my source, I include: import CommonCrypto

This worked fine; a little convoluted - but it worked.

However, in Xcode 7.3 beta 1 (7D111g), this technique no longer works.

It appears that libcommonCrypto.tbd has been removed from: $(SDKROOT)/usr/lib/system inside Xcode-beta.app. And I can't find it anywhere under the iPhoneOS SDK folder structure.

So I get these errors:

ld: warning: directory not found for option '-L/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/system' ld: library not found for -lCommonCrypto for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

It would be great if the crazy module map business was replaced with something simpler. Like for instance, just using import CommonCrypto

In any case, I'm not sure how to resolve this, so any help is appreciated.

I'm asking here as a new question in the event that the solution is substantially different from solutions found in the previous question, although I appreciate this may not be appropriate.


Solution

  • It looks like the solution is to remove the line:

    link "CommonCrypto"
    

    from the module.map file.