open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.68k stars 416 forks source link

LibOQS CMake fails with cmake 3.28.3 #1748

Open wpj3799 opened 3 months ago

wpj3799 commented 3 months ago

CMake of liboqs fails on Kali Linux VM images and Kali Linux WSL

On a clean image I ran: 1) sudo apt install astyle cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind libgmp3-dev git libssl-dev 2) git clone https://github.com/open-quantum-safe/liboqs.git 3) cd liboqs 4) cmake -GNinja -DOQS_USE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr

It throws this error which I don't understand since it finds the library v3.1.5?: CMake Warning: No source or binary directory provided. Both will be assumed to be the same as the current working directory, but note that this warning will become a fatal error in future CMake releases.

-- The C compiler identification is GNU 13.2.0 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Performing Test CC_SUPPORTS_WA_NOEXECSTACK -- Performing Test CC_SUPPORTS_WA_NOEXECSTACK - Success -- Performing Test LD_SUPPORTS_WL_Z_NOEXECSTACK -- Performing Test LD_SUPPORTS_WL_Z_NOEXECSTACK - Success -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Alg enablement unchanged CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found suitable version "3.1.5", minimum required is "1.1.1") Call Stack (most recent call first): /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.28/Modules/FindOpenSSL.cmake:668 (find_package_handle_standard_args) CMakeLists.txt:135 (find_package)

Environment:

Not sure if this is a bug or a Kali issue but, any help would be appreciated.

SWilson4 commented 3 months ago

Thanks for the bug report!

This appears to be a regression in CMake. I reproduced your error in a kali-rolling image with CMake 3.28.3. Everything worked fine, however, with CMake 3.25.1.

It's probably worth bringing this to the attention of the CMake team. For now, the following command worked for me with CMake 3.28.3:

cmake -GNinja -DOQS_USE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr -DOPENSSL_ROOT_DIR=/usr/lib/x86_64-linux-gnu

Please let me know if that works for you.

wpj3799 commented 3 months ago

Yes, that seems to have worked. Thank you.

baentsch commented 2 months ago

The same problem occurs in Ubuntu 24. I'm afraid we need to provide a workaround in OQS if we want to support that LTS release.