Compiling libraries for musl-based system

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?

Regards,
Dmitry

A two-stage process is needed here, unless your glibc host system
has archives to link libc++ statically, but as it presumably depends
on libstdc++, this might prove to be hard to work around.

Are you doing this for a FreeBSD-like LLVM flavor of Alpine Linux?
I would love to use a beast like that as the next logical step for
a distro that's based on musl libc.

Perhaps this could be of help [1]

[1] Build a freestanding libc++ – GSoC 2016 project