C compiler can not be changed any more.

Answered

I'm running CLion 2020.2.4 on a MBP with macOS Catalina 10.15.7. I had already installed Anaconda 1.9.12 beforehand.
Following the instructions HERE, where I was guided to install the Xcode command line developer tools using 

xcode-select --install

After installing this package I opened CLion. Then the Preferences window appeared automatically. It quickly found the C compiler from the Anaconda environment. In order to change them I filled in the paths for C and C++ compiler respectively as visible in the screenshot below. However, an error appears. It cannot compile the test program. Although I set a different path, the full error message reads as if it went to the anaconda path instead. But the compiler paths visible in the Preferences are still those from the xcode-select package. The error persisted after re-typing the path; and even after re-installing xcode-select and CLion it happened again.

I installed CLion on my old iMac (where the same version of Anaconda is installed) with the same procedure. And it somehow worked there from the beginning as CLion automatically found the compiler from the Xcode command line developer tools.

I don't know any further. What causes this problem?
Thanks in advance. Let me know if you need any more info. I am still new to programming.

 

Screenshot of the issue:

 

Full CMake Error Message from screenshot above:

-- The C compiler identification is Clang 4.0.1
-- The CXX compiler identification is Clang 4.0.1
-- Check for working C compiler: /opt/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
-- Check for working C compiler: /opt/anaconda3/bin/x86_64-apple-darwin13.4.0-clang - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /private/var/folders/cf/khjk667d5qxc6ppdf78wh80h0000gn/T/cmake_check_environment/_build8201886344149806748/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_7ca78/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_7ca78.dir/build.make CMakeFiles/cmTC_7ca78.dir/build
Building C object CMakeFiles/cmTC_7ca78.dir/testCCompiler.c.o
/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_7ca78.dir/testCCompiler.c.o -c /private/var/folders/cf/khjk667d5qxc6ppdf78wh80h0000gn/T/cmake_check_environment/_build8201886344149806748/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_7ca78
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7ca78.dir/link.txt --verbose=1
/opt/anaconda3/bin/x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs CMakeFiles/cmTC_7ca78.dir/testCCompiler.c.o -o cmTC_7ca78
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x0A 0x74 0x62 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_7ca78] Error 1
make: *** [cmTC_7ca78/fast] Error 2






CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "/private/var/folders/cf/khjk667d5qxc6ppdf78wh80h0000gn/T/cmake_check_environment/_build8201886344149806748/CMakeFiles/CMakeOutput.log".
See also "/private/var/folders/cf/khjk667d5qxc6ppdf78wh80h0000gn/T/cmake_check_environment/_build8201886344149806748/CMakeFiles/CMakeError.log".

Error code: 1

 

The Messages output after running Hello World is as follows:

====================[ Build | all | Debug ]=====================================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/nicohaertl/Documents/CLionProjects/Test_01/cmake-build-debug --target all -- -j 3
Scanning dependencies of target Test_01
[ 50%] Building CXX object CMakeFiles/Test_01.dir/main.cpp.o
[100%] Linking CXX executable Test_01
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::getloc() const", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
_main in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
_main in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::cout", referenced from:
_main in main.cpp.o
"std::__1::ctype<char>::id", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::locale::~locale()", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::terminate()", referenced from:
___clang_call_terminate in main.cpp.o
"operator delete(void*)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
"operator new(unsigned long)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
"___cxa_begin_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
___clang_call_terminate in main.cpp.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"___gxx_personality_v0", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Test_01] Error 1
make[1]: *** [CMakeFiles/Test_01.dir/all] Error 2
make: *** [all] Error 2

 

 

2 comments
Comment actions Permalink

Okay found a solution. 
Use a string like "<" or ">" as path for the C compiler and run Hello World. CMake will shout at you. After re-typing the valid paths of the new compiles, they get accepted.

However, I have the next problem. It still won't run, but for a different reason. As I cannot extract any meaningful information out of the Build message, here you go:

====================[ Build | all | Debug ]=====================================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/nicohaertl/Documents/CLionProjects/Test01/cmake-build-debug --target all -- -j 3
Scanning dependencies of target Test01
[ 50%] Building CXX object CMakeFiles/Test01.dir/main.cpp.o
[100%] Linking CXX executable Test01
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::getloc() const", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
_main in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
_main in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::cout", referenced from:
_main in main.cpp.o
"std::__1::ctype<char>::id", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::locale::~locale()", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"std::terminate()", referenced from:
___clang_call_terminate in main.cpp.o
"operator delete(void*)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
"operator new(unsigned long)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
"___cxa_begin_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
___clang_call_terminate in main.cpp.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
"___gxx_personality_v0", referenced from:
_main in main.cpp.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main.cpp.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main.cpp.o
Dwarf Exception Unwind Info (__eh_frame) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Test01] Error 1
make[1]: *** [CMakeFiles/Test01.dir/all] Error 2
make: *** [all] Error 2
0
Comment actions Permalink

Hello!

Please remove the cmake-build-debug folder, set the paths as on the following screenshot and call `Tools | CMake | Reset Cache and Reload project`

0

Please sign in to leave a comment.