将编译器更改为Clang

时间:2018-01-08 00:25:48

标签: c++ linux clang llvm-clang

好的,我正在尝试安装WASM组件并且我一直收到此错误我需要做什么?

cmake -DBINARYEN_BIN=~/binaryen/bin -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DCMAKE_CXX_COMPILER=/path/to/c++ -DCMAKE_C_COMPILER=/path/to/cc -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    /path/to/cc

  is not a full path to an existing compiler tool.

  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 "/home/Usr/eos/build/CMakeFiles/CMakeOutput.log".
See also "/home/Usr/eos/build/CMakeFiles/CMakeError.log".

2 个答案:

答案 0 :(得分:0)

解决问题的一步是做错误日志明确建议的内容。

您需要告诉它gcc(或clang)编译器的位置,您可以通过键入which gccwhich clang来找到它,如标题所示。

然后对g++编译器执行相同的操作。

如果您没有其中任何一种,则需要先安装它们。

然后只需将cmake命令中的/path/to/ccpath/to/c++更改为实际路径。

答案 1 :(得分:0)

只需将正确的路径设置为CMAKE_C_COMPILERCMAKE_CXX_COMPILER即可。您可以使用-D

在CMakeLists.txt或命令行中执行此操作