What is the best way to include CommonCrypto in an iOS modulemap?

Originator:igeek1
Number:rdar://40554795 Date Originated:May 25 2018, 11:19 AM
Status:Duplicate of 18256932 Resolved:June 18 2018, 2:29 AM
Product:Developer Tools Product Version:
Classification:Suggestion Reproducible:
 
Filing this radar for reference so a coworker can ask about it in person at the WWDC labs.

What is the best way to include the CommonCrypto headers in an iOS modulemap? This seems like a good way at first blush:

https://github.com/soffes/CommonCrypto/pull/7/files#diff-3c791a23fd3c0fa2dd79b396aab323d4

module CommonCrypto [system] {
    header "/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

However, some people have reported problems with this approach, since that file may apparently not always exist, as reported in this GitHub issue: https://github.com/soffes/CommonCrypto/issues/8

A more fragile solution is to do it like this:

header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"

The problem is that this relies on /Applications/Xcode.app existing, which it does not on many machines where multiple Xcode versions are managed by naming them like /Applications/Xcode_9.3.app or /Applications/Xcode/9.3/Xcode.app.

One could write a run script build phase that injects the output of `xcode-select -p` into the modulemap. This is the most robust solution I can think of, but I was wondering if there’s a simpler, supported way to do it?

Comments

Apple Developer Relations - August 16 2018, 10:08 AM

The original report on your issue has been closed recently. Please note that you will not be able to directly view the original report in order to keep its information confidential. If you have further questions about this issue, please update your report using the Apple Bug Reporter http://bugreport.apple.com.

Apple Developer Relations - June 6 2018, 8:11 PM

Thanks for reporting this. However, please don't do that. As a general rule: - System level headers shall never be modularized by users. One should file a bug report and we should take care of proper modularizing it at the system level module maps. - Full paths in module maps are not the way to go, since it can confuse the interaction while building other modules.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!