I'm using CLion and whenever I'm working on a project, it can't be in path with special symbols (such as º, ç, ã...), failing with the following message:
The C compiler
"C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe"
is not able to compile a simple test program.
MinGW's make program does not handle non-ASCII characters smoothly. I was able to reproduce this on my machine using a path containing ñ:
The C compiler
"C:/apps/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/workspace/peña/build2/CMakeFiles/CMakeTmp
Run Build Command(s):C:/apps/MinGW/bin/mingw32-make.exe cmTC_fe654/fast && C:/apps/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_fe654.dir\build.make CMakeFiles/cmTC_fe654.dir/build
mingw32-make.exe[1]: Entering directory 'C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj
C:\apps\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_fe654.dir\testCCompiler.c.obj -c C:\workspace\pe├▒a\build2\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\workspace\pe├▒a\build2\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_fe654.dir\build.make:81: recipe for target 'CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_fe654.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp'
Makefile:137: recipe for target 'cmTC_fe654/fast' failed
mingw32-make.exe: *** [cmTC_fe654/fast] Error 2
Note, CMake switches to the temporary build directory with the correct path, but when mingw32-make.exe is executing, the path is now garbled:
C:/workspace/pe±a/build2/CMakeFiles/CMakeTmp
The easiest way to avoid this issue is to simply change your project path to be one that does not contain non-ASCII characters.
Another option would be to use a different generator (something other than MinGW Makefiles). For example, Visual Studio configures and builds correctly, even though the non-ASCII characters are in the project path:
> cmake -G"Visual Studio 16 2019" ..
Re-run cmake no build system arguments
C:/workspace/peña
-- The CXX compiler identification is MSVC 19.23.28106.4
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/workspace/peña/build
Related
This is my current environment.
Windows 10 64bit, MinGW, CMake 3.15.2, Python 3.7.
I downloaded googletest from https://github.com/google/googletest.
I ran cmake and the following is the output.
C:\googletest-master>cd build
C:\googletest-master\build>cmake ../ -G "MinGW Makefiles"
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- 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: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/sangjin/AppData/Local/Programs/Python/Python37-32/python.exe (found version "3.7.4")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/googletest-master/build
But when I ran mingw32-make I got the following error message.
C:\googletest-master\build>mingw32-make
Scanning dependencies of target gtest
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:\googletest-master\googletest\src\gtest-all.cc:41:
C:/googletest-master/googletest/src/gtest.cc:86:11: fatal error: crtdbg.h: No such file or directory
# include <crtdbg.h> // NOLINT
^~~~~~~~~~
compilation terminated.
googletest\CMakeFiles\gtest.dir\build.make:62: recipe for target 'googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed
mingw32-make[2]: *** [googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
CMakeFiles\Makefile2:171: recipe for target 'googletest/CMakeFiles/gtest.dir/all' failed
mingw32-make[1]: *** [googletest/CMakeFiles/gtest.dir/all] Error 2
Makefile:139: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
C:\googletest-master\build>
Can anyone help me fix this problem.
This version of google test doesn't have that issue, try to build it
https://github.com/google/googletest/tree/216c37f057ae0fff38062984c890df912f40ccf6
Here is a solution for
mingw32-base version 2013072200
mingw32-gcc-g++ version 6.3.0-1
gtest version 1.10.0
In ...\googletest\src\gtest.cc
first at (original) line 86, make header inclusion conditional to MSC toolchain using #ifdef _MSC_VER ... #endif preprocessor macros.
#ifdef _MSC_VER
# include <crtdbg.h> // NOLINT
# include <debugapi.h> // NOLINT
#endif // _MSC_VER
then at (original) line 4913, make assertion redirection also conditional.
#ifdef _MSC_VER
// In debug mode, the Windows CRT can crash with an assertion over invalid
// input (e.g. passing an invalid file descriptor). The default handling
// for these assertions is to pop up a dialog and wait for user input.
// Instead ask the CRT to dump such assertions to stderr non-interactively.
if (!IsDebuggerPresent()) {
(void)_CrtSetReportMode(_CRT_ASSERT,
_CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
(void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
}
#endif // _MSC_VER
With theese changes, unit tests build and execute as expected.
I'm setting up to build openage, a clone of AoE2 genie engine. My cmake command is not being processed. Is "add_py_modules" not possible here?
This is for windows 10, using vcpkg. Command used :
cmake -DCMAKE_TOOLCHAIN_FILE=C:\Software\vcpkg/scripts/buildsystems/vcpkg.cmake ..
CMakeLists.txt:
# python module configurations
# python config file is created in libopenage
# in order to get options from libopenage
cmake_minimum_required(VERSION 3.15)
project(openage)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
add_py_modules(
__init__.py
__main__.py
assets.py
${CMAKE_CURRENT_BINARY_DIR}/config.py
default_dirs.py
NOINSTALL devmode.py
)
add_cython_modules(
cython_check.pyx
)
add_subdirectory(cabextract)
add_subdirectory(codegen)
add_subdirectory(convert)
add_subdirectory(cppinterface)
add_subdirectory(cvar)
add_subdirectory(event)
add_subdirectory(game)
add_subdirectory(log)
add_subdirectory(util)
add_subdirectory(renderer)
add_subdirectory(testing)
Output:
-- Building for: Visual Studio 16 2019
CMake Warning at C:/Software/vcpkg/scripts/buildsystems/vcpkg.cmake:107
(message):
There are no libraries installed for the Vcpkg triplet x64-windows.
Call Stack (most recent call first):
C:/Software/cmake-3.15.0-rc2-win64-x64/share/cmake-3.15/Modules/CMakeDetermineSystem.cmake:93 (include)
CMakeLists.txt:7 (project)
-- The C compiler identification is MSVC 19.21.27702.2
-- The CXX compiler identification is MSVC 19.21.27702.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe --
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: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe --
works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:10 (add_py_modules):
Unknown CMake command "add_py_modules".
-- Configuring incomplete, errors occurred!
See also
"C:/Users/kafon/Desktop/openage/openage/build/CMakeFiles/CMakeOutput.log".
PS C:\Users\kafon\Desktop\openage\openage\build>
Getting
Unknown CMake command
error when configuring someone's else project usually means, that wrong source directory has been chosen.
In your case the correct source directory is the top-level directory in the repository, but you use its openage subdirectory. This is why you got the error.
hello I just installed cmake 3.6.2 (the one that comes with cygwin) and I got an error message trying to build llvm, saying that the build failed because cc was unable to find the input file. I've seen lots of postings about a similar problem but in this case, cc is right - the input file does not in fact exist, as I confirmed by checking the directory CMakeTmp. I don't have any spaces in the cmake installation directory tree which is typically the problem. So it looks like cmake has screwed up somewhere. Any ideas?
$ cmake $C/ProgramFiles/llvm-7.0.1/src
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /cygdrive/c/ProgramFiles/Haskell Platform/8.4.3/mingw/bin/cc.exe
-- Check for working C compiler: /cygdrive/c/ProgramFiles/Haskell Platform/8.4.3/mingw/bin/cc.exe
-- Check for working C compiler: /cygdrive/c/ProgramFiles/Haskell Platform/8.4.3/mingw/bin/cc.exe -- broken
CMake Error at /usr/share/cmake-3.6.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/cygdrive/c/ProgramFiles/Haskell
Platform/8.4.3/mingw/bin/cc.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make.exe" "cmTC_d77a9/fast"
/usr/bin/make -f CMakeFiles/cmTC_d77a9.dir/build.make
CMakeFiles/cmTC_d77a9.dir/build
make[1]: Entering directory
'/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_d77a9.dir/testCCompiler.c.o
"/cygdrive/c/ProgramFiles/Haskell Platform/8.4.3/mingw/bin/cc.exe" -o
CMakeFiles/cmTC_d77a9.dir/testCCompiler.c.o -c
/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeTmp/testCCompiler.c
cc.exe: error:
/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeTmp/testCCompiler.c:
No such file or directory
cc.exe: fatal error: no input files
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_d77a9.dir/build.make:66:
CMakeFiles/cmTC_d77a9.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory
'/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_d77a9/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:50 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/ProgramFiles/llvm-7.0.1/build/CMakeFiles/CMakeError.log".
So I installed cmake from the cmake website and that works fine, so it definitely looks like a problem with the cygwin cmake. I would report this bug to cygwin if there was a way to do so
I have been trying to get JetBrains CLion IDE working, but I am running into a problem with Cmake and none of my research online has been helpful. I installed cygwin with the necessary packages (as stated here - gcc/g++, cmake, make, gdb). When I open up CLion and go into Settings (I'm running Windows 10) under Build>Toolchains>Debugger everything has a check next to it, so it seems like CLion has found everything alright, but when I look in the Debugger window I get the following error:
"C:\Users\Lucas Lofaro\.CLion2016.3\system\cygwin_cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview"
-- The CXX compiler identification is GNU 5.3.0
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- broken
CMake Error at /cygdrive/c/Users/Lucas Lofaro/.CLion2016.3/system/cygwin_cmake/share/cmake-3.6.2/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/c++.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make.exe" "cmTC_96921/fast"
/usr/bin/make -f CMakeFiles/cmTC_96921.dir/build.make
CMakeFiles/cmTC_96921.dir/build
make[1]: Entering directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o
/usr/bin/c++.exe -o CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -c
"/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx"
Linking CXX executable cmTC_96921.exe
"/cygdrive/c/Users/Lucas
Lofaro/.CLion2016.3/system/cygwin_cmake/bin/cmake.exe" -E cmake_link_script
CMakeFiles/cmTC_96921.dir/link.txt --verbose=1
/usr/bin/c++.exe -Wl,--enable-auto-import
CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -o cmTC_96921.exe
-Wl,--out-implib,libcmTC_96921.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
c++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
CMakeFiles/cmTC_96921.dir/build.make:97: recipe for target 'cmTC_96921.exe'
failed
make[1]: *** [cmTC_96921.exe] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_96921/fast' failed
make: *** [cmTC_96921/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 "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeError.log".
I've also added the cygwin bin directory to my Path environment variable, but I am really at a loss as to what to do next. Something isn't linking up and I don't want to start digging around in Cmake files without a better understanding of what's going on. Any guidance would be much appreciated. Please let me know if I can provide any additional information.
It turns out that the cmake, make, and g++ packages were installed but not updated to their most recent versions. Rerunning cygwin installer solved my problem and everything now compiles fine.
(Using elementaryOS/Ubuntu)
I'm cross-compiling x265 and I encouraged annoying problem. For some reason cmake doesn't want to accept -static-libstdc++, because ld is apparently unable to find it. Cmake is built from Source Code, working pretty well without -static-libstdc++, if I then copy libstdc++-6.dll from mingw-w64 libs to folder with x265.exe, it works well, but I want it to build with it. mingw was built with this script and contains these libraries, but I don't know where is ld looking for them.
Here is output of cmake attempt:
-- cmake version 3.5.0-rc1
-- The C compiler identification is GNU 5.2.0
-- The CXX compiler identification is GNU 5.2.0
-- Check for working C compiler: /home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc -- 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: /home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++
-- Check for working CXX compiler: /home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++ -- broken
CMake Error at /usr/local/share/cmake-3.5/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler
"/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++" is not
able to compile a simple test program.
It fails with the following output:
Change Dir: /home/myname/x265/build/linux/12bit/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_e7611/fast"
/usr/bin/make -f CMakeFiles/cmTC_e7611.dir/build.make
CMakeFiles/cmTC_e7611.dir/build
make[1]: Entering directory
`/home/myname/x265/build/linux/12bit/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_e7611.dir/testCXXCompiler.cxx.obj
/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++
-static-libgcc -static-libstdc++ -o
CMakeFiles/cmTC_e7611.dir/testCXXCompiler.cxx.obj -c
/home/myname/x265/build/linux/12bit/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_e7611.exe
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_e7611.dir/link.txt --verbose=1
/usr/local/bin/cmake -E remove -f CMakeFiles/cmTC_e7611.dir/objects.a
/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-ar cr
CMakeFiles/cmTC_e7611.dir/objects.a #CMakeFiles/cmTC_e7611.dir/objects1.rsp
/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++
-static-libgcc -static-libstdc++ -Wl,--whole-archive
CMakeFiles/cmTC_e7611.dir/objects.a -Wl,--no-whole-archive -o
cmTC_e7611.exe -Wl,--out-implib,libcmTC_e7611.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
#CMakeFiles/cmTC_e7611.dir/linklibs.rsp
/home/myname/mingw-w64/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld:
cannot find -lstdc++
collect2: error: ld returned 1 exit status
make[1]: *** [cmTC_e7611.exe] Error 1
make[1]: Leaving directory
`/home/myname/x265/build/linux/12bit/CMakeFiles/CMakeTmp'
make: *** [cmTC_e7611/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:19 (project)
-- Configuring incomplete, errors occurred!
See also "/home/myname/x265/build/linux/12bit/CMakeFiles/CMakeOutput.log".
See also "/home/myname/x265/build/linux/12bit/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found. Stop.
Cmake is run like code below.
cmake -DCMAKE_C_COMPILER='/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc' -DCMAKE_CXX_COMPILER='/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++' -DCMAKE_RC_COMPILER='/home/myname/mingw-w64/mingw-w64-x86_64/bin/x86_64-w64-mingw32-windres' -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_TOOLCHAIN_FILE='/home/myname/x265/build/linux/build.cmake' ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
make ${MAKEFLAGS}
build.cmake file is not much important here, but it contains:
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_ASM_YASM_COMPILER yasm)
Any ideas how to make -static-libstdc++ work? I tried linking it in many folders, but I couldn't find out where is ld looking for it.
I managed to solve this. Source of my confusion was the fact that you can use -static-libgcc, so I thought even -static-libstdc++ should work. The problem was that there indeed were libraries, but not the .a files for libstdc++. These can be disabled using this parameter when using the script. Then both -static-lib options work well.
bash ./mingw-w64-build-3.6.7 --disable-shared