Error: C Compiler is not able to compile a simple test program and clang-4.0: error: linker command failed with exit code 1
I received the following error message when I first started running programs on CLion. I am not sure what it is and I attach both the error log and the output log here. Could someone help please? Thank you very much!
CMake Error at /Users/XXX/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/Users/XXX/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: /Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_e4157/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_e4157.dir/build.make CMakeFiles/cmTC_e4157.dir/build
Building C object CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o
/Users/XXX/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.14.sdk -o CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o -c "/Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c"
Linking C executable cmTC_e4157
"/Users/XXX/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/CLion.app/Contents/bin/cmake/mac/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_e4157.dir/link.txt --verbose=1
/Users/XXX/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.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o -o cmTC_e4157
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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_e4157] Error 1
make: *** [cmTC_e4157/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".
[Failed to reload]"
CMakeError.log:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Users/XXX/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
Build flags: -march=core2;-mtune=haswell;-mssse3;-ftree-vectorize;-fPIC;-fPIE;-fstack-protector-strong;-O2;-pipe
Id flags:
The output was:
1
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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)
Determining if the C compiler works failed with the following output:
Change Dir: /Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_e4157/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_e4157.dir/build.make CMakeFiles/cmTC_e4157.dir/build
Building C object CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o
/Users/daisyhe/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.14.sdk -o CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o -c "/Users/daisyhe/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c"
Linking C executable cmTC_e4157
"/Users/XXX/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/CLion.app/Contents/bin/cmake/mac/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_e4157.dir/link.txt --verbose=1
/Users/XXX/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.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs CMakeFiles/cmTC_e4157.dir/testCCompiler.c.o -o cmTC_e4157
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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_e4157] Error 1
make: *** [cmTC_e4157/fast] Error 2
CMakeOutput.log:
The system is: Darwin - 18.7.0 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /Users/XXX/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
Build flags: -march=core2;-mtune=haswell;-mssse3;-ftree-vectorize;-fPIC;-fPIE;-fstack-protector-strong;-O2;-pipe
Id flags: -c
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"
The C compiler identification is Clang, found in "/Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/3.15.3/CompilerIdC/CMakeCCompilerId.o"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /Users/XXX/anaconda3/bin/x86_64-apple-darwin13.4.0-clang++
Build flags: -march=core2;-mtune=haswell;-mssse3;-ftree-vectorize;-fPIC;-fPIE;-fstack-protector-strong;-O2;-pipe;-stdlib=libc++;-fvisibility-inlines-hidden;-std=c++14;-fmessage-length=0
Id flags:
The output was:
0
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.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 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is Clang, found in "/Users/XXX/Desktop/NYU Bridge/untitled/cmake-build-debug/CMakeFiles/3.15.3/CompilerIdCXX/a.out"
Please sign in to leave a comment.
Hello!
Please execute the
xcode-select --installcommand in Terminal, after that necessarily do Tools | CMake | Reset Cache and Reload Project in CLion. Does the issue happen after that?@...
Hello the pb still exists after following your steps. Thank you for forward
Please attach a screenshot of Preferences | Build, Execution, Deployment | Toolchains (please capture the screenshot after the compiler detection is completed).
Hi Anna,
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/laurence/CLionProjects/hello
-- The C compiler identification is Clang 4.0.1
-- The CXX compiler identification is Clang 4.0.1
-- Check for working C compiler: /Users/laurence/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
-- Check for working C compiler: /Users/laurence/anaconda3/bin/x86_64-apple-darwin13.4.0-clang -- broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/Users/laurence/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: /Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/Users/laurence/anaconda3/bin/make cmTC_d9b00/fast && /Users/laurence/anaconda3/bin/make -f CMakeFiles/cmTC_d9b00.dir/build.make CMakeFiles/cmTC_d9b00.dir/build
make[1]: Entering directory '/Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_d9b00.dir/testCCompiler.c.o
/Users/laurence/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_d9b00.dir/testCCompiler.c.o -c /Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_d9b00
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d9b00.dir/link.txt --verbose=1
/Users/laurence/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_d9b00.dir/testCCompiler.c.o -o cmTC_d9b00
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 0x2D 0x76 0x33 ) 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]: *** [CMakeFiles/cmTC_d9b00.dir/build.make:87: cmTC_d9b00] Error 1
make[1]: Leaving directory '/Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_d9b00/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/laurence/CLionProjects/hello/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
@Anna Falevskaya
Please specify /usr/bin/make in the Make field, /Library/Developer/CommandLineTools/usr/bin/cc in the C compiler field, /Library/Developer/CommandLineTools/usr/bin/c++ in the C++ compiler field:
now it's perfect, thank you a lot Anna !