cmake will not compile with clang++[6.0]
Hi,
CLion refuses to compile a newly created project. Please advise.
I'm on Ubuntu 18
ehsmeng@dell7520:~/.IntelliJIdea2018.1/config$ /usr/bin/clang++ --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(asioTests)
set(CMAKE_CXX_STANDARD 17)
add_executable(asioTests main.cpp)
/home/ehsmeng/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/182.4505.18/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE= -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -G "CodeBlocks - Unix Makefiles" /home/ehsmeng/CLionProjects/asioTests
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- broken
CMake Error at /home/ehsmeng/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/182.4505.18/bin/cmake/linux/share/cmake-3.12/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/usr/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/ehsmeng/CLionProjects/asioTests/cmake-build-default/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_9d8c6/fast"
/usr/bin/make -f CMakeFiles/cmTC_9d8c6.dir/build.make CMakeFiles/cmTC_9d8c6.dir/build
make[1]: Entering directory '/home/ehsmeng/CLionProjects/asioTests/cmake-build-default/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_9d8c6.dir/testCXXCompiler.cxx.o
/usr/bin/clang++ -o CMakeFiles/cmTC_9d8c6.dir/testCXXCompiler.cxx.o -c /home/ehsmeng/CLionProjects/asioTests/cmake-build-default/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_9d8c6
/home/ehsmeng/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/182.4505.18/bin/cmake/linux/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9d8c6.dir/link.txt --verbose=1
/usr/bin/clang++ CMakeFiles/cmTC_9d8c6.dir/testCXXCompiler.cxx.o -o cmTC_9d8c6
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/cmTC_9d8c6.dir/build.make:86: recipe for target 'cmTC_9d8c6' failed
make[1]: *** [cmTC_9d8c6] Error 1
make[1]: Leaving directory '/home/ehsmeng/CLionProjects/asioTests/cmake-build-default/CMakeFiles/CMakeTmp'
Makefile:121: recipe for target 'cmTC_9d8c6/fast' failed
make: *** [cmTC_9d8c6/fast] Error 2
Please sign in to leave a comment.
> Check for working CXX compiler: /usr/bin/clang++ -- broken
Hi, seems that your compiler is broken. Could you please try to reinstall it?