Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22213

Issues with setting compiler as g++-11/14 at CLion at macos. "Test Cmake run finished with error "

$
0
0

I want my Clion in MacOS compile with the g++-11 instead of Clang. When I set up the toolchain, it did not pass the test. Clion gives "Test Cmake run finished with error". This is the screen shotscreen shot

And I can click "more" to check the errors.

-- The C compiler identification is unknown-- The CXX compiler identification is unknown-- Detecting C compiler ABI info-- Detecting C compiler ABI info - failed-- Check for working C compiler: /usr/local/bin/gcc-11-- Check for working C compiler: /usr/local/bin/gcc-11 - brokenCMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/x64/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):  The C compiler"/usr/local/bin/gcc-11"  is not able to compile a simple test program.  It fails with the following output:    Change Dir: '/private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment1/_build7996487480848918631/CMakeFiles/CMakeScratch/TryCompile-Fl9cKx'    Run Build Command(s): /Applications/CLion.app/Contents/bin/ninja/mac/x64/ninja -v cmTC_8f62f    [1/2] /usr/local/bin/gcc-11    -o CMakeFiles/cmTC_8f62f.dir/testCCompiler.c.o -c /private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment1/_build7996487480848918631/CMakeFiles/CMakeScratch/TryCompile-Fl9cKx/testCCompiler.c    FAILED: CMakeFiles/cmTC_8f62f.dir/testCCompiler.c.o     /usr/local/bin/gcc-11    -o CMakeFiles/cmTC_8f62f.dir/testCCompiler.c.o -c /private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment1/_build7996487480848918631/CMakeFiles/CMakeScratch/TryCompile-Fl9cKx/testCCompiler.c    clang (LLVM option parsing): Unknown command line argument '-x86-pad-for-align=false'.  Try: 'clang (LLVM option parsing) --help'    clang (LLVM option parsing): Did you mean '--x86-slh-loads=false'?    ninja: build stopped: subcommand failed.  CMake will not be able to correctly generate this project.Call Stack (most recent call first):  CMakeLists.txt:2 (project)-- Configuring incomplete, errors occurred!Error code: 1

It looks like the test ran with some clang parameters?

ChatGPT suggested that it might be the problem with environment variable path, but it looks fine to me. Here is the output from command lines about PATH:

(base) myname@mynames-MacBook-Pro bin % which gcc/usr/bin/gcc(base) myname@mynames-MacBook-Pro bin % which gcc-11/usr/local/bin/gcc-11(base) myname@mynames-MacBook-Pro bin % which gcc-14/usr/local/bin/gcc-14(base) myname@mynames-MacBook-Pro bin % echo $PATH/Users/myname/anaconda3/bin:/Users/myname/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myname/Library/Python/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin

Here is the gcc version info at my mac. Some answers suggested that gcc-11 is just an alias of clang. But according to version info, it looks like gcc-11 and gcc-14 are surely the version installed by homebrew? Sorry I am a c++ beginner and not 100% sure about this.

(base) myname@myname-MacBook-Pro bin % gcc --versionConfigured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1Apple clang version 12.0.0 (clang-1200.0.32.21)Target: x86_64-apple-darwin23.4.0Thread model: posixInstalledDir: /Library/Developer/CommandLineTools/usr/bin(base) myname@myname-MacBook-Pro bin % gcc-11 --versiongcc-11 (Homebrew GCC 11.4.0) 11.4.0Copyright (C) 2021 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.(base) myname@myname-MacBook-Pro bin % gcc-14 --versiongcc-14 (Homebrew GCC 14.2.0) 14.2.0Copyright (C) 2024 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

An answer suggested that Uninstall gcc-11 brew remove gcc-11 and use gcc-14. I brew remove gcc@11 and set gcc-14 at Clion.here is the new screen shot.screen shot, gcc-14]2 The error log is basically the same:

-- The C compiler identification is unknown-- The CXX compiler identification is unknown-- Detecting C compiler ABI info-- Detecting C compiler ABI info - failed-- Check for working C compiler: /usr/local/bin/gcc-14-- Check for working C compiler: /usr/local/bin/gcc-14 - brokenCMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/x64/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):  The C compiler"/usr/local/bin/gcc-14"  is not able to compile a simple test program.  It fails with the following output:    Change Dir: '/private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment/_build4029476531814106616/CMakeFiles/CMakeScratch/TryCompile-1D8OsD'    Run Build Command(s): /Applications/CLion.app/Contents/bin/ninja/mac/x64/ninja -v cmTC_77a76    [1/2] /usr/local/bin/gcc-14    -o CMakeFiles/cmTC_77a76.dir/testCCompiler.c.o -c /private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment/_build4029476531814106616/CMakeFiles/CMakeScratch/TryCompile-1D8OsD/testCCompiler.c    FAILED: CMakeFiles/cmTC_77a76.dir/testCCompiler.c.o     /usr/local/bin/gcc-14    -o CMakeFiles/cmTC_77a76.dir/testCCompiler.c.o -c /private/var/folders/lf/x7t4ln495yx9rlng8jr8yk580000gn/T/cmake_check_environment/_build4029476531814106616/CMakeFiles/CMakeScratch/TryCompile-1D8OsD/testCCompiler.c    clang (LLVM option parsing): Unknown command line argument '-x86-pad-for-align=false'.  Try: 'clang (LLVM option parsing) --help'    clang (LLVM option parsing): Did you mean '--x86-slh-loads=false'?    ninja: build stopped: subcommand failed.  CMake will not be able to correctly generate this project.Call Stack (most recent call first):  CMakeLists.txt:2 (project)-- Configuring incomplete, errors occurred!Error code: 1

After several editing, this question is tedious to understand now. I asked a new question here: Cannot set compiler as g++-14 at CLion at macos. "Test Cmake run finished with error "


Viewing all articles
Browse latest Browse all 22213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>