You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I went down a bit of a rabbit hole trying to get ik_llama.cpp properly configuring and compiling on my machine so I thought I'd document it here in case anyone else has similar issues.
Fedora 43
GCC 15.2.1
GLIBC 2.42-5
CUDA 12.9
Problem 1: Math Function Exception Specification Mismatch
Error Message
/usr/include/bits/mathcalls.h(83): error: exception specification is
incompatible with that of previous function "cospi" (declared at line 2601
of /usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h)
extern double cospi (double __x) noexcept (true); extern double __cospi (double __x) noexcept (true);
^
/usr/include/bits/mathcalls.h(85): error: exception specification is
incompatible with that of previous function "sinpi"
...
/usr/include/bits/mathcalls.h(206): error: exception specification is
incompatible with that of previous function "rsqrt"
...
6 errors detected in the compilation of "CMakeCUDACompilerId.cu".
Cause
glibc 2.41+ added C23 math functions (sinpi, cospi, rsqrt, etc.) with noexcept(true)
specifications. CUDA's headers declare these same functions without the exception
specification, causing a conflict.
Fix
Patch two CUDA header files to add exception specifications:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I went down a bit of a rabbit hole trying to get ik_llama.cpp properly configuring and compiling on my machine so I thought I'd document it here in case anyone else has similar issues.
Problem 1: Math Function Exception Specification Mismatch
Error Message
Cause
glibc 2.41+ added C23 math functions (sinpi, cospi, rsqrt, etc.) with
noexcept(true)specifications. CUDA's headers declare these same functions without the exception
specification, causing a conflict.
Fix
Patch two CUDA header files to add exception specifications:
File 1: /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.h
Backup first:
sudo cp /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.h \ /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.h.backupApply these changes (line numbers are approximate):
Or use sed:
File 2: /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.hpp
Backup first:
sudo cp /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.hpp \ /usr/local/cuda/targets/x86_64-linux/include/crt/math_functions.hpp.backupApply these changes:
Or use sed:
Problem 2: pthread_cond_t Initialiser Mismatch
Error Message
Cause
The CUDA-specific GCC 12 installation includes its own copy of pthread.h at:
/usr/lib64/gcc/x86_64-redhat-linux/12/include/pthread.hThis file contains an outdated
PTHREAD_COND_INITIALIZERmacro from an older glibcthat doesn't match the glibc 2.42
pthread_cond_tstructure.Old (wrong):
New (correct for glibc 2.42):
Fix
Update the
PTHREAD_COND_INITIALIZERin the GCC 12 pthread.h header:Verify the fix:
Script
This script (or something like it) should work:
References
Notes
Beta Was this translation helpful? Give feedback.
All reactions