I get this output when I run cmake in the CLion environment. When I run outside of CLion I get no warnings and everything works fine.
The really strange part about this is I specify clang and clang++ for the compiler, I do this in the CC and CXX environment variables as well as in the toolchain settings in CLion, but it is saying the g++ and gcc are having errors. However, no where in any of my config for CLion have I mentioned gcc or g++.
Where are these coming from and how can I fix it? It would be really nice to actually build this project from my IDE.
These issues started after the CLion 2017.3 update.
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G "CodeBlocks - Unix Makefiles" /home/rkratt/src
-- The C compiler identification is Clang 3.9.0
-- The CXX compiler identification is Clang 3.9.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++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Building src in Debug mode.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rkratt/src/cmake-build-debug
Problems were encountered while collecting compiler information:
g++: error: unrecognized command line option '-fopenmp=libomp'
gcc: error: unrecognized command line option '-fopenmp=libomp'
[Finished]
Ryan, it seems that CMake associated g++/gcc with specific targets in you project. I suspect that building will also fail. Could you check that?
If you are not able to resolve the problem, please file a ticket and we'll try to help.
Related
I'm actualy trying to compile a project on windows with the CMakeList.txt that I used to compile the project on linux.
Unfortunatly when I try to compile with windows powershell, cmake is saying :
cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find SDL2_image (missing: SDL2_IMAGE_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/FindSDL2_image.cmake:91 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:12 (find_package)
-- Configuring incomplete, errors occurred!
At the first time it didn't scared me cause I know that I have to download every library and link them to the cmake.
After I download every library like this : screenshot of the files
I tried to link them into my cmake,
firstly adding them to my Environment Variables :screenshot
but that didn't work, he always says "impossible to find SDL2_image when its perfectly working on linux with the cmakeFound...
W/E if someone knows how to compile or add a library to cmake on windows it could be insane for me.
OS: MacOS 12.4
Installed cmake with
brew install cmake
cmake version 3.23.3
Installed clang with
xcode-select --install
clang++ version is 13.1.6
Trying to build ccls:
git clone https://github.com/MaskRay/ccls.git
mkdir build && cd build
cmake ..
And getting following output
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' as none was specified.
CMake Error at CMakeLists.txt:72 (find_package):
By not providing "FindClang.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Clang", but
CMake did not find one.
Could not find a package configuration file provided by "Clang" with any of
the following names:
ClangConfig.cmake
clang-config.cmake
Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set
"Clang_DIR" to a directory containing one of the above files. If "Clang"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/Users/umed/projects/MaskRay/ccls/build/CMakeFiles/CMakeOutput.log".
See also "/Users/umed/projects/MaskRay/ccls/build/CMakeFiles/CMakeError.log".
Is there anyway to make brew's cmake work with system clang?
The question is not correct. CMake uses the system clang successfully, but it can't find clang libraries required by the project.
The Build manual lists the requirements, one of them is
Clang+LLVM headers and libraries, version >= 7
You get errors because you have not provided that dependency.
brew install llvm#13
I am trying to compile Assimp 5.0.1 for Windows 10 using CMake. The C/C++ compilers I have through MinGW are GCC and G++. If I understand the problem correctly, there is an issue with the MakeFile's whitespace somewhere. The /CMakeTmp/ directory is empty, and I am sure the answer is right in front of me somewhere:
Console Output:
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe - broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_a4ec5\fast && Makefile:37: *** missing separator. Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:54 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeOutput.log".
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeError.log".
CMakeError.log:
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_165dc\fast && Makefile:37: *** missing separator. Stop.
CMakeOutput.log:
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"
The C compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdC/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
The CXX compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdCXX/a.exe"
Which -G option did you use for cmake?
The /nologo parameter for make doesn't seem right, that looks like a Microsoft/MSVC parameter. If you didn't specify -G then CMake defaults to -G"NMake Makefiles" on Windows.
Make sure to use cmake flag -G"MinGW Makefiles" for mingw32-make or -G"MSYS Makefiles" if you use MSYS' make.
But to avoid all those make issues and improve speed -GNinja is the best solution, provided you have Ninja available (see https://ninja-build.org/).
Finally, you're still on MinGW GCC 9.2.0. Newer versions are available, see http://winlibs.com/ for standalone builds which also come with newer mingw32-make.
I have a project with CMake, devtoolset-6 and standart gcc 4.8.2 installed.
CMake correctly finds correct gcc:
-- The C compiler identification is GNU 6.2.1
-- The CXX compiler identification is GNU 6.2.1
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc -- 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: /opt/rh/devtoolset-6/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
PATH and LD_LIBRARY_PATH are set
echo $PATH
/opt/rh/devtoolset-6/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
echo $LD_LIBRARY_PATH
/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib
The project builds correctly but lings against wrong libgcc and libstd++ from /usr/lib64
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f60b47bf000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007f60b45a8000)
What is wrong?
This is not a bug, but the feature! :)
RH DevToolset is not just an alternative compiler built on the side. It's libstdc++ is an LD script. The new C++11 (and above) symbols in your binary would be resolved via static library (built specially and shipped w/ DTS). However, old symbols (existed in the OS's shipped libstdc++) going to be resolved dynamically. That is why ldd shows you libstdc++ from the /usr/lib64! Also, it has Old C++ ABI by default... to make your modern C++ code compatible w/ old libstdc++ DSO.
This feature allows you to use modern C++ standards, and produce a binary which can be executed in the original OS (CentOS/RHEL) w/o any additional "redistributable" shared libraries.
JFYI, if you use strip, make sure you use it from DTS and not the "native" one (shipped in binutils from the OS)! Otherwise, really bad things can happen.
I'm trying to compile libarchive using cmake -G Xcode libarchive according to the official build instructions
I ve cmake 2.8.12 installed via mac port and use the current CMakeList.txt
cmake -G Xcode libarchive outputs
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:177 (SET_TARGET_PROPERTIES):
set_target_properties called with incorrect number of arguments.
CMake Error at CMakeLists.txt:193 (INSTALL_MAN):
Unknown CMake command "INSTALL_MAN".
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
Configure from the top-level directory (the one containing the README file):
$ cmake -G Xcode .
the subsidiary CMakeLists.txt files in various directories are not complete and cannot be used by themselves.