Detecting compiler ABI failed by CMAKE
The CMAKE is not able to access to file system with permission granted. Solution is to edit /etc/fstab accordingly.
Y.Z
Shanghai branch, China Securities Depository and Clearing Cooperation,Ltd.
Updated on June 04, 2022Comments
-
Y.Z 7 months
There is a CMake project simple enough but not compiling at all with Visual Studio Code. The source:
// main.cpp #include <iostream> int main(int argc, char * argv){ return 0; }
The CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.0) project(test VERSION 0.1.0) add_executable(test main.cpp)
CMake Tools in vscode build with errors in prompt as below:
[cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - failed [cmake] -- Check for working C compiler: /bin/gcc-9 [cmake] -- Check for working C compiler: /bin/gcc-9 - works [cmake] -- Detecting C compile features [cmake] -- Detecting C compile features - done [cmake] CMake Error at /usr/local/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:82 (configure_file): [cmake] configure_file Problem configuring file [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:2 (project) [cmake] [cmake] [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - failed [cmake] -- Check for working CXX compiler: /bin/g++-9 [cmake] -- Check for working CXX compiler: /bin/g++-9 - works [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] CMake Error at /usr/local/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:75 (configure_file): [cmake] configure_file Problem configuring file [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:2 (project)
The CMakeError.log:
Cannot copy output executable '/data/solution/projects/test/build/CMakeFiles/CMakeTmp/cmTC_efc0d' to destination specified by COPY_FILE: '/data/solution/projects/test/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_C.bin' Cannot copy output executable '/data/solution/projects/test/build/CMakeFiles/CMakeTmp/cmTC_26771' to destination specified by COPY_FILE: '/data/solution/projects/test/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_CXX.bin'
A selection of the CMakeOutput.log:
The system is: Linux - 5.4.0-52-generic - x86_64 Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: /bin/gcc-9 Build flags: Id flags: The output was: 0 Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" The C compiler identification is GNU, found in "/data/solution/projects/test/build/CMakeFiles/3.18.4/CompilerIdC/a.out" Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: /bin/g++-9 Build flags: Id flags: The output was: 0 Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" The CXX compiler identification is GNU, found in "/data/solution/projects/test/build/CMakeFiles/3.18.4/CompilerIdCXX/a.out" Determining if the C compiler works passed with the following output: Change Dir: /data/solution/projects/test/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_3f39e/fast && /usr/bin/make -f CMakeFiles/cmTC_3f39e.dir/build.make CMakeFiles/cmTC_3f39e.dir/build make[1]: Entering directory '/data/solution/projects/test/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o /bin/gcc-9 -o CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o -c /data/solution/projects/test/build/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_3f39e /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3f39e.dir/link.txt --verbose=1 /bin/gcc-9 -rdynamic CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o -o cmTC_3f39e make[1]: Leaving directory '/data/solution/projects/test/build/CMakeFiles/CMakeTmp'
The project doesn't build anymore when the OS was upgraded from 18.04 to 20.04 all in a sudden, with later version (9.3) of GCC toolchain. The
a.out
exists under CMAKE building directory, but there is no output executable ABI testing program to copy to anyway, as we can tell from the above logs. Is there anyone to help me finding the real cause? Thank you.
Solution: OK. There is an issue I could have noted, thanks to a comment. The project is under directory mounted to FAT32 file system where permission settings are tricky to configure. A correct /etc/fstab file:
UUID=3FCE-E5CB /data vfat rw,user,exec,utf8,uid=jack,gid=jack 0 0
-
tambre about 2 yearsDisk full? Lacking permissions? The error log is obvious enough – the copy is failing for some reason. Make sure to try fully cleaning the build directory, i.e.
rm -r build/* build/.*
-
Y.Z about 2 yearsIt is clean built. The project root is under vfat disk not aligned to Unix model in permission, but with umask=000.
-
-
Alfishe about 1 yearThank you so much for giving the idea what it might be. Modern macOS limitations and absence of proper error handling in CMake make triage a nightmare. So advice for macOS users - give appropriate (or even full disk access) to: terminal, cmake and your IDE (Eclipse, CLion, VSCode, etc.). That's how you can avoid such weird issues