Skip to content

kbuild: log compiler version in tuxmake builds#3116

Merged
nuclearcat merged 2 commits into
kernelci:mainfrom
bhcopeland:kbuild-log-clang-version
Jun 12, 2026
Merged

kbuild: log compiler version in tuxmake builds#3116
nuclearcat merged 2 commits into
kernelci:mainfrom
bhcopeland:kbuild-log-clang-version

Conversation

@bhcopeland

@bhcopeland bhcopeland commented Jun 10, 2026

Copy link
Copy Markdown
Member

When investigating a build failure it helps to know the exact
compiler version that produced it, but the build log never shows
one. The job parameters only carry the requested toolchain name
(e.g. clang-21), and with the null runtime tuxmake builds with
whatever compiler the build environment has installed, so the
requested name alone does not describe what actually ran.

Print the compiler's --version into build.log just before the
tuxmake invocation, so the version is visible even when the build
fails. The binary is resolved the same way tuxmake resolves it
(toolchain compiler plus tuxmake's arch-default CROSS_COMPILE)
rather than from the job's cross_compile parameter, because the two
can differ; arc jobs set arc-elf32- while tuxmake builds with
arc-linux-gnu-. Fall back to plain clang when tuxmake is not
importable.

@bhcopeland bhcopeland force-pushed the kbuild-log-clang-version branch from 3f31b8e to bcccd5d Compare June 10, 2026 06:55
@roxell

roxell commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

tuxmake already collects this, it writes compiler.version_full into its metadata.json.
Can't we use that?

@bhcopeland

Copy link
Copy Markdown
Member Author

tuxmake already collects this, it writes compiler.version_full into its metadata.json. Can't we use that?

It does, but I moved to this approach because it won't work for failed builds. We should make a similar change to metadata.json (for structured data).

@roxell

roxell commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

tuxmake already collects this, it writes compiler.version_full into its metadata.json. Can't we use that?

It does, but I moved to this approach because it won't work for failed builds. We should make a similar change to metadata.json (for structured data).

I think we should save and use what we want from tuxmake's metadata.json before we overwrite that with the "new" metadata.json file.

@bhcopeland bhcopeland force-pushed the kbuild-log-clang-version branch from 3fbd096 to b07aba2 Compare June 12, 2026 08:20
@roxell

roxell commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

LGTM, the only thing maybe add tests that goes along with the changes?

When investigating a build failure it helps to know the exact
compiler version that produced it, but the build log never shows
one. The job parameters only carry the requested toolchain name
(e.g. clang-21), and with the null runtime tuxmake builds with
whatever compiler the build environment has installed, so the
requested name alone does not describe what actually ran.

Print the compiler's --version into build.log just before the
tuxmake invocation, so the version is visible even when the build
fails. The binary is resolved the same way tuxmake resolves it
(toolchain compiler plus tuxmake's arch-default CROSS_COMPILE)
rather than from the job's cross_compile parameter, because the two
can differ; arc jobs set arc-elf32- while tuxmake builds with
arc-linux-gnu-. Fall back to plain clang when tuxmake is not
importable.

Add tests covering the probe placement before the tuxmake
invocation, the tuxmake-based binary resolution and the fallback
behaviour.

Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
Comment thread kernelci/kbuild.py Outdated
if version_full:
metadata["build"]["compiler_version"] = version_full
self._compiler_version = version_full

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.

Maybe create a function def _preserve_tuxmake_metadata() and call that just above the call to self._write_metadata() .

When finalising a build, kbuild replaces tuxmake's metadata.json with
its own, discarding everything tuxmake records about the build
environment (compiler, tools, os, uname and so on). Rename tuxmake's
file to tuxmake_metadata.json before writing ours, following the
existing kselftest_metadata.json convention, and carry
compiler.version_full over as build.compiler_version in metadata.json
and compiler_version in the node data, so the exact compiler version
can reach the API and the dashboard.

Add tests covering the rename, the compiler version carry-over and
the handling of missing, foreign and invalid metadata files.

Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
@bhcopeland bhcopeland force-pushed the kbuild-log-clang-version branch from b07aba2 to 02ed6c9 Compare June 12, 2026 10:17
@bhcopeland

Copy link
Copy Markdown
Member Author

All addressed, thank you very much for your feedback @roxell!

@roxell roxell 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.

LGTM

@nuclearcat nuclearcat added this pull request to the merge queue Jun 12, 2026
Merged via the queue into kernelci:main with commit 6ad0e70 Jun 12, 2026
3 checks passed
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.

3 participants