[libcxx] r294553 - [libcxx][CMake] Support in-tree libunwind when building as part of runtimes

Hi Asiri,

Did you fix the issue when building libcxx and libcxxabi use LLVM's libunwind?

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170206/184841.html

I experienced the similar issue:

CMake Error at projects/libcxxabi/src/CMakeLists.txt:163 (target_link_libraries):
Target "unwind" of type UTILITY may not be linked into another target. One
may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.

CMake Error at projects/libcxxabi/src/CMakeLists.txt:197 (target_link_libraries):
Target "unwind" of type UTILITY may not be linked into another target. One
may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.

...

CMake Error at projects/libcxx/lib/CMakeLists.txt:244 (target_link_libraries):
Target "unwind" of type UTILITY may not be linked into another target. One
may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.

CMake Error at projects/libcxx/lib/CMakeLists.txt:268 (target_link_libraries):
Target "unwind" of type UTILITY may not be linked into another target. One
may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

My cmake option:

$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/loong-llvm \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_C_COMPILER=/opt/loong-llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/opt/loong-llvm/bin/clang++ \
-DCMAKE_C_FLAGS="-fPIC" \
-DCMAKE_CXX_FLAGS="-std=c++11 -fPIC" \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_EH=ON \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_BUILD_DOCS=OFF \
-DLLVM_ENABLE_SPHINX=OFF \
-DLLVM_ENABLE_DOXYGEN=OFF \
-DLLDB_DISABLE_LIBEDIT=1 \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
-DFFI_LIBRARY_DIR:PATH="$(pkg-config --variable=libdir libffi)" \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \
-DLIBUNWIND_ENABLE_SHARED=OFF \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
-DLLVM_DEFAULT_TARGET_TRIPLE="mips64el-redhat-linux" \
-DCLANG_VENDOR="Loongson"

Regards,

Leslie Zhai

Hi Asiri,

Did you fix the issue when building libcxx and libcxxabi use LLVM's libunwind?

Fixed :slight_smile:

Just put libcxx, libcxxabi, libunwind and compiler-rt under `runtimes` directory.

Leslie Zhai