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

#include <zlib.h> in libsrc/InputFile.h throwing compilation error & possible solution #31

Open
pjawinski opened this issue Mar 18, 2023 · 2 comments

Comments

@pjawinski
Copy link

pjawinski commented Mar 18, 2023

Hi there,

for some reason, METAL didn't compile successfully on our linux cluster (although it did on another linux cluster and on my own mac), throwing the following error:

[ 80%] Building CXX object libsrc/CMakeFiles/goncalo.dir/StringArray.cpp.o                                                                                                                                                                                                                
[ 82%] Building CXX object libsrc/CMakeFiles/goncalo.dir/StringBasics.cpp.o                                                                                                                                                                                                               
[ 84%] Building CXX object libsrc/CMakeFiles/goncalo.dir/StringHash.cpp.o                                                                                                                                                                                                                 
[ 86%] Building CXX object libsrc/CMakeFiles/goncalo.dir/StringMap.cpp.o                                                                                                                                                                                                                  
[ 89%] Building CXX object libsrc/CMakeFiles/goncalo.dir/TraitTransformations.cpp.o                                                                                                                                                                                                       
[ 91%] Linking CXX static library libgoncalo.a                                                                                                                                                                                                                                            
make[2]: Leaving directory '/fast/software/METAL/build'                                                                                                                                                                                                                                   
[ 91%] Built target goncalo                                                                                                                                                                                                                                                               
make[2]: Entering directory '/fast/software/METAL/build'                                                                                                                                                                                                                                  
Scanning dependencies of target metal                                                                                                                                                                                                                                                     
make[2]: Leaving directory '/fast/software/METAL/build'                                                                                                                                                                                                                                   
make[2]: Entering directory '/fast/software/METAL/build'                                                                                                                                                                                                                                  
[ 93%] Building CXX object metal/CMakeFiles/metal.dir/Main.cpp.o                                                                                                                                                                                                                          
In file included from /fast/software/METAL/metal/Main.h:25,                                                                                                                                                                                                                               
                 from /fast/software/METAL/metal/Main.cpp:18:                                                                                                                                                                                                                             
/fast/software/METAL/libsrc/InputFile.h:31:10: fatal error: zlib.h: No such file or directory                                                                                                                                                                                             
   31 | #include <zlib.h>                                                                                                                                                                                                                                                                 
      |          ^~~~~~~~                                                                                                                                                                                                                                                                 
compilation terminated.                                                                                                                                                                                                                                                                   
make[2]: *** [metal/CMakeFiles/metal.dir/build.make:63: metal/CMakeFiles/metal.dir/Main.cpp.o] Error 1                                                                                                                                                                                    
make[2]: Leaving directory '/fast/software/METAL/build'                                                                                                                                                                                                                                   
make[1]: *** [CMakeFiles/Makefile2:146: metal/CMakeFiles/metal.dir/all] Error 2                                                                                                                                                                                                           
make[1]: Leaving directory '/fast/software/METAL/build'                                                                                                                                                                                                                                   
make: *** [Makefile:141: all] Error 2  

I've been using a conda environment, but received the same error without conda. In advance, cmake -DCMAKE_BUILD_TYPE=Release .. showed the correct ZLIB header directory and ZLIB library path (within the conda environment). Moreover, all build files written to ../build contained correct references to zlib.h in the activated conda environment. Still, #include <zlib.h> in libsrc/InputFile.h produced an error.

In my case, I solved this problem by manually changing #include <zlib.h> in line 31 of libsrc/InputFile.h to #include </path/to/my/conda/environment/include/zlib.h>. Hope this helps someone else who's experiencing the same issue. Maybe there's a more elegant solution or anything you can do to prevent this error.

Best wishes,
Philippe

@jonathonl
Copy link

Try adding include_directories(${ZLIB_INCLUDE_DIR}) to line 14 of CMakeLists.txt (https://github.com/statgen/METAL/blob/master/CMakeLists.txt#L14).

@pjawinski
Copy link
Author

Many thanks, that also worked out!

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

2 participants