dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
99 stars 18 forks source link
clang lfs llvm musl musl-libc

CMLFS - Clang Musl Linux From Scratch

CMLFS can either mean "Clang-built Musl Linux from Scratch" or "Clang MLFS". It started as a hobby to see if a Linux system can be built with clang as primary toolchain and GCC as secondary (for packages that cannot be built with clang). This is based on Linux From Scratch and my previous work MLFS. Big thanks to Chimera-Linux that had patches that fixed a lot of issues.

DISCLAIMER

Use at you own risk. This builds a Unix-like system that may not be stable enough as a 'daily driver' for most users. Security-hardening of the built system is beyound the scope of this project. This repo started as means to backup and archive my work.

Getting Started

The master branch may be unstable when I am working on upgrading CMLFS.

To build this project, pick a branch other than master OR choose a tag. Each branch & tag are based on the LLVM version. As of this writing, llvm-15.0.6 is stable. Older branches maybe incomplete or unstable (may not compile).

When I have time later, I will write a more thorough introduction for users new to CMLFS.

Specification

Supported Architectures

Goals

Host System Requirements

Required Base Development tools (may refer to LFS)

Current Method

Build 'cross-tools' with Mussel to cross-compile a stage0 LLVM+clang. This stage0 clang will still link to libgcc_s [in cgnutools] but will later be used to build a stage1 clang free of libbgcc_s. The goal is to build clang+friends with clang and not GCC.

  1. Bootstrap build of cgnutools with mussel
  2. Use mussel-built toolchain (cgnutools) to build stage0 LLVM+clang
  3. Use cgnutools to build stage1 LLVM+clang with sysroot at llvmtools with stage0 LLVM+clang
  4. Build enough of llvmtools to enter a chroot with stage1 LLVM+clang
  5. Build the rest of llvmtools under chroot
  6. Build final system with llvmtools

Issues

Change log

Projects of Interest