Commit 093e7087 authored by jan.koester's avatar jan.koester
Browse files

test

parent 6a5eb8a4
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
@@ -115,22 +115,38 @@ ensure_kernel_headers() {
    systemd-nspawn -D "$CHROOT_DIR" --pipe -- bash -c '
        set -e
        apt-get install -y --no-install-recommends linux-libc-dev

        # Copy linux and asm-generic headers
        rm -rf /usr/local/musl/include/linux /usr/local/musl/include/asm-generic /usr/local/musl/include/asm
        cp -a /usr/include/linux /usr/local/musl/include/
        cp -a /usr/include/asm-generic /usr/local/musl/include/
        # Debian stores arch-specific headers under multiarch path
        if [ -d /usr/include/x86_64-linux-gnu/asm ]; then

        # Find arch-specific asm headers using dpkg
        ASM_DIR=$(dpkg -L linux-libc-dev | grep "/asm$" | head -1)
        if [ -n "$ASM_DIR" ] && [ -d "$ASM_DIR" ]; then
            echo "Found asm headers at: $ASM_DIR"
            cp -a "$ASM_DIR" /usr/local/musl/include/
        elif [ -d /usr/include/x86_64-linux-gnu/asm ]; then
            cp -a /usr/include/x86_64-linux-gnu/asm /usr/local/musl/include/
        elif [ -d /usr/include/asm ]; then
            cp -a /usr/include/asm /usr/local/musl/include/
        else
            # Generate minimal asm headers from asm-generic
            echo "WARNING: No asm headers found, generating from asm-generic"
            mkdir -p /usr/local/musl/include/asm
            for f in /usr/local/musl/include/asm-generic/*.h; do
                name=$(basename $f)
                echo "#include <asm-generic/${name}>" > /usr/local/musl/include/asm/${name}
                name=$(basename "$f")
                echo "#include <asm-generic/${name}>" > "/usr/local/musl/include/asm/${name}"
            done
        fi
        echo "==> Kernel headers installed"

        # Verify critical header exists
        if [ ! -f /usr/local/musl/include/asm/types.h ]; then
            echo "ERROR: asm/types.h still missing after install!"
            echo "Contents of linux-libc-dev:"
            dpkg -L linux-libc-dev | grep asm | head -20
            exit 1
        fi
        echo "==> Kernel headers installed (asm/types.h verified)"
    '
}

@@ -190,10 +206,15 @@ setup_toolchain() {
        # LLVM 18 requires the unified runtimes build
        cd /tmp
        LLVM_TAG=llvmorg-${LLVM_VERSION}.1.8
        if [ ! -d /tmp/llvm-project-\${LLVM_TAG} ]; then
            wget -q https://github.com/llvm/llvm-project/archive/refs/tags/\${LLVM_TAG}.tar.gz -O llvm-project.tar.gz
            tar xf llvm-project.tar.gz
        fi
        LLVM_SRC=/tmp/llvm-project-\${LLVM_TAG}

        # Clean stale build to avoid cached failures
        rm -rf /tmp/build-runtimes

        # Unified runtimes build: libunwind + libc++abi + libc++
        mkdir -p /tmp/build-runtimes && cd /tmp/build-runtimes
        cmake \${LLVM_SRC}/runtimes -G Ninja \