Skip to content

Conversation

@shr-project
Copy link
Contributor

Add it for target builds in:
BASE_DEFAULT_DEPS:append:class-target:toolchain-clang:class-target

because ${MLPREFIX}clang-cross-${TARGET_ARCH} contains a broken symlink to clang binary provided by clang-native and then in case someone changes e.g.

TC_CXX_RUNTIME = "llvm"
to
TC_CXX_RUNTIME:class-target = "llvm"

then both clang-native and clang-cross-${TARGET_ARCH} are correctly rebuilt, but unfortunately the hashequiv output hash of clang-cross-${TARGET_ARCH} doesn't change (because the broken symlink is still the same), so e.g. gptfdisk which depends on "equivalent" clang-cross from BASE_DEFAULT_DEPS doesn't get rebuilt, but then it still links with libc++.so.1 while in clean build without sstate and hashequiv it will link with libstdc++.so.6 (because TC_CXX_RUNTIME affects only clang-native and the override for class-target doesn't work as one might expect).

This might need some bigger changes in hashequiv to have special handlink of broken symlinks in the output, if the symlink target is provided by some dependency, we should include the hash of the symlink target to make sure the outhash changes even when something deeper in dependency tree changed the target binary (or error out when there is no direct dependency of the provider).

clang-cross from oe-core master doesn't have this issue, because it contains the actual binary from clang-native after: openembedded/openembedded-core@3b0128f so the outhash is changed when this binary is changed.

Add it for target builds in:
BASE_DEFAULT_DEPS:append:class-target:toolchain-clang:class-target

because ${MLPREFIX}clang-cross-${TARGET_ARCH} contains a broken symlink
to clang binary provided by clang-native and then in case someone
changes e.g.

TC_CXX_RUNTIME = "llvm"
to
TC_CXX_RUNTIME:class-target = "llvm"

then both clang-native and clang-cross-${TARGET_ARCH} are correctly
rebuilt, but unfortunately the hashequiv output hash of
clang-cross-${TARGET_ARCH} doesn't change (because the broken symlink
is still the same), so e.g. gptfdisk which depends on "equivalent"
clang-cross from BASE_DEFAULT_DEPS doesn't get rebuilt, but then it
still links with libc++.so.1 while in clean build without sstate and
hashequiv it will link with libstdc++.so.6 (because TC_CXX_RUNTIME
affects only clang-native and the override for class-target doesn't
work as one might expect).

This might need some bigger changes in hashequiv to have special
handlink of broken symlinks in the output, if the symlink target is
provided by some dependency, we should include the hash of the symlink
target to make sure the outhash changes even when something deeper
in dependency tree changed the target binary (or error out when there
is no direct dependency of the provider).

clang-cross from oe-core master doesn't have this issue, because it
contains the actual binary from clang-native after:
openembedded/openembedded-core@3b0128f
so the outhash is changed when this binary is changed.

Signed-off-by: Martin Jansa <[email protected]>
Copy link
Owner

@kraj kraj left a comment

Choose a reason for hiding this comment

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

lgtm

@shr-project shr-project marked this pull request as ready for review November 12, 2025 18:12
@shr-project
Copy link
Contributor Author

More proper solution for cross.bbclass:
https://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/hashequiv

will send it to oe-core after more testing, but it will be a while before it gets backported to scarthgap, so this work around might be still useful.

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.

2 participants