Bug 15924 - multiple compiler runtimes dev packages from build host may result in clang-native not filing libstdc++
Summary: multiple compiler runtimes dev packages from build host may result in clang-n...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 5.3
Hardware: All Multiple
: Undecided normal
Target Milestone: 0.0.0
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-07-03 17:40 UTC by Khem Raj
Modified: 2025-07-10 14:32 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Yes (doc changes required)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Khem Raj 2025-07-03 17:40:00 UTC
Clang driver finds compiler runtime and tools like linker on install host and uses the latest gcc runtime if multiple gcc installations exist e.g. on ubuntu 24.04 host if gcc-13 ( default ) and gcc-14 are installed, it will configure the clang invocation to use gcc-14, now if gcc-14 is not installing c++ runtime then it will not find -lstdc++ because driver instructed it to use gcc-14 libs/headers/runtime. Technically this is right thing to do, mixing runtimes e.g. using libgcc from gcc13 and libstdc++ from gcc14 is worse condition, since it can result in weird runtime behaviors which will be harder to debug.

This can be seen when build compiler-rt-native on a ubuntu 24.04 worker host on autobuilder. The configuration of that machine installs gcc-13 c/c++ ( default runtime and development files ) fully, but installs gcc-14 partially ( without c++ runtime development files ). In this system we can see that clang-native when probing for configure tests bails out because it can not link a simple C++ program. The reason being it not being able to find libstdc++ due to above reasons.

This problem is not seen on vanilla ubuntu 24.04 systems with OE pre-requisites.

We can try to do some fixes in toolchains to pretend smart and make compiler do additional probing to look into other locations e.g. default c++ runtime or uninative runtime but that had a potential downside of mixing runtimes and create another can of worms.

A slightly better approach could be to instruct the user to isntall the pre-requisites properly, if they have systems installed with non default toolchains then they should install C/C++ runtime and development headers fully.

Perfect option would be to not rely on build host provides toolchain at all and provide fully functional native C/C++ toolchain via bultools tarball or some such and make it a pre-requisite to build OE, this will get rid of all these kind of inconsistencies and even better if native compiler binaries are statically linked, it will become truly host independent.
Comment 1 Richard Purdie 2025-07-10 14:32:41 UTC
Issue was caused by emacs pulling in emacs-gtk which leads to libgcc-14-dev on Ubuntu 24.04 despite gcc being version 13.

We've added a sanity test for this problem and removed emacs from those workers:

https://git.yoctoproject.org/poky/commit/?id=0a9668e192e04ddccb29d6ba271213c708d01066