Skip to content

Add crosstool-ng-build-rootfs.sh for cross-compilation - #17867

Open
am11 wants to merge 5 commits into
dotnet:mainfrom
am11:patch-20
Open

am11 wants to merge 5 commits into
dotnet:mainfrom
am11:patch-20

Conversation

@am11

@am11 am11 commented Dec 3, 2026

Copy link
Copy Markdown
Member

This script builds a distro-free glibc rootfs for cross-compiling with clang, including dependencies like gcc, glibc, and others. It manages downloads, configurations, and installations for various architectures.

This script builds a distro-free glibc rootfs for cross-compiling with clang, including dependencies like gcc, glibc, and others. It manages downloads, configurations, and installations for various architectures.
@am11

am11 commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

am11 and others added 4 commits December 4, 2026 02:55
Updated script to support building musl rootfs alongside glibc. Adjusted usage instructions and dependency handling for libc selection.
The strip step passed every `*.so*`, `*.a` and `*.o` file to a single `llvm-strip` call. Some of them are linker scripts (`libc.so`, `libpthread.so`, `libm.a`, ...), and `llvm-strip` stops at the first file that isn't an object, so everything after it kept its debug info. The error was hidden, and how much got stripped depended on `find` order.

Strip only ELF objects and archives instead. On Ubuntu 24.04 this takes the x64 rootfs from 200 MB to 92 MB, arm64 from 213 MB to 87 MB and riscv64 from 212 MB to 138 MB.

Co-authored-by: Cursor <cursoragent@cursor.com>
The runtime uses the loongarch64 signal context definitions (`FPU_CTX_MAGIC`, `struct sctx_info`, `struct fpu_context`) that musl added in 1.2.6. It also matches the musl version in the current Alpine edge based loongarch64 image.

Co-authored-by: Cursor <cursoragent@cursor.com>
@am11

am11 commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Also included musl libc support (from dotnet/dotnet-buildtools-prereqs-docker#1855).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant