No announcement yet.

Gentoo stage4 with musl and libc++ (clang, no gcc)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Gentoo stage4 with musl and libc++ (clang, no gcc)

    I thought I could share this here too:

    Basically started off from the musl libc stage3 vanilla gentoo image, re-bootstrapped the whole system to use clang and libc++ instead of gcc and libstdc++ (some very annoying circular dependencies to take care of). One annoying issue is that the llvm project does not provide crt{begin,end} which are needed to eliminate libgcc.

    My personal aim with this stage4 (run in chroot, not yet booting / self-hosting since I have not made a llvmlinux ebuild yet) is to replace as many things as possible in a gentoo base system with alternative implementations.

    glibc-->musl (from the musl stage3)
    gcc(libstdc++) --> clang(libc++)

    lld installed, but not sure if it is possible to use as standard linker yet
    lots of stuff TODO, but others might want to take this early result in different directions which is why I want to share it now already.

  • #2
    I just realized that I had to share the download url with the key!g7oV2ZTA!Z3xWJwlsK...0M18ZIrpnaNf70

    I made that update as a reply to the mailing list (sha256sums in the original mail linked above), I also put it here.
    sorry about that


    • #3
      The stage4 is now potentially self-hosting with llvm-patched linux!

      This means that it is possible to build a complete Gentoo system with only clang without any gcc.


      • #4
        Thanks, downloaded it.


        • #5
          Originally posted by aht0 View Post
          Thanks, downloaded it.
          Cool! Let me know what you think

          I have now also placed the crt* files needed to replace libgcc if one wants a self-hosting Clang system without gcc in a sepparate source repository:

          Also, a heads up / warning. I am running several parallel experiments in this image apart from replacing gcc with clang:

          * openssl replaced with libressl

          * readline replaced with libedit (bash had to be built with the built-in readline implementation)

          * nano --> vim : I also use vim as default pager (replaced "less") and manpager, w3m as html pager

          * several packages in "@system" (findutils, gawk, grep, iputils, man-db, psmisc, sed, wget, which) replaced with symlinks to busybox

          All of these changes are trivial to revert in order to build the system that you want
          Last edited by staalmannen; 05-09-2017, 03:17 AM.


          • #6
            I have tried your stage4, but some packages complain for not having gcc-config saying could not run/locate 'x86_64-gentoo-linux-musl-gcc' and gcc-config -l says no active profile...

            linux-headers complain about it and many others... Is there any way to work around this?


            • #7
              Someone followed up on this work and there is a new self-hosting system using only LLVM tools (clang, libc++, llvm-binutils)!



              • #8
                Probably a more official announcement: