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

Fix Redefinition of module error in Xcode ≧ 8.3, Take 2 #482

Closed

Conversation

vkedwardli
Copy link

Second attempt to fix this bug (first failed attempt:#465)

Using dynamic generated modulemap now to avoid the Xcode bug, according to Xcode 8.3 release notes:

When building a framework that has module maps in both the source and the install directories that define the same module, the compiler will show a redefinition message. (28638816)

Reference:
ResearchKit/ResearchKit#922
grpc/grpc#10355

Should can fix the error mentioned by @rhishikeshj in #361 (comment)

@shams-ahmed
Copy link

Is this fix ready to be merged?

@vkedwardli
Copy link
Author

@shams-ahmed My PR supports the original Xcode project and cocoapods generated project, I think I don't have anything to add, do inform me if you find any bug, thanks

@daltoniam
Copy link
Owner

This looks cool, Thanks! It would probably be best to test it with all 3 package managers (Swift Package Manager, CocoaPods, and Carthage). It is quite a process to get them to play nicely with the different dependencies (the commonCrypto and zlib) and It would be great if this removes that warning and simplifies all that building a bit 😄.

@vkedwardli
Copy link
Author

Sure thing, will double check on the package manager and cart later when I'm free

@bayareahank
Copy link

We ran into similar Starscream Carthage module redefinition build errors in ParseLiveQuery:
parse-community/ParseLiveQuery-iOS-OSX#159
Hope this fix can solve the problem.

@vkedwardli
Copy link
Author

@bayareahank may be you could help on verifying on Carthage to speed up accepting

@bayareahank
Copy link

Sure.

Disclaimer that I only used Carthage to pull directly from github before, if there is some pointers as to how to build with pull request, that would be helpful.

@vkedwardli
Copy link
Author

@bayareahank try it from my branch
git "https://github.com/vkedwardli/Starscream.git" "fix-module-redefinition"

@bayareahank
Copy link

bayareahank commented Apr 19, 2018

I tried the change in ParseLiveQuery, the app build still runs into errors, though the detailed error message changed a bit from previous one.

Previously it complains "redefinition of module 'SSCZLib' and module 'SSCommonCrypto',
thus could not build Objective-C module 'Starscream' "
parse-community/ParseLiveQuery-iOS-OSX#159

This time it fails to build Object-C module 'SSCZlib'. The detailed error message is:
~/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/Starscream/897f51388f6b1504f1093f2ca7dcd302e2b3128e/Build/Products/Release-iphonesimulator/StarscreamModuleMap/module.modulemap:6:8: error: import of shadowed module 'SSCommonCrypto'
module SSCommonCrypto [system] {
^
~/tmp/liveStarstream/Carthage/Checkouts/ParseLiveQuery-iOS-OSX/Carthage/Checkouts/Starscream/zlib/module.modulemap:6:8: note: previous definition is here
module SSCommonCrypto [system] {
^
~/tmp/liveStarstream/Carthage/Checkouts/ParseLiveQuery-iOS-OSX/Carthage/Checkouts/Starscream/zlib/include.h:2:10: note: submodule of top-level module 'SSCommonCrypto' implicitly imported here
#include <CommonCrypto/CommonCrypto.h>
^
:0: error: could not build Objective-C module 'SSCZLib'

The steps I took are:

  1. Forked ParseLiveQuery-iOS-OSX, modify its Cartfile to point to "vkedwardli/Starscream" "fix-module-redefinition"
  2. Changed Cartfile of sample app to:
    github "bayareahank/ParseLiveQuery-iOS-OSX" "master"
  3. Carthage built fine.
  4. Added ParseLiveQuery framework to the sample iOS app.
  5. Build the app itself, it failed with error messages listed above.

BTW, my set up is Xcode 9.3, Swift 4.1, Carthage 0.29.0, macOS 10.13.4 High Sierra.

Cartfile:
github "bayareahank/ParseLiveQuery-iOS-OSX" "master"

Cartfile.resolved:

github "BoltsFramework/Bolts-ObjC" "1.9.0"
github "BoltsFramework/Bolts-Swift" "e9baa72d04521c3b25ef4fa6fef12b340953ee02"
github "ParsePlatform/Parse-SDK-iOS-OSX" "1.17.1"
github "bayareahank/ParseLiveQuery-iOS-OSX" "2.4.0"
github "vkedwardli/Starscream" "fix-module-redefinition"
github "facebook/facebook-ios-sdk" "sdk-version-4.32.0"

@bayareahank
Copy link

bayareahank commented May 3, 2018

Tried the hack in #445 by Bersaelor, -- manually remove the SSCZLib and SSCommonCrypto module definitions from Carthage/Checkout/Starscream/zlib/module.modulemap file after Carthage build, that solved the problem for me. FYI.

# Conflicts:
#	Starscream.podspec
@vkedwardli
Copy link
Author

vkedwardli commented May 8, 2018

Thanks for the input @bayareahank, I have verified that it is working on Carthage also.

@daltoniam By using SPM's swift package generate-xcodeproj with your master branch, the generated xcodeproj cannot locate the SSCZLib/SSCommonCrypto anyways, while using swift build, both the master branch and my pull request are building successfully (since they are both using your zlib-spm and common-crypto-spm, nothing related to my script)

What is the intended usage for SPM in this project? I thought SPM doesn't support iOS officially?
Thanks

@vkedwardli
Copy link
Author

The fix in #520 is more elegant, closing this one.
Would be great if @daltoniam can spend some time to review and accept #520 😁

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

Successfully merging this pull request may close these issues.

4 participants