Build break in GCC 8
xumia opened this issue · 2 comments
Build error:
/__w/1/SymCrypt/lib/rdseed.c: In function 'SymCryptRdseedSizet':
/__w/1/SymCrypt/lib/rdseed.c:22:28: warning: implicit declaration of function '_rdseed64_step'; did you mean '_rdseedxx_step'? [-Wimplicit-function-declaration]
#define _rdseedxx_step(_p) _rdseed64_step( (UINT64 *) (_p) )
^~~~~~~~~~~~~~
/__w/1/SymCrypt/lib/rdseed.c:40:7: note: in expansion of macro '_rdseedxx_step'
if( _rdseedxx_step( p ) != 0 )
^~~~~~~~~~~~~~
[ 98%] Built target symcryptunittest_lib
Scanning dependencies of target symcryptunittest
[ 99%] Building CXX object unittest/exe_linux/CMakeFiles/symcryptunittest.dir/main_exe.cpp.o
[ 99%] Linking CXX executable ../../exe/AMD64/LinuxUserMode/symcryptunittest
/usr/bin/ld: ../../lib/AMD64/LinuxUserMode/libsymcrypt_common.a(rdseed.c.o): in function `SymCryptRdseedSizet':
/__w/1/SymCrypt/lib/rdseed.c:40: undefined reference to `_rdseed64_step'
collect2: error: ld returned 1 exit status
make[2]: *** [unittest/exe_linux/CMakeFiles/symcryptunittest.dir/build.make:86: exe/AMD64/LinuxUserMode/symcryptunittest] Error 1
make[1]: *** [CMakeFiles/Makefile2:433: unittest/exe_linux/CMakeFiles/symcryptunittest.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
##[error]Bash exited with code '2'.
To reproduce it, only need to build it in debian:buster docker image.
Analysis:
Line 19 in b15ec2c
/usr/lib/gcc/x86_64-linux-gnu/8/include/rdseedintrin.h:# error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
/usr/lib/gcc/x86_64-linux-gnu/9/include/rdseedintrin.h:# error "Never use <rdseedintrin.h> directly; include <immintrin.h> instead."
For GCC <=8, need to change to include <x86intrin.h>
See gcc-mirror/gcc@59a9514
Workaround:
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/LinuxUserMode-AMD64.cmake -DCMAKE_C_FLAGS="-D_rdseed64_step=__builtin_ia32_rdseed_di_step"
Support request:
GCC 8 is used by debian:buster, which is the latest version of debian currently. Could you please help support it?
@xumia apologies for not replying to this earlier - support for Debian/older versions of GCC hasn't been a priority for us. It looks like the current stable version of Debian is now "bullseye." Is this change still needed?
@mlindgren , we have changed to use bullseye, not necessary to support the earlier version for us, thanks.