Skip to content

Docker + ubuntu image 编译 emsdk 失败,提示 No CMAKE_CXX_COMPILER could be found #3

@undirectlookable

Description

@undirectlookable

镜像 ubuntu:latest

环境准备, 参考

$ apt update
$ apt install git cmake gcc python

编译

$ git clone https://github.com/juj/emsdk.git
$ cd emsdk
$ ./emsdk install sdk-incoming-64bit binaryen-master-64bit

报错

CMake Error at CMakeLists.txt:47 (project):   No CMAKE_CXX_COMPILER could be found.    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 "/root/emsdk/clang/fastcomp/build_incoming_64/CMakeFiles/CMakeOutput.log". See also "/root/emsdk/clang/fastcomp/build_incoming_64/CMakeFiles/CMakeError.log". CMake invocation failed due to exception! Working directory: /root/emsdk/clang/fastcomp/build_incoming_64 Command '['cmake', '-G', 'Unix Makefiles', '-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DPYTHON_EXECUTABLE=/usr/bin/python', '-DLLVM_TARGETS_TO_BUILD=X86;JSBackend', '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=OFF', '-DCLANG_INCLUDE_TESTS=OFF', '-DLLVM_ENABLE_ASSERTIONS=ON', '/root/emsdk/clang/fastcomp/src']' returned non-zero exit status 1 Installation failed!

解决

官方的入门指南里只提到gcc,但实际也依赖 g++。一步到位可以安装 build-essential,想要精简可以只安装 cmake gccg++

所以,安装 g++ 后重新编译

$ apt install g++

解决。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions