Can I get CMake to use MS Visual C++ properly on Cygwin? - c++

I'm using Cygwin on Windows 10; but I've recently installed the MSVC 2019 compiler.
I can, of course, write CXX=/path/to/cl.exe (or CC=/path/to/cl.exe if I ignore how MSVC isn't a proper C compiler), but if I try configuring a C or C++ project that way, I get something like:
$ cmake -S . -B build
-- The CXX compiler identification is MSVC 19.29.30133.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe
-- Check for working CXX compiler: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe - broken
CMake Error at /usr/share/cmake-3.20.0/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/joeuser/src/myproj/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe -f Makefile cmTC_1b995/fast && /usr/bin/make -f CMakeFiles/cmTC_1b995.dir/build.make CMakeFiles/cmTC_1b995.dir/build
make[1]: Entering directory '/home/joeuser/src/myproj/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_1b995.dir/testCXXCompiler.cxx.o
"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe" -o CMakeFiles/cmTC_1b995.dir/testCXXCompiler.cxx.o -c /home/joeuser/src/myproj/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '/home/joeuser/src/myproj/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx'
cl : Command line error D8003 : missing source filename
make[1]: *** [CMakeFiles/cmTC_1b995.dir/build.make:78: CMakeFiles/cmTC_1b995.dir/testCXXCompiler.cxx.o] Error 2
make[1]: Leaving directory '/home/joeuser/src/myproj/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_1b995/fast] Error 2
So, CMake is trying to pass GCC-like command-line options to MSVC. Can I get it to "play nice" and actually be able to use MSVC properly?

Related

CMake with clang shows undefined symbol, and with cl links correctly

TLDR
Im building a static library and linking it to an executable. Im generating makefiles with cmake. When I generate the makefile for cl (The compiler from visual studio) I have no problems, but when I generate the makefile for clang I get an undefined symbol.
Versions:
cmake version 3.18.1
clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
cl version 19.26.28806 for x64
Minimal Example
I have the following structure for the proyect:
Proyect Root
│ CMakeLists.txt
│ foo.cpp
│ foo.hpp
│ main.cpp
│
└───bin
And this are the contents of the files:
foo.hpp
namespace foo {
void do_stuff(void);
}
foo.cpp
#include <foo.hpp>
namespace foo {
void do_stuff(void) {}
}
main.cpp
#include <foo.hpp>
int main(void) {
foo::do_stuff();
return 0;
}
And CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(CompileAndLinkLib)
include_directories(".")
file(GLOB FOO_SRC "foo.cpp")
add_library(foo STATIC ${FOO_SRC})
add_executable(main "main.cpp")
target_link_libraries(main foo)
Correct linking
First I call vcvarsall.bat. I generate a nmake file with the following command:
cmake .. -G "NMake Makefiles"
And compile with:
nmake
The project compiles and links correctly
The undefined symbol
I generate the make file with the following command:
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
And when I compile with make I get the following output:
Scanning dependencies of target foo
[ 25%] Building CXX object CMakeFiles/foo.dir/foo.cpp.obj
[ 50%] Linking CXX static library foo.lib
[ 50%] Built target foo
Scanning dependencies of target main
[ 75%] Building CXX object CMakeFiles/main.dir/main.cpp.obj
[100%] Linking CXX executable main.exe
lld-link: error: undefined symbol: void __cdecl foo::do_stuff(void)
>>> referenced by C:\Users\pabsa\temp\main.cpp:4
>>> CMakeFiles/main.dir/main.cpp.obj:(main)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [main.exe] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
Im not sure if im doing something wrong, like if im missing something, or if this is an error with the makefile generated by cmake.
I just had the same problem, but with Clang 13. It could be solved with specifying clang as compiler in the CMakeLists, instead of letting CMake determine it automatically.
set(CMAKE_CXX_COMPILER "clang++")
(And yes, I read your original question correct, using this:
-DCMAKE_CXX_COMPILER=clang++
as an additional argument for cmake did not work for me as well, even if it looks like it should behave the same as setting it in CMakeLists.txt)
I tested again with:
clang version 12.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
And it worked corretly. Seems like it was a problem with clang 11
You're overcomplicating things imo. What about just "cmake .. -T ClangCL && cmake --build ."? Builds fine for me:
C:\Users\vital\test\_build>cmake .. -T ClangCL
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.20348.0 to target Windows 10.0.22000.
-- The C compiler identification is Clang 14.0.5 with MSVC-like command-line
-- The CXX compiler identification is Clang 14.0.5 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.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:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/vital/test/_build
C:\Users\vital\test\_build>cmake --build .
MSBuild version 17.3.1+2badb37d1 for .NET Framework
Checking Build System
Building Custom Rule C:/Users/vital/test/CMakeLists.txt
foo.vcxproj -> C:\Users\vital\test\_build\Debug\foo.lib
Building Custom Rule C:/Users/vital/test/CMakeLists.txt
main.vcxproj -> C:\Users\vital\test\_build\Debug\main.exe
Building Custom Rule C:/Users/vital/test/CMakeLists.txt
C:\Users\vital\test\_build>

How to enable -mno-outline-atomics AArch64 flag?

I've been trying to cross compile an open source library for AArch64.
When I run an executable linking against this library on a Raspberry Pi 4 (running a 64-bit OS), I get an Illegal Instruction error.
I created a github issue and the library developer suggested I enable the -mno-outline-atomics compiler flag (more details on the github issue here). More details on the flag itself can be found here.
So I edited the aarch64 cmake toolchain file (found here) to include the following:
set(CMAKE_C_FLAGS "-march=armv8-a -mno-outline-atomics")
set(CMAKE_CXX_FLAGS "-march=armv8-a -mno-outline-atomics")
However, when I try to compile the library, I get the following error messages:
-- CMAKE_TOOLCHAIN_FILE = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/toolchains/aarch64-linux-gnu.toolchain.cmake
-- CMAKE_INSTALL_PREFIX = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/install
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - broken
CMake Error at /usr/local/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/aarch64-linux-gnu-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_65def/fast && /usr/bin/make -f CMakeFiles/cmTC_65def.dir/build.make CMakeFiles/cmTC_65def.dir/build
make[1]: Entering directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_65def.dir/testCCompiler.c.o
/usr/bin/aarch64-linux-gnu-gcc -march=armv8-a -mno-outline-atomics -o CMakeFiles/cmTC_65def.dir/testCCompiler.c.o -c /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp/testCCompiler.c
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
CMakeFiles/cmTC_65def.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_65def.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_65def.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Makefile:138: recipe for target 'cmTC_65def/fast' failed
make: *** [cmTC_65def/fast] Error 2
Why is the compiler complaining about this: unrecognized command line option ‘-mno-outline-atomics’?
How can I properly enable the flag using CMake?
The outline-atomic feature was added with gcc 9.4.
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
Clearly, your compiler is too old and does not support it.

VS2017 developer command prompt only builds to x86 - need x64

I'm trying to build some C++ libraries using cmake using the VS2017 developer command prompt. I need to build them for a Release x64 setup, however, the command prompt only seems to build them to x86.
First, I run this command (note the build type Release64):
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release64 -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..
-- The C compiler identification is MSVC 19.16.27039.0
-- The CXX compiler identification is MSVC 19.16.27039.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.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:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- 3.13.0.0
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/test_game_server/protobuf/cmake/build/release64
Then I run nmake, but I see this error:
...
[ 49%] Linking CXX static library gmock_main.lib
[ 49%] Built target gmock_main
[ 50%] Generating C:/test_game_server/protobuf/src/google/protobuf/any_test.pb.cc
google/protobuf/any_test.pb.cc: while trying to create directory C:/test_game_server/protobuf/src/google: No error
NMAKE : fatal error U1077: '.\protoc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
This error still occurred even after I used Vcvarsall.bat to set a 64-bit hosted build architecture:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.22
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
It is worth noting that there are no errors when I compile the project with the option Release instead of Release64.
I looked for the x64 native or cross-tool developer command prompts, but I don't have any associated with VS2017 (I do have one for VS2010 but the C++ version is out of date). Compiling in my standard Windows command prompt is not an option.
How can I force this project to compile to x64 instead of x86?
If you do not require using NMake, you could use the Visual Studio's build system by first generating for 64 bit (note the Win64 part):
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release64 -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..
And then building via cmake's build command:
cmake --build <directory> --config Release64
CMake will then generate and execute whatever command is needed for building using Visual Studio itself on the command line.
You aren't using CMAKE_BUILD_TYPE properly.
https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Unless you have defined a configuration besides the default ones (Debug, Release, RelWithDebInfo, MinSizeRel) what you are doing makes no sense.
Configurations have nothing to do with the architecture you are compiling for.
The architecture you are compiling for has to do with tool-chains and compiler options.
======================================
2nd
NMake Makefiles are ridiculously slow. Use Ninja or Visual Studio instead.
======================================
3rd
Here are instructions for building for x64/x86 using visual studio (I use 2019, but it shouldn't matter)
cmake -G "Visual Studio 16 2019" -A Win32 -S path_to_source -B "build32"
cmake --build build32 --config Release
cmake -G "Visual Studio 16 2019" -A x64 -S path_to_source -B "build64"
cmake --build build64 --config Release
======================================
4th
If you wondering how to configure/build for single configuration generators like ninja/nmake-builds please open up another question. Because it's a loaded question.

CMake passes Visual C++ parameters to clang instead of expexted GCC ones

I'm trying to build the project under win10 using mingw latest toolchain and clang compilers (from CLion IDE) with explicitly specified compilers in commandline options :
-DCMAKE_C_COMPILER=C:/dev/tools/LLVM/bin/clang.exe
-DCMAKE_CXX_COMPILER=C:/dev/tools/LLVM/bin/clang++.exe
cmake recognize clang correctly, but during the test compilations tries to pass cl (Visual C++ compiler) flags:
C:\dev\tools\CLion.RC\bin\cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=C:/dev/tools/LLVM/bin/clang.exe -DCMAKE_CXX_COMPILER=C:/dev/tools/LLVM/bin/clang++.exe -G "CodeBlocks - MinGW Makefiles" C:\Users\amigo421\ClionProjects\hr2
-- The C compiler identification is unknown
-- The CXX compiler identification is Clang 3.9.0
-- Check for working C compiler: C:/dev/tools/LLVM/bin/clang.exe
-- Check for working C compiler: C:/dev/tools/LLVM/bin/clang.exe -- broken CMake Error at
C:/dev/tools/CLion.RC/bin/cmake/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61
(message): The C compiler "C:/dev/tools/LLVM/bin/clang.exe" is not
able to compile a simple test program.
It fails with the following output:
C:\dev\tools\LLVM\bin\clang.exe /DWIN32 /D_WINDOWS /W3 -o
CMakeFiles\cmTC_397ea.dir\testCCompiler.c.obj -c
C:\Users\amigo421\ClionProjects\hr2\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c
**clang.exe: error: no such file or directory: '/DWIN32'**
**clang.exe: error: no such file or directory: '/D_WINDOWS'**
**clang.exe: error: no such file or directory: '/W3'**
CMakeFiles\cmTC_397ea.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_397ea.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: ***
[CMakeFiles/cmTC_397ea.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory
'C:/Users/amigo421/ClionProjects/hr2/cmake-build-debug/CMakeFiles/CMakeTmp'
you see that cmake passes visual c++ flags , I don't plan to use clang-cl.
I suppose that cmake should use GCC (MinGW) parameters in command line
any idea how to fix this

MinGW “The procedure entry point libintl_setlocale could not be located …”

I have problem building a project under Windows 7 64bit. I already looked similar questions on SO, but didn't found proper solution. When I run:
cmake -v -G "MSYS Makefiles" CMakeLists.txt
it gives me following output:
> -- The C compiler identification is unknown
-- 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.0/Modules/CMakeTestCCo
mpiler.cmake:61 (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: C:/Users/Sony/Documents/Computer_Graphics/assignment_01/programmi
ng/glfw/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/msys/1.0/bin/make.exe"
"cmTryCompileExec1735268707/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1735268707.dir/build.make
CMakeFiles/cmTryCompileExec1735268707.dir/build
make[1]: Entering directory
`/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMak
eFiles/CMakeTmp'
"/C/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMake
Files/CMakeTmp/CMakeFiles
1
Building C object
CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj
/c/MinGW/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj -c
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMake
Files/CMakeTmp/testCCompiler.c
make[1]: ***
[CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj] Error 1
make[1]: Leaving directory
Also I get next error message 3 times, during compilation attempt, it says "The procedure entry point libintl_setlocale could not be located in the library libintl-8.dll"
CMakeError.log:
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags:
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -c
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -Aa
The output was: 1 :0:1: error: missing '(' after
predicate
Checking whether the C compiler is IAR using "" did not match "IAR .+
Compiler": gcc.exe: fatal error: no input files compilation
terminated. Determining if the C compiler works failed with the
following output: Change Dir:
C:/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/msys/1.0/bin/make.exe"
"cmTryCompileExec2453403923/fast" /usr/bin/make -f
CMakeFiles/cmTryCompileExec2453403923.dir/build.make
CMakeFiles/cmTryCompileExec2453403923.dir/build make[1]: Entering
directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
"/c/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/CMakeFiles
1 Building C object
CMakeFiles/cmTryCompileExec2453403923.dir/testCCompiler.c.obj
/c/MinGW/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec2453403923.dir/testCCompiler.c.obj -c
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/testCCompiler.c
make[1]: Leaving directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
make[1]: *
[CMakeFiles/cmTryCompileExec2453403923.dir/testCCompiler.c.obj] Error
1 make: * [cmTryCompileExec2453403923/fast] Error 2
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags:
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -c
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -Aa
The output was: 1 :0:1: error: missing '(' after
predicate
Checking whether the C compiler is IAR using "" did not match "IAR .+
Compiler": gcc.exe: fatal error: no input files compilation
terminated. Determining if the C compiler works failed with the
following output: Change Dir:
C:/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/msys/1.0/bin/make.exe"
"cmTryCompileExec78678067/fast" /usr/bin/make -f
CMakeFiles/cmTryCompileExec78678067.dir/build.make
CMakeFiles/cmTryCompileExec78678067.dir/build make[1]: Entering
directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
"/C/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/CMakeFiles
1 Building C object
CMakeFiles/cmTryCompileExec78678067.dir/testCCompiler.c.obj
/c/MinGW/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec78678067.dir/testCCompiler.c.obj -c
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/testCCompiler.c
make[1]: make[1]: Leaving directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
* [CMakeFiles/cmTryCompileExec78678067.dir/testCCompiler.c.obj] Error 1 make: * [cmTryCompileExec78678067/fast] Error 2
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags:
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -c
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -Aa
The output was: 1 :0:1: error: missing '(' after
predicate
Checking whether the C compiler is IAR using "" did not match "IAR .+
Compiler": gcc.exe: fatal error: no input files compilation
terminated. Determining if the C compiler works failed with the
following output: Change Dir:
C:/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/msys/1.0/bin/make.exe"
"cmTryCompileExec1735268707/fast" /usr/bin/make -f
CMakeFiles/cmTryCompileExec1735268707.dir/build.make
CMakeFiles/cmTryCompileExec1735268707.dir/build make[1]: Entering
directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
"/C/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/CMakeFiles
1 Building C object
CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj
/c/MinGW/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj -c
/C/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp/testCCompiler.c
make[1]: ***
[CMakeFiles/cmTryCompileExec1735268707.dir/testCCompiler.c.obj] Error
1 make[1]: Leaving directory
/c/Users/Sony/Documents/Computer_Graphics/assignment_01/programming/glfw/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec1735268707/fast] Error 2
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags:
The output was: 1
Compiling the C compiler identification source file
"CMakeCCompilerId.c" failed. Compiler: c:/MinGW/bin/gcc.exe Build
flags: Id flags: -c
The output was: 1
Also my Path Environment Variable:
C:\Program Files (x86)\PC Connectivity Solution\;C:\Program
Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files
(x86)\Common Files\Microsoft Shared\Windows Live;c:\Program Files
(x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS
Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files
(x86)\AMD
APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program
Files\Sony\VAIO Improvement\;C:\Program Files (x86)\Sony\VAIO Startup
Setting Tool;C:\Program Files (x86)\Windows Live\Shared;c:\Program
Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program
Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft
SQL Server\100\DTS\Binn\;C:\Program Files
(x86)\MVActiveX\;C:\Java\jdk1.7.0_09\bin;C:\Program
Files\Microsoft\Web Platform Installer\;C:\Program Files
(x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files
(x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program
Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program
Files\TortoiseHg\;C:\Program
Files\MATLAB\R2013a\runtime\win64;C:\Program
Files\MATLAB\R2013a\bin;C:\MinGW\bin;C:\Program Files (x86)\CMake\bin
I installed and reinstalled mingw and investigated my path variable, but still have no solution. Any ideas, where I am wrong?
I just found the answer to this: I had another libintl-8.dll in my path.
Do this from the command line:
where libintl-8.dll
Then rename ALL of them except the one in the MinGW tree.
If that fails, then a reinstall of your MinGW tree may be needed. Good luck.
Drop libintl-8.dll in System32/SysWOW64 and it should work fine.
This is a somewhat ignorant guess, but the problem with libintl-8.dll could arise from path issues. Somewhere in your path, you could have an older version of the lib with different entrypoints. Make sure you have the latest version of MinGW and all relevant libraries, and then try moving MinGW\bin to the top of your path variable.
For another example of what appears to be this problem in action, see: MinGW "The procedure entry point libiconv could not be located ..."
The answer in that linked question helped me resolve a similar problem I was having.