如何在 Linux 上编译和安装 libc++
问题:
你想编译和安装 libc++(有时也称为 libcxx),但 CMake 抱怨此错误消息
cmake_error.txt
CMake Error at cmake/Modules/MacroEnsureOutOfSourceBuild.cmake:7 (message):
libcxx requires an out of source build. Please create a separate</em>
build directory and run 'cmake /path/to/libcxx [options]' there.
Call Stack (most recent call first):
CMakeLists.txt:24 (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
CMake Error at cmake/Modules/MacroEnsureOutOfSourceBuild.cmake:8 (message):
In-source builds are not allowed.
CMake would overwrite the makefiles distributed with Compiler-RT.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them.
Call Stack (most recent call first):
CMakeLists.txt:24 (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)解决方案
一旦你知道"out-of-source-build“是什么意思,它实际上很简单:你不能从 libcxx 目录本身执行 cmake,你需要从任何父目录执行它 - 构建将在那里进行。
只需在你喜欢的 shell 中运行此脚本:
build_libcxx.sh
mkdir libc++
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
cmake libcxx
make这会在你当前目录内创建 libc++ 目录,并在其中下载和编译最新的 libc++ SVN trunk。在 libc++ 目录(不是 libcxx!)中运行 sudo make install 全局安装它。
Check out similar posts by category:
Build Systems, C/C++, Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow