Unknown package libcxx and libcxxabi when creating Clang?

I am trying to create Clang with libC ++ from sources. And I'm trying to remove libC ++ in-tree by creating it outside the tree with other components. The recipe I'm using is below.

If I just put libcxx and libcxxabi in a tree, then configure not so that they are not created automatically. I put them in llvm/projects for LLVM lib ++ Standard Library .

In addition, adding make cxx to the recipe does not work, as shown on the LLVM libC ++ Standard Library page. This leads to:

 llvm[0]: Constructing LLVMBuild project information. make: *** No rule to make target `cxx'. Stop. 

When I configure LLVM / Clang with --with-libcxx and --with-libcxxabi :

 # Issued from a scratch 'build' directory, which is next to the 'llvm' directory. ../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi \ $OTHER_OPTIONS --prefix=/usr/local 

then I get the following:

 configure: WARNING: Unknown project (libcxx) won't be configured automatically configure: WARNING: Unknown project (libcxxabi) won't be configured automatically 

libcxx and libcxxabi are literally what LLVM calls them, so I'm not sure which names to use if they are incorrect.

I tried to learn configure , for what the package names should be, but this is not very useful. The following is the logic.

How to configure and create Clang with lib ++ (when lib ++ and lib ++ ABI are in the tree)?


The logic configuration for --with-XXX shown below.

that’s all I can find (its not very useful):

  -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` eval with_$ac_package=\$ac_optarg ;; 

Related links:

And this question is related: When are libC ++ sources needed when creating Clang from sources?

And this is a discussion of the CFE-Dev mailing list: Questions about libC ++ for linux and its git repository (if any) . The thread says unpacking libcxx in llcm/projects ensures that headers are copied, where Clang expects them during make install . But it does not address the --with-XXX question, it does not discuss why libc++ not created, and it does not discuss how to get make install to actually install the libraries.


Recipe for extracting and assembling Clang. It works great, if not , including libcxx and libcxxabi .

 #! /bin/sh # Clang 3.5 recipe. # The script should be run from a scratch directory. # Fetch if [ ! -e llvm-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz fi if [ ! -e cfe-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz fi if [ ! -e compiler-rt-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz fi if [ ! -e libcxx-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/libcxx-3.5.0.src.tar.xz fi if [ ! -e libcxxabi-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/libcxxabi-3.5.0.src.tar.xz fi if [ ! -e clang-tools-extra-3.5.0.src.tar.xz ]; then wget http://llvm.org/releases/3.5.0/clang-tools-extra-3.5.0.src.tar.xz fi # Cleanup echo "Cleaning up artifacts" rm -rf llvm build llvm-3.5.0.src # LLVM echo "Unpacking LLVM" tar xf llvm-3.5.0.src.tar.xz mv llvm-3.5.0.src/ llvm # Clang Front End echo "Unpacking Clang Front End" cd llvm/tools tar xf ../../cfe-3.5.0.src.tar.xz mv cfe-3.5.0.src clang cd ../../ # Compiler RT echo "Unpacking Compiler RT" cd llvm/projects tar xf ../../compiler-rt-3.5.0.src.tar.xz mv compiler-rt-3.5.0.src/ compiler-rt cd ../../ # Extra Tools echo "Unpacking Extra Tools" cd llvm/tools/clang/tools/ tar xf ../../../../clang-tools-extra-3.5.0.src.tar.xz mv clang-tools-extra-3.5.0.src extra cd ../../../../ # libc++ echo "Unpacking libc++" cd llvm/projects tar xf ../../libcxx-3.5.0.src.tar.xz mv libcxx-3.5.0.src/ libcxx cd ../../ # libc++ ABI echo "Unpacking libc++ ABI" cd llvm/projects tar xf ../../libcxxabi-3.5.0.src.tar.xz mv libcxxabi-3.5.0.src/ libcxxabi cd ../../ # Determine if Apple IS_DARWIN=`uname -s | egrep -i -c "Darwin"` if [ $IS_DARWIN -ne 0 ]; then OTHER_OPTIONS=" --enable-libcpp" fi # Configure echo "Configuring build" mkdir -p build cd build ../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi $OTHER_OPTIONS --prefix=/usr/local # Build # 'make cxx' for libc++ is from http://libcxx.llvm.org/ echo "Running make" make cxx make -j2 RET=$? if [ $RET -eq 0 ];then echo "****************************************" read -p "Press [ENTER] to install, or [CTRL]+C to quit" sudo make install fi # **************************************** # **************************************** # Install does not install scan-build and scan-view # Perform the copy, and/or put them on-path #sudo cp llvm/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py /usr/local/bin #sudo 2to3 -w /usr/local/bin/asan_symbolize.py #sudo mkdir /usr/local/bin/scan-build #sudo cp -r llvm/tools/clang/tools/scan-build /usr/local/bin #sudo mkdir /usr/local/bin/scan-view #sudo cp -r llvm/tools/clang/tools/scan-view /usr/local/bin 
+4
source share
2 answers

This is the script that I used to create libcxxabi and libcxx. It uses the previously built Clang (with GCC (4.8.3 in my case) and GCC STL):

 if ( $#argv != 2 ) then echo "Usage: [32|64] <directory>" exit endif set echo on set CMake=<CMake executable> set GCCDir=<recent GCC directory> set LLVMSourceDir=${PWD}/llvm-${LLVM_VERSION}.src set LLVMOutOfTreeSourceDir=${PWD} set LLVMPass1Dir=${PWD}/pass1 set PythonDir=<Python directory> set InstallDir=${PWD}/$argv[2] if ( $argv[1] == 32 ) then set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3/32 set BuildMode="-m32" set LibDirSuffix="" else set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3 set BuildMode="-m64" set LibDirSuffix="64" endif set BuildDir=libcxxabi.build if ( -d ${BuildDir} ) then rm -rf ${BuildDir} endif mkdir ${BuildDir} cd ${BuildDir} ${CMake} \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \ -DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \ -DCMAKE_C_FLAGS=${BuildMode} \ -DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \ -DCMAKE_CXX_FLAGS=${BuildMode} \ -DCMAKE_SHARED_LINKER_FLAGS="-L ${GCC_EHDir}" \ -DCMAKE_STATIC_LINKER_FLAGS="${GCC_EHDir}/libgcc_eh.a" \ -DLLVM_FORCE_USE_OLD_TOOLCHAIN=YES \ -DLLVM_PATH=${LLVMSourceDir} \ -DLIBCXXABI_LIBCXX_INCLUDES=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src/include \ -DLIBCXXABI_LIBCXX_PATH=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src \ -DLIBCXXABI_LIBDIR_SUFFIX=${LibDirSuffix} \ ${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src make make install cd .. set BuildDir=libcxx.build if ( -d ${BuildDir} ) then rm -rf ${BuildDir} endif mkdir ${BuildDir} cd ${BuildDir} ${CMake} \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \ -DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \ -DCMAKE_C_FLAGS=${BuildMode} \ -DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \ -DCMAKE_CXX_FLAGS=${BuildMode} \ -DCMAKE_SHARED_LINKER_FLAGS="-L ${GCCDir}/lib${LibDirSuffix}" \ -DLLVM_PATH=${LLVMSourceDir} \ -DLIBCXX_CXX_ABI=libcxxabi \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src/include \ -DLIBCXX_CXX_ABI_LIBRARY_PATH=${InstallDir}/lib \ -DLIBCXX_LIBDIR_SUFFIX=${LibDirSuffix} \ -DLIT_EXECUTABLE=${LLVMSourceDir}/utils/lit/lit.py \ ${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src make make install cd .. 
+3
source

lib ++ and lib ++ abi are not supported for working with configure. I think libC ++ can work if you call it correctly, but there is not even a script configuration for libC ++ abi.

See our docs for using cmake with these projects:

 # In-tree build: # Check out libcxx and libcxxabi into llvm/projects cd llvm mkdir build && cd build cmake .. # Linux may require -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ make cxx 
+2
source

Source: https://habr.com/ru/post/984560/


All Articles