【问题标题】:C compiler broken with cmakeC 编译器被 cmake 破坏
【发布时间】:2015-05-29 11:03:14
【问题描述】:

我知道这里已经有人问过类似的问题cmake reports gcc is broken. Where do I start? 然而,在那篇文章上没有真正的答案,所以因为我也坚持这一点,所以我想我会创建一个新的。 所以基本上我的环境是windows,我使用的是cygwin。 我正在尝试安装VTK。我已经使用 Windows Cmake 生成了所有内容。 现在,当我启动 make 时,我得到以下输出:

`make
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Lonni/VTK/BuildCyg
[  6%] Creating directories for 'vtk-compile-tools'
[ 12%] No download step for 'vtk-compile-tools'
[ 18%] No patch step for 'vtk-compile-tools'
[ 25%] No update step for 'vtk-compile-tools'
[ 31%] Performing configure step for 'vtk-compile-tools'
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: C:/cygwin64/bin/cc
-- Check for working C compiler: C:/cygwin64/bin/cc -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/cygwin64/bin/cc" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp



  Run Build Command:"C:/Strawberry/c/bin/gmake.exe"
  "cmTryCompileExec4220576950/fast"

  gmake.exe[3]: Entering directory
  'C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp'


  C:/Strawberry/c/bin/gmake.exe -f
  CMakeFiles/cmTryCompileExec4220576950.dir/build.make
  CMakeFiles/cmTryCompileExec4220576950.dir/build

  gmake.exe[4]: Entering directory
      'C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp'


  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
      C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building C object
  CMakeFiles/cmTryCompileExec4220576950.dir/testCCompiler.c.obj

  C:/cygwin64/bin/cc -o
  CMakeFiles/cmTryCompileExec4220576950.dir/testCCompiler.c.obj -c
  C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp/testCCompiler.c


  process_begin: CreateProcess(C:\cygwin64\bin\cc, C:/cygwin64/bin/cc -o
  CMakeFiles/cmTryCompileExec4220576950.dir/testCCompiler.c.obj -c
  C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp/testCCompiler.c,
  ...) failed.

      make (e=5): Acc▒s refus▒.

      gmake.exe[4]: ***
      [CMakeFiles/cmTryCompileExec4220576950.dir/testCCompiler.c.obj] Error 5

  CMakeFiles/cmTryCompileExec4220576950.dir/build.make:57: recipe for target
  'CMakeFiles/cmTryCompileExec4220576950.dir/testCCompiler.c.obj' failed

  gmake.exe[4]: Leaving directory
  'C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp'


  Makefile:117: recipe for target 'cmTryCompileExec4220576950/fast' failed

  gmake.exe[3]: *** [cmTryCompileExec4220576950/fast] Error 2

  gmake.exe[3]: Leaving directory
 'C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeTmp'

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:28 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Lonni/VTK/BuildCyg/CMakeExternals/Build/vtk-compile-tools/CMakeFiles/CMakeError.log".
CMakeFiles/vtk-compile-tools.dir/build.make:102 : la recette pour la cible « CMakeExternals/Prefix/vtk-compile-tools/src/vtk-compile-tools-stamp/vtk-compile-tools-configure » a échouée
make[2]: *** [CMakeExternals/Prefix/vtk-compile-tools/src/vtk-compile-tools-stamp/vtk-compile-tools-configure] Erreur 1
CMakeFiles/Makefile2:95 : la recette pour la cible « CMakeFiles/vtk-compile-tools.dir/all » a échouée
make[1]: *** [CMakeFiles/vtk-compile-tools.dir/all] Erreur 2
Makefile:75 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2`

所以我认为这可能与我的配置是使用 windows cmake 完成的事实有关,所以我尝试使用 cygwin cmake,但是当我这样做时出现以下错误:

 cmake .
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
CMake Error at C:/Users/Lonni/VTK/VTK-6.2.0/CMakeLists.txt:28 (project):
  The CMAKE_C_COMPILER:

    C:/Strawberry/c/bin/gcc.exe

  is not a full path and was not found in the PATH.

  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.


CMake Error at C:/Users/Lonni/VTK/VTK-6.2.0/CMakeLists.txt:28 (project):
  The CMAKE_CXX_COMPILER:

    C:/Strawberry/c/bin/g++.exe

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_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 "/cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeError.log".

现在我知道我完全是新手,但我有点卡在这里,到目前为止,我在网上搜索的所有内容都没有任何帮助。

提前感谢您的帮助。

编辑:如果我配置为使用 /cygdrive/c/Strawberry/c/bin/gcc.exe 而不是 /cygdrive/c/Strawberry/c/bin/gcc.exe 我确实会得到同样的错误,只有路径已更新

 cmake .
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /cygdrive/c/Strawberry/c/bin/gcc.exe
-- Check for working C compiler: /cygdrive/c/Strawberry/c/bin/gcc.exe -- broken
CMake Error at /usr/share/cmake-3.1.2/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/cygdrive/c/Strawberry/c/bin/gcc.exe" is not able to
  compile a simple test program.

 It fails with the following output:

   Change Dir: /cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp



  Run Build Command:"C:/Strawberry/c/bin/gmake.exe"
  "cmTryCompileExec1614361486/fast"

  C:/Strawberry/c/bin/gmake -f
  CMakeFiles/cmTryCompileExec1614361486.dir/build.make
  CMakeFiles/cmTryCompileExec1614361486.dir/build

  gmake[1]: Entering directory
  'C:/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp'

  /usr/bin/cmake.exe -E cmake_progress_report
  /cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object
  CMakeFiles/cmTryCompileExec1614361486.dir/testCCompiler.c.o

  /cygdrive/c/Strawberry/c/bin/gcc.exe -o
  CMakeFiles/cmTryCompileExec1614361486.dir/testCCompiler.c.o -c
  /cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp/testCCompiler.c

  CMakeFiles/cmTryCompileExec1614361486.dir/build.make:57: recipe for target
  'CMakeFiles/cmTryCompileExec1614361486.dir/testCCompiler.c.o' failed

  gmake[1]: Leaving directory
  'C:/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp'

  gcc.exe: error:
  /cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp/testCCompiler.c:
  No such file or directory

  gcc.exe: fatal error: no input files

  compilation terminated.

  gmake[1]: ***     [CMakeFiles/cmTryCompileExec1614361486.dir/testCCompiler.c.o]
 Error 1

      Makefile:118: recipe for target 'cmTryCompileExec1614361486/fast' failed

  gmake: *** [cmTryCompileExec1614361486/fast] Error 2


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  C:/Users/Lonni/VTK/VTK-6.2.0/CMakeLists.txt:28 (project)


CMake Error at C:/Users/Lonni/VTK/VTK-6.2.0/CMakeLists.txt:28 (project):
  The CMAKE_CXX_COMPILER:

    C:/Strawberry/c/bin/g++.exe

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!

我猜我需要对路径做点什么,但我不知道这是否真的是解决方案。如果需要,这是我的路径

 echo $PATH
 /usr/bin/:/usr/local/bin:/usr/bin:/usr/bin:/cygdrive/c/Program Files/MicrosoftMPI/Bin:/cygdrive/c/Perl64/site/bin:/cygdrive/c/Perl64/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Java/jdk1.8.0_45/bin:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files (x86)/CMake/bin:/cygdrive/c/Program Files/doxygen/bin:/cygdrive/c/Strawberry/c/bin:/cygdrive/c/Strawberry/perl/site/bin:/cygdrive/c/Strawberry/perl/bin:/cygdrive/c/Users/Lonni/Dev Utilities/gluegen/gluegen-2.3-b858-20150410-windows-amd64/gluegen-2.3-b858-20150410-windows-amd64/jar/gluegen-rt.jar:/cygdrive/c/Users/Lonni/Dev Utilities/jogl-2.3-b1392-20150410-windows-amd64/jogl-2.3-b1392-20150410-windows-amd64/jar/atomic/jogl.jar:/cygdrive/c/Program Files (x86)/Git/cmd:/cygdrive/c/Tcl/bin:/usr/bin:/cygdrive/c/Program Files/Microsoft MPI/Bin:/cygdrive/c/Perl64/site/bin:/cygdrive/c/Perl64/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Java/jdk1.8.0_45/bin:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files (x86)/CMake/bin:/cygdrive/c/Program Files/doxygen/bin:/cygdrive/c/Strawberry/c/bin:/cygdrive/c/Strawberry/perl/site/bin:/cygdrive/c/Strawberry/perl/bin:/cygdrive/c/Users/Lonni/Dev Utilities/gluegen/gluegen-2.3-b858-20150410-windows-amd64/gluegen-2.3-b858-20150410-windows-amd64/jar/gluegen-rt.jar:/cygdrive/c/Users/Lonni/Dev Utilities/jogl-2.3-b1392-20150410-windows-amd64/jogl-2.3-b1392-20150410-windows-amd64/jar/atomic/jogl.jar:/cygdrive/c/Program Files (x86)/Git/cmd:/usr/lib/lapack

【问题讨论】:

  • C:/cygwin64/bin/cc 存在吗? C:/Strawberry/c/bin/gcc.exe 存在吗?
  • 如果您将第二个示例配置为 /cygdrive/c/Strawberry/c/bin/gcc.exe 而不是 C:/Strawberry/c/bin/gcc.exe 它可能会起作用。前者显然存在权限问题,但不清楚是什么。如果你手动运行命令,它会告诉你更多关于发生了什么吗?
  • 问题更新了
  • /cygdrive/c/Users/Lonni/VTK/BuildCyg2/CMakeFiles/CMakeTmp/testCCompiler.c 存在吗? (我希望 cmake 能够即时创建它,所以现在可能不会,但应该在测试期间。)
  • 不,它不存在。但我想它会在所有首先失败的测试之后创建,不是吗?

标签: cmake cygwin gnu-make vtk


【解决方案1】:

对于 cywin make:只需将要构建的源代码移动到 cygwin 目录或某个子文件夹(例如:“c:\cygwin64\some_dir”)。

【讨论】:

    猜你喜欢
    • 2011-04-13
    • 1970-01-01
    • 2016-04-22
    • 2021-08-15
    • 1970-01-01
    • 2017-09-15
    • 1970-01-01
    • 1970-01-01
    • 2018-03-15
    相关资源
    最近更新 更多