NTAP / quant

QUIC implementation for POSIX and IoT platforms
BSD 2-Clause "Simplified" License
289 stars 35 forks source link

Build fails on CentOS 7.6 #44

Closed amitgeron closed 5 years ago

amitgeron commented 5 years ago

Hi,

Trying to build on my machine (CentOS Linux release 7.6.1810 (Core)) fails:

[amit@localhost Debug]$ cmake ../
-- Checking for module 'libbrotlidec'
--   No package 'libbrotlidec' found
-- Checking for module 'libbrotlienc'
--   No package 'libbrotlienc' found
CMake Warning at lib/deps/picotls/CMakeLists.txt:50 (MESSAGE):
  Enabling OpenSSL support

-- picotls/include: /home/amit/quant/lib/deps/picotls/include
-- picotls libraries: /home/amit/quant/Debug/lib/deps/picotls/libpicotls-core.a;/home/amit/quant/Debug/lib/deps/picotls/libpicotls-minicrypto.a;/home/amit/quant/Debug/lib/deps/picotls/libpicotls-openssl.a
-- root: /usr
-- OpenSSL_VERSION: 1.0.2k
-- OpenSSL_INCLUDE_DIR: /usr/include
-- OpenSSL_LIBRARIES: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/amit/quant/Debug
[amit@localhost Debug]$ make
[ 13%] Built target picoquic-core
[ 15%] Building C object lib/deps/warpcore/lib/CMakeFiles/obj_all.dir/src/plat.c.o
In file included from /usr/include/ifaddrs.h:22:0,
                 from /home/amit/quant/lib/deps/warpcore/lib/src/plat.c:39:
/usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
cc1: error: unrecognized command line option "-Wno-extra-semi-stmt" [-Werror]
cc1: error: unrecognized command line option "-Wno-disabled-macro-expansion" [-Werror]
cc1: all warnings being treated as errors
make[2]: *** [lib/deps/warpcore/lib/CMakeFiles/obj_all.dir/src/plat.c.o] Error 1
make[1]: *** [lib/deps/warpcore/lib/CMakeFiles/obj_all.dir/all] Error 2
make: *** [all] Error 2

Any suggestions? Thanks

larseggert commented 5 years ago

You could try commenting out this line: https://github.com/NTAP/quant/blob/master/CMakeLists.txt#L110

If you felt like it, send me a PR that does this programmatically, e.g., based on https://stackoverflow.com/questions/26919334/detect-underlying-platform-flavour-in-cmake? I don't have easy access to a CentOS system.

amitgeron commented 5 years ago

Thanks for your response!

I suspect that the issue was with GCC, being an old version (4.8.5) on CentOS 7. I built a new GCC from sources (9.1.0), but now I get a different error: /home/amit/quant/lib/src/tls.c:1305:35: error: ‘ptls_openssl_x25519’ undeclared (first use in this function); did you mean ‘ptls_openssl_bfecb’?

Meanwhile, I'm installing Ubuntu 18.04.

Attaching the full build log: build.log

larseggert commented 5 years ago

You need a modern openssl with x25519 support. 1.1+ I think.

amitgeron commented 5 years ago

True. I built and installed version 1.1.0k, and now all is good.

My cmake command: cmake -DOPENSSL_INCLUDE_DIR=/usr/local/include -DOPENSSL_SSL_LIBRARY=/usr/local/lib64/libssl.so -DOPENSSL_CRYPTO_LIBRARY=/usr/local/lib64/libcrypto.so ..

Do you think that version checks for GCC and OpenSSL should be added? (Actually there's a test for OpenSSL version at https://github.com/h2o/picotls/blob/c3f6afd481a748f3de876dc86bc03dc0dbe5cb5d/CMakeLists.txt#L49)

larseggert commented 5 years ago

I think that would be useful - feel free to submit a PR?

amitgeron commented 5 years ago

For OpenSSL I know the exact version (1.1.0), but for GCC I don't. I will submit a patch for OpenSSL.