For me, Gentoo Prefix is one of the most interesting open-source projects. It helps me install a complete Gentoo-system under random folder (as long as you can write to it) on many OSes (macOS, Linux, Solaris) and many archtechtures (arm64, x86_64, etc.). The system is managed by portage, so I can leverage the already-existing gentoo repository and even enpower it with overlays to form a unique system.1

To bootstrap prefix easily, currently you need However, it only officially supports bootstraping with gcc-stuffs on most OSes (except macOS). However (again), since it is Gentoo, you can switch to a nearly pure llvm Prefix with modifications on its profile. Why not enjoy a pure-llvm and diversed system without potentially damaging your host? Let’s try it!

Mostly importantly, because it will not to be compatible to your host-stuffs, it is potentially easily to make some Prefix-related bugs to smoke. Possibly a good chance to improve the project?



to divide it into steps:

  1. you bootstrap a vanilla prefix on your system under ${EPREFIX},
  2. you emerge sys-devel/clang,
  3. you prepare a profile, which overrides the default gcc-stuff 2,
  4. you switch to the new profile,
  5. you emerge clang-runtime clang-common llvm clang lld again,
  6. you will get a pure llvm Gentoo Prefix,
  7. if you want to, re-emerge the world (or unmerge+re-emerge things when they complain about the system, for example cmake).

special notes

  • for 3. you just need to create a parent file, which points to a genuine prefix profile and the features/llvm profile (e.g. 2),
  • for 4. and 5. each time clang does not work, please feel free to switch back to the profile of gcc, and re-emerge clang,
  • you still need to keep the old gcc stuff, so that it can rescue the Prefix when clang cannot behave itself.
  • sys-libs/glibc seems not working well, please compile it with gcc

fun-stuffs you can play with llvm

compile flags

Add more stuffs like -flto=thin -O3 to your ${CFLAGS} etc.


Technically, flang can replace gfortran and makes your system more unique.


To try musl and even llvm-libc in the future.

my system

         -/oyddmdhs+:.                       @ 
     -odNMMMMMMMMNNmhy+-`             --------- 
   -yNMMMMMMMMMMMNNNmmdhy+-           OS: 
 `omMMMMMMMMMMMMNmdmmmmddhhy/`        Host: 
 omMMMMMMMMMMMNhhyyyohmdddhhhdo`      Kernel: 6.1.19-gentoo-x86_64 
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`    Uptime: 31 days, 23 hours, 17 mins 
 oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.   Packages: 265 (emerge) 
  :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh   Shell: bash 5.1.16 
    .:+sydNMMMMMNNNmmmdddhhhhhhmMmy   Resolution: 1024x768 
       /mMMMMMMNNNmmmdddhhhhhmMNhs:   Theme: Adwaita [GTK3] 
    `oNMMMMMMMNNNmmmddddhhdmMNhs+`    Icons: Adwaita [GTK3] 
  `sNMMMMMMMMNNNmmmdddddmNMmhs/.      Terminal: startprefix 
 /NMMMMMMMMNNNNmmmdddmNMNdso:`        CPU: 
+MMMMMMMNNNNNmmmmdmNMNdso/-           GPU: 
yMMNNNNNNNmmmmmNNMmhs+/-`             Memory: 

note the libc++{,abi}.so

# ldd /opt/lumiere/usr/bin/eix (0x00007fffa3520000) => /opt/lumiere/usr/lib64/ (0x00007f84205ce000) => /opt/lumiere/usr/lib64/ (0x00007f842058d000) => /opt/lumiere/lib64/ (0x00007f84204e1000) => /opt/lumiere/usr/lib64/ (0x00007f84204d5000) => /opt/lumiere/lib64/ (0x00007f842030d000)
        /opt/lumiere/lib64/ (0x00007f842084b000)

  1. mpv,flang,scipy etc. on macOS arm64 ↩︎

  2. the llvm profile ↩︎ ↩︎