SQLite.swift: Build failing with Xcode 7.3 beta

My configuration is:

  • Using latest Xcode 7.3 beta (7D129n)

  • Using latest version of Cocoapods (0.39.0)

  • with Podfile:

    use_frameworks!
    
    target 'app' do
    
    pod 'SQLite.swift'
    
    end
    

I tried with or without xcode-select -s [PATH_TO_XCODE_BETA] or xcode-select -s [PATH_TO_XCODE], but they both failed by following reason:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:1:8: error: redefinition of module 'Compression'
module Compression [system] [extern_c] {
       ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/include/module.modulemap:1:8: note: previously defined here
module Compression [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:6:8: error: redefinition of module 'Darwin'
module Darwin [system] [extern_c] {
       ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/include/module.modulemap:6:8: note: previously defined here
module Darwin [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:1478:8: error: redefinition of module 'os'
module os [system] [extern_c] {
       ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/include/module.modulemap:1599:8: note: previously defined here
module os [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/module.modulemap:1494:8: error: redefinition of module 'libkern'
module libkern [system] [extern_c] {
       ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/include/module.modulemap:1615:8: note: previously defined here
module libkern [system] [extern_c] {
       ^
<unknown>:0: error: could not build Objective-C module 'SQLite'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 33 (11 by maintainers)

Most upvoted comments

The behavior for this appears to have changed in the final version of Xcode 7.3, at least for AppleTV (haven’t tested iOS yet).

Previously, for AppleTV using iPhoneOS.platform worked fine. However as of 7.3, when building for device the platform in the path needs to be AppleTVOS.platform and when building for simulator, the path needs to be AppleTVSimulator.platform.

If the platforms don’t match, it results in the above “redefinition of module” errors. I suspect this is likely affecting iOS as well.

Hello,

Try the following:

  • Update Xcode to the latest 7.3 beta 3 (7D141l)
  • Change the path to sqlite3.h in podstuff/module.modulemap by replacing Xcode.app with Xcode-beta.app.

You may need to clean everything before Xcode notices the change, though.

@cjwirth That looks like a more elegant solution to the problem! It achieves what I was hoping a spec.ios.simulator.module_map scope would allow. Thanks for the link! Anyone with the time to contribute a PR will see a quick merge and version bump! 😄

I don’t have 7.3 on the machine I have right now yet, so I can’t guarantee that it will work.

I took a different approach when I added CocoaPods support to Swifter. I basically copied the technique from this article. 👈 There is a script in there that also tries to get the correct SDK root for the version of Xcode that is being used. You can take that part out if you just want to support Official Xcode.app

Basically, it came down to making 3 different module map files, and in the Build Settings, changed which one it was looking at based on the configuration. It worked in 7.2 on an app we currently have released to the app store.

Plus, we wouldn’t have to do that whole #if (OSX) import SQLiteOSX ... dance

Actually, even GRDB tests won’t run in the simulator unless I pick the exact header for the iPhoneSimulator platform .../iPhoneSimulator.platform/... (and of course CocoaPods is not involved).

Don’t you have this issue as well?