Skip to content

uclibc fix kernel constant tests + docker ci build fixes - #5261

Open
skrap wants to merge 4 commits into
rust-lang:mainfrom
skrap:bugfix/uclibc-docker-ci-build-fixes
Open

uclibc fix kernel constant tests + docker ci build fixes#5261
skrap wants to merge 4 commits into
rust-lang:mainfrom
skrap:bugfix/uclibc-docker-ci-build-fixes

Conversation

@skrap

@skrap skrap commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

Today's uClibc builds in CI cannot test many recently-added linux kernel features, as the prebuilt bootlin toolchains they rely on are built against kernel 5.15.

This changes the ci/install-uclibc.sh script to use a toolchain provided via an environment variable. This allows projects and developers who want to run the uclibc tests to build based on kernel 7.0 headers, and use that toolchain for running the libc build and test in CI.

Best way to test is via:

UCLIBC_TOOLCHAIN_URL=https://github.com/skrap/libc-downstream-ci/releases/download/v0.1-toolchain/arm-buildroot-linux-uclibcgnueabihf_sdk-buildroot.tar.gz  \
LIBC_CI_ZBUILD_STD=1 \
TEST_UCLIBC_TIME64=1 \
RUSTUP_TOOLCHAIN=nightly \
./ci/run-docker.sh armv7-unknown-linux-uclibceabihf

NOTE: the toolchain URL provided above is from my github account and shouldn't be directly included in the source, as I'm sure I would get dinged for bandwidth usage. It's my expectation that developers would build their own or ask nicely to use mine in a responsible way.

Abandoned task: building a toolchain

My first attempt at this PR included building a toolchain from source via buildroot, but that process takes longer than the github action timeout (which seems to be 20 minutes) so I abandoned that approach.

Results

With this change, it's now possible for me to build the libc in a fork of the libc-downstream-ci example posted by @tgross35. See here for example.

Sources

N/A

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot rustbot added A-CI Area: CI-related items ctest Issues relating to the ctest crate labels Jul 7, 2026
@skrap
skrap force-pushed the bugfix/uclibc-docker-ci-build-fixes branch 3 times, most recently from 47c0db9 to 5aa06a0 Compare July 7, 2026 22:24
@skrap skrap changed the title Bugfix/uclibc docker ci build fixes uclibc fix kernel constant tests + docker ci build fixes Jul 8, 2026
@rustbot

This comment has been minimized.

@skrap
skrap force-pushed the bugfix/uclibc-docker-ci-build-fixes branch 2 times, most recently from e689145 to 662559d Compare July 30, 2026 22:39
Jonah Petri added 4 commits July 30, 2026 18:56
The previous CI script used a prebuilt toolchain from bootlin, but this was based on kernel 5.15, which did not contain many of the kernel constants being tested.
@skrap
skrap force-pushed the bugfix/uclibc-docker-ci-build-fixes branch from 662559d to 2454ca6 Compare July 31, 2026 01:21
@skrap
skrap marked this pull request as ready for review July 31, 2026 01:23
@skrap

skrap commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot review

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is involved in preparing the SDK that gets downloaded? I think the current setup is fine enough, but if it's not too bad then I feel like the docker container may as well just build it. Or build it as part of run-docker.sh and copy it into the container to make caching easier.

View changes since this review

Comment thread ci/run-docker.sh
if [ -n "${TEST_UCLIBC_TIME64:-}" ]; then
build_args+=("--build-arg=TEST_UCLIBC_TIME64=1")
export RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_uclibc_time64"
export RUSTFLAGS="${RUSTFLAGS:-} --cfg=libc_unstable_uclibc_time64"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uclibc: move to configurable external prebuilt toolchain": maybe just export RUSTFLAGS="${RUSTFLAGS:-}" at the top of run() so we only need that in one place

CC_armv7_unknown_linux_uclibceabihf=arm-buildroot-linux-uclibcgnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=arm-buildroot-linux-uclibcgnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/"
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/" No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uclibc: move to configurable external prebuilt toolchain": missing trailing \n

@tgross35

tgross35 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

I also think it would be fine to link to your GH URL since libc's frequent CI won't be needing it. But for that, ideally the script should be checked into your repo somewhere (or build+release via GHA?) and the sha could be checked here so it's easy to reproduce.

@tgross35

tgross35 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Also no problem of course but just a heads up, looks like the email you used here isn't linked to your GH account (e.g. https://github.com/rust-lang/libc/commit/3156347e405a3dcb48f1b639ed420681ea897745.patch).

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

Labels

A-CI Area: CI-related items ctest Issues relating to the ctest crate O-arm O-linux O-linux-like O-unix S-waiting-on-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants