open-quantum-safe / liboqs

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

Compile error on Ubuntu22.04 #1911

Closed xianglingzhang closed 2 months ago

xianglingzhang commented 2 months ago

Hi, I try to build liboqs on Ubuntu22.04

$ cmake -GNinja -DOQS_USE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr -DOPENSSL_ROOT_DIR=/usr/local/ssl/lib/ ..
-- The C compiler identification is GNU 11.4.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
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Alg enablement unchanged
-- Found OpenSSL: /usr/local/ssl/lib/libcrypto.so (found suitable version "3.0.2", minimum required is "1.1.1")  
-- Looking for aligned_alloc
-- Looking for aligned_alloc - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for memalign
-- Looking for memalign - found
-- Looking for explicit_bzero
-- Looking for explicit_bzero - found
-- Looking for memset_s
-- Looking for memset_s - not found
-- Found Doxygen: /usr/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/build
$ ninja
[1360/1399] Building C object tests/CMakeFiles/test_aes.dir/test_aes.c.o
FAILED: tests/CMakeFiles/test_aes.dir/test_aes.c.o 
/usr/bin/cc -DOQS_COMPILE_GIT_COMMIT="\"9c8db18ec164492c352fe5748a8badc9f4ce3156 (+ local modifications)\"" -DOQS_COMPILE_OPTIONS="\"[-Wa,--noexecstack;-Wstrict-overflow;-ggdb3;-Wbad-function-cast]\"" -I/home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/build/include -I/home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/src -fPIE -fvisibility=hidden -Wa,--noexecstack -Wstrict-overflow -ggdb3 -Wbad-function-cast -std=gnu11 -MD -MT tests/CMakeFiles/test_aes.dir/test_aes.c.o -MF tests/CMakeFiles/test_aes.dir/test_aes.c.o.d -o tests/CMakeFiles/test_aes.dir/test_aes.c.o -c /home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/tests/test_aes.c
In file included from /home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/tests/test_aes.c:17:
/home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/tests/system_info.c: In function ‘print_oqs_configuration’:
/home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/tests/system_info.c:279:9: error: unknown type name ‘guard’
  279 |         guard against impossible configuration (no CMAKE_BUILD_TYPE but DEBUG_BUILD)
      |         ^~~~~
/home/zhang/Downloads/quantumsafe/KEMTLS/liboqs/tests/system_info.c:279:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘impossible’
  279 |         guard against impossible configuration (no CMAKE_BUILD_TYPE but DEBUG_BUILD)
      |                       ^~~~~~~~~~
[1362/1399] Building C object src/sig/sphincs/CMakeFiles/sphincs_shake_256s_simple_avx2.dir/pqclean_sphincs-shake-256s-simple_avx2/wots.c.o
ninja: build stopped: subcommand failed.

I get this error.

SWilson4 commented 2 months ago

Hi @xianglingzhang, that build error should arise when the OQS_DEBUG_BUILD variable is set and CMAKE_BUILD_TYPE is not: see https://github.com/open-quantum-safe/liboqs/blob/9c8db18ec164492c352fe5748a8badc9f4ce3156/tests/system_info.c#L279

Are you by any chance setting the OQS_DEBUG_BUILD variable anywhere?

I also see from the logs that you have local modifications. If you could provide more information about your system and liboqs setup, I can try to duplicate the issue.

dstebila commented 2 months ago

Closing issue due to lack of response. Feel free to re-open if following up.