libc++ auf Linux kompilieren & installieren

English Deutsch

Problem:

Du möchtest libc++ (manchmal auch libcxx genannt) kompilieren und installieren, aber CMake meldet diesen Fehler:

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)

Lösung

Sobald man weiß, was „out-of-source-build“ bedeutet, ist es eigentlich ziemlich einfach: Man darf CMake nicht aus dem libcxx-Verzeichnis selbst ausführen, sondern aus einem beliebigen übergeordneten Verzeichnis – der Build findet dort statt.

Führe einfach dieses Skript in deiner bevorzugten Shell aus:

build_libcxx.sh
mkdir libc++
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
cmake libcxx
make

Dies erstellt das Verzeichnis libc++ im aktuellen Verzeichnis und lädt den neuesten libc++-SVN-Trunk herunter und kompiliert ihn. Führe sudo make install im libc++-Verzeichnis (nicht in libcxx!) aus, um es global zu installieren.


Check out similar posts by category: Build Systems, C/C++, Linux