dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
105 stars 18 forks source link

Stage2 clang: llvm-tblgen will not compile #76

Closed dslm4515 closed 1 year ago

dslm4515 commented 1 year ago

Under chroot, LLD and clang will not compile because llvm-tblgen fails to compile:

[14/22] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenHwModes.cpp.o
In file included from /sources/llvm-project-15.0.5.src/llvm/utils/TableGen/DAGISelMatcherOpt.cpp:14:
/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenDAGPatterns.h:1046:23: error: expected expression
    return Operands[ON];
                      ^
1 error generated.
dslm4515 commented 1 year ago

Source for TableGen builds fine if built with the stage0 clang

dslm4515 commented 1 year ago

Perhaps, stage1 should have been compiled from source that wasn't patched to use the dynamic loader at /llvmtools/lib and the packages built for llvmtools will then need to have the executables patched with the dynamic loader at /llvmtools/lib

dslm4515 commented 1 year ago

^ Tried it. Same exact errors.

Tried the GCC+libstdc++ built for llvmtools: Same error.

dslm4515 commented 1 year ago

But yet, stage0 clang can be reconfigured to build stage2 for the final system.

If so, was there a reason for building stage1 clang?

dslm4515 commented 1 year ago

For now, stage0 will build stage2 clang. This change is introduced with commit 550cf2c3fc9990ea85f367d0215912214f7e0eb2

I may end up moving stage0 clang from cgnutools to llvmtools:

  1. Build mussel to produce cross-gcc
  2. Use cross-gcc to build stage0 clang and install in llvmtools
  3. Use stage0 clang to build rest of llvmtools
  4. Enter chroot. Build final system clang with stage0 clang

If successful, this would reduce build time as clang [& friends] will be built only twice as stage0 and final system compiler... instead of 3 times.

Interestingly, stage0 clang runs both on the host [glibc] and under chroot [musl]