Zip icon indicating copy to clipboard operation
Zip copied to clipboard

Missing required module 'minizip'

Open troupmar opened this issue 6 years ago • 25 comments

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.

troupmar avatar Apr 05 '18 18:04 troupmar

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

letko-dmitry avatar Apr 14 '18 09:04 letko-dmitry

This should be fixed with #119.

AvdLee avatar Jun 15 '18 12:06 AvdLee

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.

troupmar avatar Jun 19 '18 09:06 troupmar

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

MarcSteven avatar Aug 22 '18 04:08 MarcSteven

@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 ...

MarcSteven avatar Aug 22 '18 04:08 MarcSteven

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 avatar Aug 27 '18 09:08 AvdLee

@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 .

MarcSteven avatar Aug 29 '18 01:08 MarcSteven

We have encountered the same issue. Could it be related to https://github.com/Carthage/Carthage/issues/1903?

balland avatar Oct 04 '18 14:10 balland

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...

kenji21 avatar Nov 15 '18 15:11 kenji21

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.

PierreMardon avatar Nov 23 '18 14:11 PierreMardon

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.

AlexIzh avatar Nov 30 '18 11:11 AlexIzh

@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!

patryk-sredzinski avatar Feb 12 '19 15:02 patryk-sredzinski

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.

adaslesniak avatar Apr 28 '19 12:04 adaslesniak

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.

ravitripathi avatar Sep 08 '19 16:09 ravitripathi

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

MarcoFilosi avatar May 04 '20 20:05 MarcoFilosi

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

marmelroy avatar Sep 26 '20 13:09 marmelroy

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

ravitripathi avatar Sep 26 '20 16:09 ravitripathi

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

ravitripathi avatar Sep 26 '20 17:09 ravitripathi

@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

MarcoFilosi avatar Oct 01 '20 06:10 MarcoFilosi

Has anyone solved this for Swift Package Manager?

wvdk avatar Nov 03 '20 23:11 wvdk

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

mdroz avatar Feb 24 '21 19:02 mdroz

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'

barbasevich avatar May 10 '21 09:05 barbasevich

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

troupmar avatar May 12 '21 08:05 troupmar

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

acecilia avatar May 25 '21 17:05 acecilia

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

thangngoquocOura avatar Jul 02 '21 10:07 thangngoquocOura