【问题标题】:Check for working CXX compiler: /cygdrive/c/cygwin64/bin/clang++ -- broken检查工作的 CXX 编译器:/cygdrive/c/cygwin64/bin/clang++ -- 损坏
【发布时间】:2018-06-22 02:20:26
【问题描述】:

我正在尝试安装 CLion 并让我的编译器工作,但无论我做什么,它都会不断给我上述错误。它能够很好地检测到clang,但它不能检测到clang++。这是什么原因?

完整的错误如下所示:

Check for working CXX compiler: /cygdrive/c/cygwin64/bin/clang++ -- broken
CMake Error at /cygdrive/c/.CLion2018.1/system/cygwin_cmake/share/cmake-3.10.3/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/cygdrive/c/cygwin64/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make.exe" "cmTC_79d96/fast"
    /usr/bin/make -f CMakeFiles/cmTC_79d96.dir/build.make CMakeFiles/cmTC_79d96.dir/build
    make[1]: Entering directory '/cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o
    /cygdrive/c/cygwin64/bin/clang++     -o CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o -c /cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_79d96.exe
    /cygdrive/c/.CLion2018.1/system/cygwin_cmake/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_79d96.dir/link.txt --verbose=1
    /cygdrive/c/cygwin64/bin/clang++    -Wl,--enable-auto-import  CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o  -o cmTC_79d96.exe -Wl,--out-implib,libcmTC_79d96.dll.a -Wl,--major-image-version,0,--minor-image-version,0 
    /cygdrive/c/cygwin64/bin/ld: cannot find -liconv
    clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [CMakeFiles/cmTC_79d96.dir/build.make:98: cmTC_79d96.exe] Error 1
    make[1]: Leaving directory '/cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp'
    make: *** [Makefile:126: cmTC_79d96/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/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeError.log".

这是 CMakeError.log:

 Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
 Compiler: /cygdrive/c/cygwin64/bin/clang++ 
 Build flags: 
 Id flags:  

 The output was:
 1
 /cygdrive/c/cygwin64/bin/ld: cannot find -liconv
 clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

 Determining if the CXX compiler works failed with the following output:
 Change Dir: /cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp

 Run Build Command:"/usr/bin/make.exe" "cmTC_79d96/fast"
 /usr/bin/make -f CMakeFiles/cmTC_79d96.dir/build.make CMakeFiles/cmTC_79d96.dir/build
 make[1]: Entering directory '/cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp'
 Building CXX object CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o
 /cygdrive/c/cygwin64/bin/clang++     -o CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o -c /cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
 Linking CXX executable cmTC_79d96.exe
 /cygdrive/c/.CLion2018.1/system/cygwin_cmake/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_79d96.dir/link.txt --verbose=1
 /cygdrive/c/cygwin64/bin/clang++    -Wl,--enable-auto-import  CMakeFiles/cmTC_79d96.dir/testCXXCompiler.cxx.o  -o cmTC_79d96.exe -Wl,--out-implib,libcmTC_79d96.dll.a -Wl,--major-image-version,0,--minor-image-version,0 
 /cygdrive/c/cygwin64/bin/ld: cannot find -liconv
 clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 make[1]: *** [CMakeFiles/cmTC_79d96.dir/build.make:98: cmTC_79d96.exe] Error 1
 make[1]: Leaving directory '/cygdrive/c/CLionProjects/trivialtest/cmake-build-debug/CMakeFiles/CMakeTmp'
 make: *** [Makefile:126: cmTC_79d96/fast] Error 2

【问题讨论】:

  • 我知道这有点牵强。但是,您是否考虑过发布他们说要查看详细信息的日志?
  • 使用edit,并将其作为引用源代码添加到问题中。
  • @Yakk-AdamNevraumont 完成!输出日志我没有放,因为太长了
  • > 之后添加 5 个空格。引用代码,而不仅仅是引用。我正在打电话或会自己编辑。
  • @Yakk-AdamNevraumont 喜欢这样吗?

标签: c++ cmake cygwin clang++ iconv


【解决方案1】:

如果链接器没有找到-liconv,它正在寻找一个名为libiconv 的库。您可以尝试在 cygwin 安装中安装它。

我的猜测是安装 this package 会有所帮助。

【讨论】:

    【解决方案2】:

    在 2018 年的答案中安装 cygwin32-libiconv 的建议似乎没有帮助,因为它涉及使用 64 位 Cygwin 交叉编译到 32 位。

    相反,要修复 OP 的问题,或者是这样的问题:

      clang++ helloworld.cpp
      /usr/bin/ld: cannot find -liconv
    

    安装libiconv-devel

    更详细地说,Cygwin Package Search for a x86_64 libiconv 提供了几十行,但可能的命中归结为三行,都有相同的描述:

      libiconv:       Unicode iconv() implementation
      libiconv2:      Unicode iconv() implementation
      libiconv-devel: Unicode iconv() implementation
    

    当您查看每个包的完整列表时,您会看到第一个为您提供iconv.exe,第二个为您提供cygiconv-2.dll,最后第三个为您提供/usr/lib/libiconv.a

    相关问题:Error when compiling sphinxbase in cygwin

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-27
      • 1970-01-01
      • 2022-07-12
      • 2019-09-20
      • 2011-06-09
      • 1970-01-01
      相关资源
      最近更新 更多