brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
417 stars 112 forks source link

macOS fatal error: 'minizip/unzip.h' file not found #66

Closed mohammad-akhlaghi closed 4 years ago

mohammad-akhlaghi commented 4 years ago

While building XLSX I/O from source on a macOS in a custom directory, we see the following error:

[ 22%] Building C object
CMakeFiles/xlsxio_read_STATIC.dir/lib/xlsxio_read.c.o
/install/path/bin/clang -DBUILD_XLSXIO -DUSE_MINIZIP -I/build-tmp/xlsxio-0.2.21/include -I/install/path/include -I/build-tmp/xlsxio-0.2.21/lib -o CMakeFiles/xlsxio_read_STATIC.dir/lib/xlsxio_read.c.o   -c/build-tmp/xlsxio-0.2.21/lib/xlsxio_read.c
/build-tmp/xlsxio-0.2.21/lib/xlsxio_read.c:11:12:
fatal error: 'minizip/unzip.h' file not found
#  include <minizip/unzip.h>
           ^~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [CMakeFiles/xlsxio_read_STATIC.dir/build.make;66:
CMakeFiles/xlsxio_read_STATIC.dir/lib/xlsxio_read.c.o] Error 1

The XLSX I/O tarball was unpacked in /build-tmp/xlsxio-0.2.21 and Minizip's version is 2.9.2. Before XLSX I/O, Minizip was also configured to build in (for-demo-named) /install/path and its libminizip.a file is present under /install/path/lib and we had no special error when building Minizip. However, there is no /install/path/include/minizip directory, causing this error.

Do we have to build Minizip with a special configuration to be able to build XLSX I/O with it? Generally, do you have any thoughts about this error? If you need any supplementary information, please let me know. Thank you very much for the great work ;-).

brechtsanders commented 4 years ago

Can you try to add the CMake argument -DMINIZIP_DIR:PATH=<minizip_install_dir> where <minizip_install_dir>is the location where you installed minizip (= which contains the lib and include folders)?

brechtsanders commented 4 years ago

Sorry just noticed now you're using minizip 2. Currently only minizip 1 is supported. Maybe you should try with libzip?

mohammad-akhlaghi commented 4 years ago

Thanks, we actually build minizip from source also and so far only XLSX I/O needs it. So since you had recommended to use Minizip in the README file, I'll try with version 1.01 and update you. Thanks for the very prompt answer :-).

mohammad-akhlaghi commented 4 years ago

This indeed fixed the problem, it was just a little hard to figure out how to install Minizip (ultimately, ArchLinux's package manager script style was used)! But they both now build cleanly from source in our system. Thanks again for the prompt help.