HareInWeed / gec

elliptic curve cryptography with GPU acceleration
MIT License
16 stars 4 forks source link

identifier "__builtin_ia32_serialize" is undefined #2

Open knm6828 opened 1 year ago

knm6828 commented 1 year ago

(https://stackoverflow.com/questions/76504758/compiler-error-saying-identifier-builtin-ia32-serialize-is-undefined-while)

ivanstepanovftw commented 3 months ago

Same for me:

[1/8] Building CUDA object libs/gec/CMakeFiles/sm2.dir/src/sm2.cpp.o
FAILED: libs/gec/CMakeFiles/sm2.dir/src/sm2.cpp.o 
/usr/bin/nvcc -forward-unknown-to-host-compiler -DGEC_ENABLE_CUDA -I/root/vanity-generator.cpp/libs/gec/./include  -MD -MT libs/gec/CMakeFiles/sm2.dir/src/sm2.cpp.o -MF libs/gec/CMakeFiles/sm2.dir/src/sm2.cpp.o.d -x cu -dc /root/vanity-generator.cpp/libs/gec/src/sm2.cpp -o libs/gec/CMakeFiles/sm2.dir/src/sm2.cpp.o
/usr/lib/gcc/x86_64-linux-gnu/11/include/serializeintrin.h(41): error: identifier "__builtin_ia32_serialize" is undefined

@HareInWeed, do you know possible solutions?

ivanstepanovftw commented 3 months ago
# uname -a
Linux PC 6.5.0-41-generic #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun  3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 
ivanstepanovftw commented 3 months ago

When I try to specify compilers:

set(CMAKE_CXX_COMPILER /usr/bin/g++)
set(CMAKE_CUDA_COMPILER /usr/bin/nvcc)

Configuration loops infinitely with message:

You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /usr/bin/c++

Probably it is because of CMake, because with simple

set(GEC_HOME ${CMAKE_SOURCE_DIR}/libs/gec)
set(GEC_INCLUDE_DIR ${GEC_HOME}/include)
set(GEC_SOURCE_DIR ${GEC_HOME}/src)
file(GLOB GEC_SOURCES "${GEC_SOURCE_DIR}/*.cpp")
add_library(gec STATIC
        ${GEC_SOURCES}
)
target_include_directories(gec PUBLIC
        ${GEC_INCLUDE_DIR}
)

it works without looping.

ivanstepanovftw commented 3 months ago

Someone said this is GCC bug https://github.com/Qiskit/qiskit-aer/issues/1874#issuecomment-1679858893

ivanstepanovftw commented 3 months ago

Solved by updating to GCC 12 and CUDA Toolkit 12.5 and

set(CMAKE_CXX_COMPILER /usr/bin/g++-12)
set(CMAKE_CUDA_COMPILER /usr/local/cuda-12.5/bin/nvcc)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -ccbin /usr/bin/g++-12")