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

zlib.h file not found #278

Closed
fboemer opened this issue Feb 12, 2021 · 2 comments
Closed

zlib.h file not found #278

fboemer opened this issue Feb 12, 2021 · 2 comments

Comments

@fboemer
Copy link
Contributor

fboemer commented Feb 12, 2021

I'm trying to compile SEAL v3.6.1 with the below option:

cmake .. -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_C_COMPILER=clang-10 -DCMAKE_INSTALL_PREFIX=../ -DBUILD_SHARED_LIBS=ON -DSEAL_BUILD_TESTS=ON

with cmake version 3.16.3 on Ubuntu 20.04 without zlib already installed.

make VERBOSE=1 yields the below error message:

[ 39%] Building CXX object CMakeFiles/seal_shared.dir/native/src/seal/util/ztools.cpp.o
/usr/bin/clang++-10  -Dseal_shared_EXPORTS -I/home/fboemer/repos/SEAL/native/src -I/home/fboemer/repos/SEAL/build/native/src -I/home/fboemer/repos/SEAL/thirdparty/msgsl-src/include -I/home/fboemer/repos/SEAL/thirdparty/zstd-src/lib -I/home/fboemer/repos/SEAL/thirdparty/zstd-src/lib/common  -O3 -DNDEBUG -fPIC   -pthread -std=gnu++17 -o CMakeFiles/seal_shared.dir/native/src/seal/util/ztools.cpp.o -c /home/fboemer/repos/SEAL/native/src/seal/util/ztools.cpp
/home/fboemer/repos/SEAL/native/src/seal/util/ztools.cpp:63:10: fatal error: 'zlib.h' file not found
#include "zlib.h"
         ^~~~~~~~

Notably, the include paths don't include /home/fboemer/repos/SEAL/thirdparty/zlib-src, which has zlib.h.

During the cmake command, I see

-- ZLIB: download ...
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     /home/fboemer/repos/SEAL/thirdparty/zlib-src/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Zstandard: download ...
-- ZSTD VERSION: 1.4.5

Installing zlib via sudo apt-get install libz-dev fixes the issue.

If I understand correctly, on systems without zlib installed SEAL should automatically download zlib and find zlib.h. If I'm mistaken, and zlib is required on the system, feel free to close the issue.

@WeiDaiWD
Copy link
Contributor

Thanks, Fabian, this is a bug and right on time. It is fixed in the next release. Meanwhile, adding the following commands right after this line will fix this for you.

target_include_directories(seal_shared PRIVATE $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>)
target_include_directories(seal_shared PRIVATE $<BUILD_INTERFACE:$<TARGET_PROPERTY:${zlib},BINARY_DIR>>)

@fboemer
Copy link
Contributor Author

fboemer commented Feb 12, 2021

Thanks!

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