[llvm-dev] Compiling libraries for musl-based system

Jacob Carlborg via llvm-dev llvm-dev at lists.llvm.org
Sun Jan 8 03:56:07 PST 2017


On 2017-01-07 13:09, Dmitry Golovin via llvm-dev wrote:
> I'm trying to compile LLVM-based toolchain with musl. My host is x86_64-linux-gnu and my target is x86_64-linux-musl, so I guess it should be considered cross-compiling.
>
> I'm compiling llvm, clang, lld, compiler-rt, libunwind, lib++abi and libc++ using the following cmake options:
>
>     CLANG_DEFAULT_CXX_STDLIB = libc++
>     CLANG_DEFAULT_LINKER = lld
>     CLANG_DEFAULT_RTLIB = compiler-rt
>     LLVM_DEFAULT_TARGET_TRIPLE = x86_64-pc-linux-musl
>     DEFAULT_SYSROOT = /path/to/musl
>     GCC_INSTALL_PREFIX = /path/to/gcc-stub
>     CMAKE_INSTALL_PREFIX = /path/to/llvm
>     CMAKE_BUILD_TYPE = Release
>     CMAKE_CROSSCOMPILING = ON
>     LLVM_TARGET_ARCH = x86_64
>     LLVM_TARGETS_TO_BUILD = X86
>
> The resulting toolchain is able to compile musl and C programs, but I don't know how to compile C++ programs. Resulting libc++ is compiled as shared library with glibc dependency, so it can't be linked with musl binaries. How should I compile libunwind, lib++abi and libc++ for the target system?

Perhaps this could be of help [1]

[1] 
https://blogs.gentoo.org/gsoc2016-native-clang/2016/05/05/build-a-freestanding-libcxx/

-- 
/Jacob Carlborg



More information about the llvm-dev mailing list