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

Missing required module 'minizip' #134

Open
troupmar opened this issue Apr 5, 2018 · 25 comments
Open

Missing required module 'minizip' #134

troupmar opened this issue Apr 5, 2018 · 25 comments

Comments

@troupmar
Copy link

troupmar commented Apr 5, 2018

We wanted to incorporate Zip framework within our open-source QuantiLogger framework and struggled with Missing required module ‘minizip’ problem. We have spent couple days trying to solve the problem without any success. We have also observed existing issues related to this problem and tried all proposed solutions. Finally we ended up using ZipFoundation instead.

In order to demonstrate the problem, we created a simple example app. It is just an empty Simple View App that does not actually do anything apart from including the Zip framework. We used Carthage to import the framework. After I prepared the demonstrating app, it all built successfully even with included Zip framework. I also tried to create a new folder where I cloned the demonstrating app directly from Github and again, built successfully. The problem occured when another team member cloned the repository. After he did so, he build with Missing required module ‘minizip’ failure. Then he performed carthage update and suddenly all built successfully.

You can hopefully recreate the problem as well by cloning the demonstrating app and trying to build it.

As mentioned before, we solved the problem by using another framework (unfortunately). However we are very curious why the problem occurs since we spent much time trying to solve it ourselves.

@letko-dmitry
Copy link

I got the same problem trying to import the IOS-Pods-DFU-Library library via Carthage

@AvdLee
Copy link
Collaborator

AvdLee commented Jun 15, 2018

This should be fixed with #119.

@AvdLee AvdLee closed this as completed Jun 15, 2018
@troupmar
Copy link
Author

We updated the Zip library within the demonstrating app in order to test the fix and the problem did not disappear! The only difference is that instead of Missing required module ‘minizip’ we are now having Missing required module ‘Minizip’ failure.

@MarcSteven
Copy link

@troupmar Unbelievable ,but today I met this weird issue ........OMG

@MarcSteven
Copy link

@AvdLee I find all the links about this problem, but cannot find the suitable method to solve it .so I think there is a smart way to solve this ...

@AvdLee
Copy link
Collaborator

AvdLee commented Aug 27, 2018

Reopening this as it seems to not be fixed yet. @simonseyer you've mentioned in your PR before that this should have been fixed.

Are you able to test this with @troupmar 's test app and submit a fix?

@AvdLee AvdLee reopened this Aug 27, 2018
@MarcSteven
Copy link

@AvdLee I had tried once more and then find the issue is not existing (If I use Cocoapods or Carthe ),work well,The issue is from I did that manually without dependency management tool .As the library I used iOS-DFU-Library depended on your library ,so pls ensure the issue .

@balland
Copy link

balland commented Oct 4, 2018

We have encountered the same issue. Could it be related to Carthage/Carthage#1903?

@kenji21
Copy link

kenji21 commented Nov 15, 2018

Just found a way to reproduce this issue (got it on our Jenkins, then replaced my local Carthage/Build folder to the one built on jenkins side, and got the same issue), then I make it simple (and local):

kenji@macboo:~/source-cache/project$ carthage bootstrap
kenji@macboo:~/source-cache/project$ xcodebuild -derivedDataPath ./DerivedData .....
kenji@macboo:~/source-cache/project$ echo $?
0
kenji@macboo:~/source-cache/project$ cd ..
kenji@macboo:~/source-cache$ mv project other
kenji@macboo:~/source-cache$ cd other
kenji@macboo:~/source-cache$ rm -rf DerivedData
kenji@macboo:~/source-cache/other$ xcodebuild -derivedDataPath ./DerivedData .....
CompileSwift normal x86_64 /Users/kenji/source-cache/other/Some/Some.swift (in target: Target)
[big command]
<unknown>:0: error: missing required module 'minizip'
	CompileSwift normal x86_64 /Users/kenji/source-cache/project/Some/Some.swift
	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(150 failures)
kenji@macboo:~/source-cache/other$ echo $?
65

Moving back other to project make xcodebuild builds fine (after removing DerivedData)

I think it is related to bcsymbolmap file containing absolute paths...

@PierreMardon
Copy link

Seems like @kenji21 spotted the problem right, we have our carthage framework working locally but when another dev fetches it it doesn't work on his workstation.

@AlexIzh
Copy link

AlexIzh commented Nov 30, 2018

I'm also looking for solution for this issue. Unfortunately, it is related not only to this repository, but all frameworks which uses modulemap inside. Easiest way to reproduce it - to build a framework(manually or via carthage) and then remove/move sources to another folder.
Example:

carthage update
mv Carthage/Checkout Carthage/Checkout_

Why does it happen?
Seems like when a framework project contains a module with C code and as result a module map to this code, then result framework will contain links to the same C code with absolute paths. You can see that inside Zip.framework/Modules/Zip.swiftmodule/. Just open any swiftmodule file with any text editor and look for old modulemap path.
I mean, this C code/headers(maybe just headers, not sure about that) should be placed at the same place for using the framework, otherwise framework won't find this C-module (in this case - minizip)

Workaround
Only workaround what I've found is to copy minizip folder(folder with C code) inside your project (where you have to use Zip.framework) and configure Import Paths to this directory. Then, when Zip.framework have to find mini zip module, it will use the project settings (module is configured and load to the project already).
So, either do not remove Checkout directory for carthage (because framework will look for minizip module there) and as result do not use any caches for carthage (like rome), or add minizip directory to your project and configure Import Paths.

If someone knows how it could be avoided, I would gladly to use it, because I don't like either solutions. Much better when a framework contains all code/information and we do not need to do anything for working with it

Bridging-Header solution
If we remove using modulemap and add Bridging-Header to the project, then this case will work only when we don't have Checkouts folder. But at the same time, it won't work if sources are there (if you build it through carthage and do not remove Checkouts directory). In that case you will have Failed to import bridging header error when trying to build your project.

@patryk-sredzinski
Copy link

@AlexIzh
Thank you, I've been experiencing same issue with iOS-DFU-Library (we were excluding Carthage/Checkouts in repo)

and I couldn't find a solution.

Adding 'minizip' folder to project and adding Import Paths worked! Thanks!

@adaslesniak
Copy link

adaslesniak commented Apr 28, 2019

I have the same issue. But I can't add folder as I am doing this inside framework project and I need to be able to copy all required frameworks to target which will use framework I am working on. Furthermore I can not change Zip to anything else, as I am using MetaWear.framework which does depends on your framework :(
And... hmmm... yes, I am also using iOSDFULibrary.framework

Furthermore - weird thing is that I got it running, just after moving project to other folder and deleting DerivedData folder it all went bad.

@ravitripathi
Copy link

ravitripathi commented Sep 8, 2019

This issue is still present. It's been more than an year. Since I do not like the idea of adding a sub-dependency for a carthage dependency manually, I'm going to switch back to CocoaPods for now. Sad.

@MarcoFilosi
Copy link

This issue is present also in latest version 2.0.0 using Swift Package Manager on XCode 11.4.1.
Please fix it as soon as possible, or, in alternative, make version 2.0.0 available on CocoaPods too.
Thanks
Screenshot 2020-05-04 at 22 34 35

@marmelroy
Copy link
Owner

Hi all, sorry for those struggling with this. Is it still an issue with the latest release?

@ravitripathi
Copy link

@marmelroy Haven't tried it in a while now. Checking it now to see if it persists.

@ravitripathi
Copy link

@marmelroy Just tried with Carthage on Xcode 11.7. Now getting No such module Zip on import Zip statement. Works fine with SPM though 👍🏽

@MarcoFilosi
Copy link

MarcoFilosi commented Oct 1, 2020

@marmelroy It has not been fixed.
Tried on XCode 12.0.1 using SPM to install Zip v. 2.1.1. The error persists:

Screenshot 2020-10-01 at 08 32 49

@wvdk
Copy link

wvdk commented Nov 3, 2020

Has anyone solved this for Swift Package Manager?

@mdroz
Copy link

mdroz commented Feb 24, 2021

Bump. Still seeing this. Xcode 12.4, targeting iOS 14.4.

@barbasevich
Copy link

The problem lays in SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**". It's not a reliable way to depend on ${SRCROOT} as the binary could be built on a different machine or sources could be deleted.

Steps to reproduce:

  1. Integrate the framework with Carthage github "marmelroy/Zip" ~> 2.1
  2. carthage update|bootstrap
  3. Remove Carthage/Checkouts directory
  4. Missing required module 'Minizip'

@troupmar
Copy link
Author

troupmar commented May 12, 2021

I have recently tried to use the library again via SPM and still running into the same problem, unfortunately.

@acecilia
Copy link

acecilia commented May 25, 2021

In order to solve this it is possible to stop depending on the "custom" version of Minizip in this repository, and instead do one of the following options:

  • Create a proper dependency on the official Minizip link 1, link 2
  • Create a an extra podspec for the "custom" version of Minizip used in this repo

In any case, it means start treating Minizip as a fully fledge standalone dependency instead of using the current integration

@thangngoquocOura
Copy link

I got the issue when trying to build my app on CI env without the Carthage/Checkouts directory.

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