CUDA is trying to compile g++14 library with g++-13
Description:
Trying to compile llama.cpp with CMAKE result in the CUDA compiler to use 14.2.1 C++ libraries instead of gcc13 one, which is incompatible with CUDA 12.5.1
Additional info:
- package version(s):
Name : cuda
Version : 12.5.1-1
Name : cuda-tools
Version : 12.5.1-1
Name : gcc
Version : 14.2.1+r32+geccf707e5ce-1
Name : glibc
Version : 2.40+r16+gaa533d58ff-2
Name : gcc13
Version : 13.3.0-1
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Jun__6_02:18:23_PDT_2024
Cuda compilation tools, release 12.5, V12.5.82
Build cuda_12.5.r12.5/compiler.34385749_0
- config and/or log files:
$ cmake -B build -DGGML_CUDA=ON -DCUDACXX=/usr/bin/g++-13 -DCUDAHOSTCXX=/usr/bin/g++-13 -DCMAKE_CUDA_ARCHITECTURES=all -D CMAKE_CUDA_COMPILER=$(which nvcc)
-- OpenMP found
-- Using llamafile
-- CUDA found
-- Using CUDA architectures: all
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:838 (message):
Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.
Compiler: /opt/cuda/bin/nvcc
Build flags:
Id flags: --keep;--keep-dir;tmp -v
The output was:
2
#$ _NVVM_BRANCH_=nvvm
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/opt/cuda/bin
#$ _THERE_=/opt/cuda/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/opt/cuda/bin/..
#$ CICC_PATH=/opt/cuda/bin/../nvvm/bin
#$ CICC_NEXT_PATH=/opt/cuda/bin/../nvvm-next/bin
#$ NVVMIR_LIBRARY_DIR=/opt/cuda/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/opt/cuda/bin/../lib:
#$
PATH=/opt/cuda/bin/../nvvm/bin:/opt/cuda/bin:/opt/cuda/bin:/usr/local/bin:/usr/bin:/usr/bin/site_perl
#$ INCLUDES="-I/opt/cuda/bin/../targets/x86_64-linux/include"
#$ LIBRARIES= "-L/opt/cuda/bin/../targets/x86_64-linux/lib/stubs"
"-L/opt/cuda/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ rm tmp/a_dlink.reg.c
#$ gcc -D__CUDA_ARCH_LIST__=520 -D__NV_LEGACY_LAUNCH -E -x c++ -D__CUDACC__
-D__NVCC__ "-I/opt/cuda/bin/../targets/x86_64-linux/include"
-D__CUDACC_VER_MAJOR__=12 -D__CUDACC_VER_MINOR__=5
-D__CUDACC_VER_BUILD__=82 -D__CUDA_API_VER_MAJOR__=12
-D__CUDA_API_VER_MINOR__=5 -D__NVCC_DIAG_PRAGMA_SUPPORT__=1 -include
"cuda_runtime.h" -m64 "CMakeCUDACompilerId.cu" -o
"tmp/CMakeCUDACompilerId.cpp4.ii"
#$ cudafe++ --c++17 --gnu_version=140201 --display_error_number
--orig_src_file_name "CMakeCUDACompilerId.cu" --orig_src_path_name
"/run/media/neko/Nezuko/ギット/workspace/llama.cpp/build/CMakeFiles/3.30.2/CompilerIdCUDA/CMakeCUDACo
--allow_managed --m64 --parse_templates --gen_c_file_name
"tmp/CMakeCUDACompilerId.cudafe1.cpp" --stub_file_name
"CMakeCUDACompilerId.cudafe1.stub.c" --gen_module_id_file
--module_id_file_name "tmp/CMakeCUDACompilerId.module_id"
"tmp/CMakeCUDACompilerId.cpp4.ii"
/usr/include/c++/14.2.1/x86_64-pc-linux-gnu/bits/c++config.h(827): error:
user-defined literal operator not found
typedef __decltype(0.0bf16) __bfloat16_t;
^
/usr/include/c++/14.2.1/type_traits(529): error: type name is not allowed
: public __bool_constant<__is_array(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(529): error: identifier "__is_array" is
undefined
: public __bool_constant<__is_array(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(581): error: type name is not allowed
: public __bool_constant<__is_member_object_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(581): error: identifier
"__is_member_object_pointer" is undefined
: public __bool_constant<__is_member_object_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(603): error: type name is not allowed
: public __bool_constant<__is_member_function_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(603): error: identifier
"__is_member_function_pointer" is undefined
: public __bool_constant<__is_member_function_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(695): error: type name is not allowed
: public __bool_constant<__is_reference(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(695): error: identifier
"__is_reference" is undefined
: public __bool_constant<__is_reference(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(731): error: type name is not allowed
: public __bool_constant<__is_object(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(731): error: identifier "__is_object"
is undefined
: public __bool_constant<__is_object(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(760): error: type name is not allowed
: public __bool_constant<__is_member_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(760): error: identifier
"__is_member_pointer" is undefined
: public __bool_constant<__is_member_pointer(_Tp)>
^
/usr/include/c++/14.2.1/type_traits(3247): error: type name is not allowed
inline constexpr bool is_array_v = __is_array(_Tp);
^
/usr/include/c++/14.2.1/type_traits(3271): error: type name is not allowed
__is_member_object_pointer(_Tp);
^
/usr/include/c++/14.2.1/type_traits(3281): error: type name is not allowed
__is_member_function_pointer(_Tp);
^
/usr/include/c++/14.2.1/type_traits(3298): error: type name is not allowed
inline constexpr bool is_reference_v = __is_reference(_Tp);
^
/usr/include/c++/14.2.1/type_traits(3315): error: type name is not allowed
inline constexpr bool is_object_v = __is_object(_Tp);
^
/usr/include/c++/14.2.1/type_traits(3328): error: type name is not allowed
inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
^
/usr/include/c++/14.2.1/bits/utility.h(237): error: __type_pack_element is
not a template
{ using type = __type_pack_element<_Np, _Types...>; };
^
20 errors detected in the compilation of "CMakeCUDACompilerId.cu".
# --error 0x2 --
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
/usr/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
ggml/src/CMakeLists.txt:296 (enable_language)
-- Configuring incomplete, errors occurred!
- link to upstream bug report, if any:
User Report on Nvidia forum here: https://forums.developer.nvidia.com/t/cuda-12-4-nvcc-and-gcc-14-1-incompatibility/293295
Steps to reproduce:
# pacman -S cuda cuda-tools gcc13
$ git clone https://github.com/ggerganov/llama.cpp && cd llama.cpp
$ export PATH=/opt/cuda/bin:$PATH
$ cmake -B build -DGGML_CUDA=ON -DCUDACXX=/usr/bin/g++-13 -DCUDAHOSTCXX=/usr/bin/g++-13 -DCMAKE_CUDA_ARCHITECTURES=all -D CMAKE_CUDA_COMPILER=$(which nvcc)