rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.34k stars 301 forks source link

Undefined symbols for architecture x86_64 #70

Closed sb-git-cloud closed 3 years ago

sb-git-cloud commented 3 years ago

Hi I am trying to install CNPY by following the instructions, but always get the following error after "make":

[ 20%] Linking CXX shared library libcnpy.dylib Undefined symbols for architecture x86_64: "_inflate", referenced from: load_the_npz_array(sFILE*, unsigned int, unsigned int) in cnpy.cpp.o "_inflateEnd", referenced from: load_the_npz_array(sFILE, unsigned int, unsigned int) in cnpy.cpp.o "inflateInit2", referenced from: load_the_npz_array(__sFILE, unsigned int, unsigned int) in cnpy.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [libcnpy.dylib] Error 1 make[1]: [CMakeFiles/cnpy.dir/all] Error 2 make: *** [all] Error 2

I am not experienced and thought that it might have something to do with Zlib which I installed via homebrew, but it didn't solve the issue. I am using Mac OS 10.15.6. Does anyone have a hint for the installation? I would highly appreciate any help. Thanks so much.

symisc commented 3 years ago

You must link it with the zlib library.

sb-git-cloud commented 3 years ago

Thanks! It was an error caused by adding cnpy as a shared instead of static library