-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
Describe the bug
CHECK_FUNCTION_EXISTS(strtof) fails to compile, even though strtof is provided by C library.
(also strtod and strtold). The failure is caused by an invalid test invocation, not by the absence of strtof.
The test program that calls the function with no arguments which is incompatible with strtof.
From build/CMakeFiles/CMakeConfigureLog.yaml:
Run Build Command(s): /sw/frontier/spack-envs/core-25.03/opt/gcc-13.2/cmake-4.1.0-7wlh5k2uuohbqd45l7elkdxdyw7h3tu5/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_6cea2/fast
/usr/bin/gmake -f CMakeFiles/cmTC_6cea2.dir/build.make CMakeFiles/cmTC_6cea2.dir/build
gmake[1]: Entering directory '/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE'
Building C object CMakeFiles/cmTC_6cea2.dir/CheckFunctionExists.c.o
/opt/cray/pe/craype/2.7.35/bin/cc -DcmTC_6cea2_EXPORTS -fopenmp=libomp -w -DCHECK_FUNCTION_EXISTS=strtof -O3 -DNDEBUG -fPIE -MD -MT CMakeFiles/cmTC_6cea2.dir/CheckFunctionExists.c.o -MF CMakeFiles/cmTC_6cea2.dir/CheckFunctionExists.c.o.d -o CMakeFiles/cmTC_6cea2.dir/CheckFunctionExists.c.o -c /lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE/CheckFunctionExists.c
/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE/CheckFunctionExists.c:7:3: error: conflicting types for 'strtof'
7 | CHECK_FUNCTION_EXISTS(void);
| ^
<command line>:5:31: note: expanded from macro 'CHECK_FUNCTION_EXISTS'
5 | #define CHECK_FUNCTION_EXISTS strtof
| ^
/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE/CheckFunctionExists.c:7:3: note: previous implicit declaration is here
<command line>:5:31: note: expanded from macro 'CHECK_FUNCTION_EXISTS'
5 | #define CHECK_FUNCTION_EXISTS strtof
| ^
/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE/CheckFunctionExists.c:17:25: error: too few arguments to function call, expected 2, have 0
17 | CHECK_FUNCTION_EXISTS();
| ~~~~~~~~~~~~~~~~~~~~~ ^
/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE/CheckFunctionExists.c:7:3: note: 'strtof' declared here
7 | CHECK_FUNCTION_EXISTS(void);
| ^
<command line>:5:31: note: expanded from macro 'CHECK_FUNCTION_EXISTS'
5 | #define CHECK_FUNCTION_EXISTS strtof
| ^
2 errors generated.
gmake[1]: *** [CMakeFiles/cmTC_6cea2.dir/build.make:82: CMakeFiles/cmTC_6cea2.dir/CheckFunctionExists.c.o] Error 1
gmake[1]: Leaving directory '/lustre/orion/nfu106/proj-shared/ylan/src/nekrs_stefan_v25_next010726_rocm7/build/CMakeFiles/CMakeScratch/TryCompile-IjXQtE'
gmake: *** [Makefile:134: cmTC_6cea2/fast] Error 2
Because the check fails, HAVE_STRTOF is unset / false. The code assumes strtof is unavailable.
A fallback strtof implementation is compiled (adios/thirdparty/ffs/ffs/fm/string_conversion.c ). This causes symbol conflicts or duplicate definitions against libc.
Platform: HPE Cray EX (Frontier)
Compiler: AMD clang (via Cray cc)
CMake: 4.1.0
/opt/rocm-7.0.2/lib/llvm/bin/clang --version
AMD clang version 20.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-7.0.2 25385 0dda3adf56766e0aac0d03173ced3759e1ffecbc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-7.0.2/lib/llvm/bin
Configuration file: /opt/rocm-7.0.2/lib/llvm/bin/clang.cfg
Metadata
Metadata
Assignees
Labels
No labels