13

What I'm trying to achieve is to compile an GNU independent and isolated LLVM toolchain using musl as clib.

Recently LLVM 4.0 has been released with lot's of new cool features, including production ready LLD, so also the linking step could be handled by LLVM.

More or less the stack is:

  • clang
  • llvm
  • lld
  • compiler-rt
  • libcxx
  • libcxxabi
  • musl

Following this, it is actually possible to do so without much patching or such (apart from compiling musl), but sadly, there is no good documentation about that.

Any suggestions?

Stefano Azzalini
  • 1,027
  • 12
  • 21

2 Answers2

5

There is an example of using Clang + Musl together to compile "Hello World" in C here: https://github.com/njlr/portable-cxx

It only requires wget, tar and make to be installed. Clang and Musl are downloaded as part of the build process.

The key is to disable the usual include paths using -nostdinc and then add the Musl ones using -isystem.

sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
3

I was solving the same problem with my NGTC (Non-GNU toolchain) project. Please take a look at my build scripts and patches.

I used this toolchain to build a small Linux distro without any code from GNU project: nenuzhnix.

tpimh
  • 446
  • 2
  • 9
  • 23