Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building Error #51

Closed
AllenEzailLai opened this issue Nov 2, 2016 · 18 comments
Closed

Building Error #51

AllenEzailLai opened this issue Nov 2, 2016 · 18 comments

Comments

@AllenEzailLai
Copy link

When I update XCode 8.1 and re-build my project I get errors:

Header '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/CommonCrypto//CommonCrypto.h' not found
AND
Could not build Objective-C module 'CommonCrypto'

thank you for help

@Tibb
Copy link

Tibb commented Nov 3, 2016

The reason is you just updated Xcode and your iOS SDK: the error comes from this module.map file where the path isn't valid anymore.

Just replace
iPhoneSimulator10.0.sdk
with
iPhoneSimulator10.1.sdk

This is temporary solution, but it worked for me ;)

@iosdevzone this should be a rather quick update, right? Can we hope a fix soon?
Meanwhile, I'll try to take a look and make a pull request..
Thanks

@CBeloch
Copy link

CBeloch commented Nov 3, 2016

These lines in module.map are generated during the build of the framework.
When you build it together with your app you should be fine

@Tibb
Copy link

Tibb commented Nov 4, 2016

Yes I know @CBeloch.. It's working fine on the Xcode side. But building it via Fastlane generates this error (using gym).
Same error when try to archive via Xcode.

My target and project are set to the latest sdk (10.1).
My gym config is also explicitly set to "iphoneos10.1".
Basically every configuration parameter relative to the sdk should be set to 10.1.

I also clean pod cache and derived data before build.
Still getting this wrong 10.0 path element..

@Tibb
Copy link

Tibb commented Nov 4, 2016

Well well well, I deleted the IDZCommonCrypto pod, then reinstall it, and... it works!
There was probably some remaining artifacts of the previous Xcode version somewhere.
Hope it helps

@AllenEzailLai
Copy link
Author

it works~!! thank u~

@Tibb
Copy link

Tibb commented Dec 14, 2016

And.... Same error again after the last Xcode update. (sdk 10.1 instead of 10.2 in the module.map path).

I tried:

  • clean project
  • clean derived data
  • uninstall/reinstall the pod
  • relaunch Xcode

None of these solutions worked.

The only temporary working solution so far is a manual modification of the module.map file path.

All module.map files paths of my other pods are good.

What am I missing?

@iosdevzone
Copy link
Owner

iosdevzone commented Dec 14, 2016

The module.map file is generated during the build if (and only if) one does not exist.

How it is produced depends on whether your are using Cocoapods or the Xcode workspace. In the Cocoapods case a prepare_command script is created by the podspec and run after the pod is installed. In the Xcode workspace case, the script is run by a Run Script build phase. All these scripts do is invoke GenerateCommonCryptoModule.swift a number of times to generate the platform-specific module.maps. The GenerateCommonCryptoModule.swift script determines the correct SDK version using xcrun --sdk <sdk_name> --show-sdk-path.

When you upgrade Xcode you must do the following:
• use sudo xcode-select -p <path_to_new_xcode> to ensure that xcrun will find the correct SDK
• perform a completely clean build, that is, remove all generated files including the module.map files.

If you are constantly running into the problem of SDK mismatches, you are failing to one of the above steps.

Hope this explanation helps you make your Xcode upgrades smoother.

@CBeloch
Copy link

CBeloch commented Dec 15, 2016

The map generated in the build process has a problem when your path contains spaces.
I made a pull request already that fixes this issue: #52

@Tibb
Copy link

Tibb commented Dec 15, 2016

Thanks a lot for the help guys.

@iosdevzone I performed your recommended steps:

  • xcode-select -p returns /Applications/Xcode.app/Contents/Developer which seems to be ok. Going a bit further -> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk

This is my one and only instance of Xcode.app
I checked the SDK info.plist: 10.2

  • I also performed a completely clean build: I removed every generated resources from IDZ including the module.map (basically the whole generated framework)

Unfortunately, I still got the same error :(

Here is my generated module.map content:

module CommonCrypto [system] {
  header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.1.sdk/usr/include/CommonCrypto//CommonCrypto.h"
  header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.1.sdk/usr/include/CommonCrypto//CommonRandom.h"
  export *
}

Am I the only one facing this issue?

@iosdevzone
Copy link
Owner

This very strange. Use the command
xcrun --sdk iphonesimulator --show-sdk-path
and let me know the result.

@Tibb
Copy link

Tibb commented Dec 16, 2016

Here's the result:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk .... very strange indeed.

It doesn't make sense for me, and after having checked every configuration parameter, file, resource, etc, I'm running out of solution.

@iosdevzone
Copy link
Owner

iosdevzone commented Dec 16, 2016

There's only a few possibilities left:
• perhaps you are not really deleting the module.map files, or perhaps the wrong ones,
• perhaps you inadvertently checked the module.map files into source code control and something in your build is retrieving them from there,
• there could be something in your build that is aliasing xcrun or changing your PATH such that the answer you are getting on the command line is different from the one the script sees during a build.
I have a test repository I use to make sure the project builds with CocoaPods IDZSwiftCommonCryptoCocoaPodsTest you could try that and ensure that it builds.

@Tibb
Copy link

Tibb commented Dec 16, 2016

Thanks a lot for your help, I'll check your example and your suggestions. I'll let you know if (I hope) find the problem.

@iosdevzone
Copy link
Owner

You're welcome! I hope you get to bottom of it. Let me know if you need any more help.

@Tibb
Copy link

Tibb commented Dec 29, 2016

I tried your Test project -> same path error

Terminal:
/usr/bin/xcrun --sdk iphoneos --show-sdk-path

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk

/usr/bin/xcrun --sdk iphonesimulator --show-sdk-path

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk

I'm desperate...

@Tibb
Copy link

Tibb commented Dec 29, 2016

Since I was not able to find the source of this error (I even completely reinstalled Xcode), I decided to remove your lib and make the encryption layer by myself.
Thanks again for your precious help and sorry that we didn't managed to figure this out.

@iosdevzone
Copy link
Owner

I'm really sorry we couldn't get to the bottom of this. Remember you can always use the project directly (without CocoaPods) this will make it easier to see build logs. However you decide to proceed the best of luck with your project and thanks for all the time you spent trying to get to the bottom of the issue. Happy New Year!

@Tibb
Copy link

Tibb commented Jan 9, 2017

Thank you @iosdevzone and Happy New Year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants