dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail at Stage-0 (1-Mussel)

emrakyz opened this issue · comments

The script (1-Mussel) fails for running Mussel. Nothing happens after fetching the packages.

If I don't use the specificed "git checkout", then it works and it compiles successfully (I have installed b3sum myself).

But in that case, we have errors on "7-LLVM.stage0".

Note: switching to '26c50d6362731bc54ca9f92ac31b3f95e885c3c7'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 26c50d6 Update binutils, linux, mpc and mpfr
bash:      5.2.15(1)-release
bc:        1.07.1
binutils:  2.41 p2) 2.41.0
bison:     3.8.2
bzip2:     1.0.8
ccache:    4.8.3
coreutils: 9.4
diffutils: 3.10
findutils: 4.9.0
g++:       13.2.1_p20230826
gawk:      5.2.2
gcc:       13.2.1_p20230826
git:       2.42.0
glibc:     releas
grep:      3.11
gzip:      1.13
linux:     6.5.5-gentoo
lzip:      1.23
m4:        1.4.19
make:      4.4.1
perl:      5.38.0
rsync:     3.2.7
sed:       4.9
tar:       1.35
texinfo:   7.0.3
xz:        5.4.4
zstd:      Yann
patching file mussel.sh

+=======================================================+
| mussel.sh - The fastest musl libc Toolchain Generator |
+-------------------------------------------------------+
|      Copyright (c) 2020-2023, Firas Khalil Khana      |
|     Distributed under the terms of the ISC License    |
+=======================================================+

Target Architecture:            x86-64

Optional C++ Support:           yes
Optional Linux Headers Support: yes
Optional OpenMP Support:        yes
Optional Parallel Support:      yes
Optional pkg-config Support:    yes

.. Creating the sources directory...
.. Creating the builds directory...

.. Fetching binutils-2.40.tar.lz...
binutils-2.40.tar.lz                  100%[=======================================================================>]  23.64M  4.24MB/s    in 5.5s    
.. Verifying binutils-2.40.tar.lz...
binutils-2.40.tar.lz: OK
.. Unpacking binutils-2.40.tar.lz...
=> binutils-2.40.tar.lz prepared.

.. Fetching gcc-12.2.0.tar.xz...
gcc-12.2.0.tar.xz                     100%[=======================================================================>]  80.72M  4.88MB/s    in 17s     
.. Verifying gcc-12.2.0.tar.xz...
gcc-12.2.0.tar.xz: OK
.. Unpacking gcc-12.2.0.tar.xz...
=> gcc-12.2.0.tar.xz prepared.

.. Fetching gmp-6.2.1.tar.zst...
gmp-6.2.1.tar.zst                     100%[=======================================================================>]   2.00M  4.86MB/s    in 0.4s    
.. Verifying gmp-6.2.1.tar.zst...
gmp-6.2.1.tar.zst: OK
.. Unpacking gmp-6.2.1.tar.zst...
=> gmp-6.2.1.tar.zst prepared.

.. Fetching isl-0.25.tar.xz...
isl-0.25.tar.xz                       100%[=======================================================================>]   1.88M  1.10MB/s    in 1.7s    
.. Verifying isl-0.25.tar.xz...
isl-0.25.tar.xz: OK
.. Unpacking isl-0.25.tar.xz...
=> isl-0.25.tar.xz prepared.

.. Fetching linux-6.1.7.tar.xz...
linux-6.1.7.tar.xz                    100%[=======================================================================>] 128.54M  5.16MB/s    in 31s     
.. Verifying linux-6.1.7.tar.xz...
linux-6.1.7.tar.xz: OK
.. Unpacking linux-6.1.7.tar.xz...
=> linux-6.1.7.tar.xz prepared.

.. Fetching mpc-1.3.1.tar.gz...
mpc-1.3.1.tar.gz                      100%[=======================================================================>] 755.44K  2.65MB/s    in 0.3s    
.. Verifying mpc-1.3.1.tar.gz...
mpc-1.3.1.tar.gz: OK
.. Unpacking mpc-1.3.1.tar.gz...
=> mpc-1.3.1.tar.gz prepared.

.. Fetching mpfr-4.2.0.tar.xz...
ownership of '/mnt/cmlfs/cgnutools' retained as cmlfs
mv: cannot stat '/cgnutools/usr/lib/*': No such file or directory
mv: cannot stat '/cgnutools/usr/include/*': No such file or directory
ln: failed to create symbolic link '/cgnutools/usr/lib': No such file or directory
ln: failed to create symbolic link '/cgnutools/usr/include': No such file or directory
bash: /cgnutools/lib/gcc/x86_64-pc-linux-musl/12.2.0/specs: No such file or directory
bash: /cgnutools/bin/x86_64-pc-linux-musl-gcc: No such file or directory
bash: x86_64-pc-linux-musl-gcc: command not found
readelf: Error: 'a.out': No such file
'/mnt/cmlfs/sources/mussel/log.txt' -> '/cgnutools/mussel_build.log'

Please look at commit fa87d21

commit 26c50d6362731bc54ca9f92ac31b3f95e885c3c7 of mussel has an old URL for mpfr.

Please use branch llvm-15.0.6 as I am using branch master to begin work on upgrading CMLFS to llvm-16.0.6

GCC 13.x.x+ cannot compile LLVM-15.0.6. LLVM-15.0.6 will need additional patches. That is why branch llvm-15.0.6 will stay on using GCC 12.2.0.

As of today, branch llvm-15.0.6 should successfully build cgnutools and llvmtools.

Thanks for really quick response.

Can I use Clang/LLVM 17.0.1 or Clang/LLVM 16.0.6 instead of using GCC-12?

Or do I have to compile GCC 12.2.0 on my Gentoo host machine and then start with CMLFS?

I haven't tested the patches from Chimera Linux to build CMLFS with LLVM 16/17.

For now, cgnutools has to be built to have GCC-12, in order to compile LLVM-15.0.6.

For your case: No need to compile GCC 12.2.0 on your own. Use the existing GCC version that your Gentoo host machine has in order to build mussel [ using commit 26c50d6362731bc54ca9f92ac31b3f95e885c3c7 & fixing the mpfr URL in the script ]. The mussel toolchain will have GCC 12.2.0 and will be able to compile LLVM-15.0.6 for CMLFS.

Firasuke perfected mussel script to build with recent GCC versions [11 and newer, I think?].

For reference, I test my CMLFS & MLFS builds on previous CMLFS/MLFS builds

Oh I got it Mussel also fetches GCC on its own.

1. I will use LLVM-15.0.6 branch for this repo.
2. I'll use commit 26c50d6362731bc54ca9f92ac31b3f95e885c3c7 for Mussel along with the new mpfr URL (as stated on "LLVM-15.0.6" branch)
3. I'll use GCC 13 on my machine as a host compiler.

Thanks again!

Some extra questions just to clarify things:

You provide no instructions for "Patches" and "Files" directories. I simply copied their content into /mnt/cmlfs/sources/{corresponding_directories}.

Plus your scripts for patching is also problematic if I don't misunderstand their correct usage.

Let's say I use tar to decompress llvm-project and I "cd" into the extracted directory.

I am at: /mnt/cmlfs/sources/pkgs/llvm-project-15.0.6.src

If I use: patch -Np1 -i ../patches/llvm1506-cmlfs/modify-toolchain-dynamic-loader.llvmtools.patch

It naturally fails because ".." is /mnt/cmlfs/sources/pkgs/

Instead I need to use patch -Np1 -i ../../patches*

Do I miss something?

I can of course write a script with "sed" or copy the patches directory into pkgs directory but I want to make sure if something is wrong before too late.

Good questions!

This repo is a backup of my personal work. I never thought anyone would want to use it.

I didn't put instructions on how to copy over the files and patches. I suppose I should.

My MLFS repo probably better explains how to setup.

The files and patches have to be copied to the "build directory". Here is the layout:

CMLFS # Can be a directory on a file system or a mounted file system
├── cgnutools
├── llvmtools
└── sources # This is the directory to extract source packages like llvm-project-15.0.6.src.tar.xz
    ├── files # This is were all the files are put from the 'files' directory of this repo
    ├── patches # This is were all the patches are put from the 'patches' directory of this repo
    └── pkgs # this is were all the downloaded source packages are stores

Essentially:

cp -r CMLFS/patches/* $CMLFS/sources/patches/
cp -r CMLFS/files/* $CMLFS/sources/files/