无法 运行 使用 MinGW 和 git bash 在 windows 上进行 Cmake
Can't run Cmake on windows with MinGW and git bash
我尝试构建 gitql。
我已经安装了 go、CMake 和 MinGW,并试图让它们在 git bash 下工作,但是当我在 gitql 目录中调用 cmake 时,我得到了这个错误:
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:14 (PROJECT):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeOutput.log".
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeError.log".
make: *** [prepare] B▒▒d 1
所以我尝试使用以下方法从 mingw 指向 gcc:
export CC=/c/MinGW/bin/gcc.exe
当我 运行 make 我得到这个错误:
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_14ff0\fast"
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (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:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_14ff0\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_14ff0\fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:14 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeOutput.log".
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeError.log".
make: *** [prepare] B▒▒d 1
如何通知cmake使用make而不是nmake?我已经在 C:\Program Files (x86)\GnuWin32\bin
中安装了 $PATH
.
我也尝试调用 cmake -G "MinGW Makefiles"
但我遇到了这个错误:
CMake Error: The source directory "C:/Go/src/github.com/cloudson/gitql" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
cmake -G "MinGW Makefiles"
实际上是通知 CMake 你想使用 MinGW 的正确命令。
为了完整起见,您应该创建一个单独的文件夹,我们称之为 build
,然后从中调用 cmake 进行源外构建:
cd /path/to/build
cmake -G "MinGW Makefiles" /path/to/CMakeLists.txt
这里的问题是 gitql
没有在存储库中提供任何 CMakeLists.txt
文件,所以你不能使用 CMake 来构建它,除非你创建自己的项目文件。您可以从给定的 Makefile
开始尝试,并将其作为拉取请求提出。
我尝试构建 gitql。
我已经安装了 go、CMake 和 MinGW,并试图让它们在 git bash 下工作,但是当我在 gitql 目录中调用 cmake 时,我得到了这个错误:
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:14 (PROJECT):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeOutput.log".
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeError.log".
make: *** [prepare] B▒▒d 1
所以我尝试使用以下方法从 mingw 指向 gcc:
export CC=/c/MinGW/bin/gcc.exe
当我 运行 make 我得到这个错误:
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_14ff0\fast"
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (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:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_14ff0\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_14ff0\fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:14 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeOutput.log".
See also "C:/Go/src/github.com/cloudson/gitql/libgit2/CMakeFiles/CMakeError.log".
make: *** [prepare] B▒▒d 1
如何通知cmake使用make而不是nmake?我已经在 C:\Program Files (x86)\GnuWin32\bin
中安装了 $PATH
.
我也尝试调用 cmake -G "MinGW Makefiles"
但我遇到了这个错误:
CMake Error: The source directory "C:/Go/src/github.com/cloudson/gitql" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
cmake -G "MinGW Makefiles"
实际上是通知 CMake 你想使用 MinGW 的正确命令。
为了完整起见,您应该创建一个单独的文件夹,我们称之为 build
,然后从中调用 cmake 进行源外构建:
cd /path/to/build
cmake -G "MinGW Makefiles" /path/to/CMakeLists.txt
这里的问题是 gitql
没有在存储库中提供任何 CMakeLists.txt
文件,所以你不能使用 CMake 来构建它,除非你创建自己的项目文件。您可以从给定的 Makefile
开始尝试,并将其作为拉取请求提出。