Skip to contentSkip to conversation

uutils-coreutils: remove TMPDIR from build output

PATCH Gyorgy Sarvari 3 participants 10 messages Jan 26, 2025 – Mar 7, 2025 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review

Quoted 5 lines
(quoted diff) +2 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = " -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
+                                      -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "

If this patch isn't shot down and you are trying to build this, there is a chance that it will fail: that's because BUILD_LDFLAGS is excluded from base config checksum, so your sscache might conflict with the actual recipe state.

If you want, can send a v2, including a PR-bump, or something along the lines.

#2 lore raw

Hi Gyorgy,
it is nice that you found the root-cause. I had debugged this as part of
https://github.com/uutils/coreutils/issues/6833 , but had not found why the yocto build had this issue and not the normal ubuntu build of uutils-coreutils.
Have you received some feedback regarding this patch?

Étienne

Quoted 28 lines · Gyorgy Sarvari via lists.openembedded.org

Review

Quoted 3 lines
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "

-Wl,-rpath,${STAGING_LIBDIR_NATIVE} \

Quoted 1 line

+

-Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "

Quoted 1 line

If this patch isn't shot down and you are trying to build this, there is a chance that it will fail: that's because BUILD_LDFLAGS is excluded from base config checksum, so your sscache might conflict with the actual recipe state.

If you want, can send a v2, including a PR-bump, or something along the lines.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#115101):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115101&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=1KkFM14R2UQ7JO-6EseQURf5y34LFqkZw0utLRAXoTk&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=YitLjZ8Dz37qUS8nauvE0C8CELqvGUPDhZo4LQ_5PzQ&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=KewRVjyJaNI2vMrB_GXcyi4smxqyuSViorm5-wvLgXQ&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

I haven't heard back anything, but based on my understanding the reason seems to be the wrapper script, created by cargo_common class, which includes config for both host and target.

$UNPACKDIR/cargo_home/config.toml has the following:
[target.x86_64-unknown-linux-gnu]
linker = "${WORKDIR}/wrapper/build-rust-ccld"

And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS, including the rpath ones to gcc, and it invokes it directly a few lines later.

I think you would see the same issue on Ubuntu if you would pass similar rpath arguments via RUSTFLAGS. E.g. if I do

export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"

(which is kinda comparable in a very simplified way to what's going on in the script, in my understanding), then build coreutils on my machine (without Yocto, just my OS), I see the following:

[meeee@desktop release]$ strings coreutils | grep EASY EASY_GREP

Quoted 49 lines · Etienne Cordonnier

Hi Gyorgy,
it is nice that you found the root-cause. I had debugged this as part of https://github.com/uutils/coreutils/issues/6833 , but had not found why the yocto build had this issue and not the normal ubuntu build of uutils-coreutils.
Have you received some feedback regarding this patch?

Étienne

Review

Quoted 3 lines · On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org…
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "
    -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
    > +                                     
    -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
    >
    If this patch isn't shot down and you are trying to build this,
    there is a
    chance that it will fail: that's because BUILD_LDFLAGS is excluded
    from
    base config checksum, so your sscache might conflict with the actual
    recipe state.

    If you want, can send a v2, including a PR-bump, or something
    along the
    lines.

    -=-=-=-=-=-=-=-=-=-=-=-
    Links: You receive all messages sent to this group.
    View/Reply Online (#115101):
    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115101&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=1KkFM14R2UQ7JO-6EseQURf5y34LFqkZw0utLRAXoTk&e=
    <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115101&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=1KkFM14R2UQ7JO-6EseQURf5y34LFqkZw0utLRAXoTk&e=>

    Mute This Topic:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=YitLjZ8Dz37qUS8nauvE0C8CELqvGUPDhZo4LQ_5PzQ&e=
    <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=YitLjZ8Dz37qUS8nauvE0C8CELqvGUPDhZo4LQ_5PzQ&e=>

    Group Owner: [email protected]
    <mailto:openembedded-devel%[email protected]>
    Unsubscribe:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=KewRVjyJaNI2vMrB_GXcyi4smxqyuSViorm5-wvLgXQ&e=
    <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=KewRVjyJaNI2vMrB_GXcyi4smxqyuSViorm5-wvLgXQ&e=> 
    [[email protected]]
    -=-=-=-=-=-=-=-=-=-=-=-
#4 lore raw

I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.

Étienne

Quoted 87 lines · Gyorgy Sarvari

I haven't heard back anything, but based on my understanding the reason seems to be the wrapper script, created by cargo_common class, which includes config for both host and target.

$UNPACKDIR/cargo_home/config.toml has the following:
[target.x86_64-unknown-linux-gnu]
linker = "${WORKDIR}/wrapper/build-rust-ccld"

And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS, including the rpath ones to gcc, and it invokes it directly a few lines later.

I think you would see the same issue on Ubuntu if you would pass similar rpath arguments via RUSTFLAGS. E.g. if I do

export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"

(which is kinda comparable in a very simplified way to what's going on in the script, in my understanding), then build coreutils on my machine (without Yocto, just my OS), I see the following:

[meeee@desktop release]$ strings coreutils | grep EASY EASY_GREP

Quoted 11 lines · Etienne Cordonnier

Hi Gyorgy,
it is nice that you found the root-cause. I had debugged this as part of https://github.com/uutils/coreutils/issues/6833 , but had not found why the yocto build had this issue and not the normal ubuntu build of uutils-coreutils.
Have you received some feedback regarding this patch?

Étienne

On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 17 lines

Review

Quoted 3 lines · <[email protected]> wrote:
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "

-Wl,-rpath,${STAGING_LIBDIR_NATIVE} \
> +
-Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
>
If this patch isn't shot down and you are trying to build this, there is a
chance that it will fail: that's because BUILD_LDFLAGS is excluded from
base config checksum, so your sscache might conflict with the actual recipe state.

Quoted 8 lines

If you want, can send a v2, including a PR-bump, or something along the
lines.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#115101):

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115101&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=1KkFM14R2UQ7JO-6EseQURf5y34LFqkZw0utLRAXoTk&e=

Quoted 1 line
    <

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115101&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=1KkFM14R2UQ7JO-6EseQURf5y34LFqkZw0utLRAXoTk&e=

Quoted 4 lines

Mute This Topic:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=YitLjZ8Dz37qUS8nauvE0C8CELqvGUPDhZo4LQ_5PzQ&e=

Quoted 1 line
    <

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=YitLjZ8Dz37qUS8nauvE0C8CELqvGUPDhZo4LQ_5PzQ&e=

Quoted 6 lines

Group Owner: [email protected] <mailto:openembedded-devel%[email protected]> Unsubscribe:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=KewRVjyJaNI2vMrB_GXcyi4smxqyuSViorm5-wvLgXQ&e=

Quoted 1 line
    <

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=Yru-Hz_1VrJInO_CPayuPmmjTpIq3jyiRHa5Rz7x9MqHysQQnpBZ6NRR143MBmi1&s=KewRVjyJaNI2vMrB_GXcyi4smxqyuSViorm5-wvLgXQ&e=

Quoted 4 lines
    [[email protected]]
    -=-=-=-=-=-=-=-=-=-=-=-
#5 lore raw

Shouldn't it be fixed in do_rust_create_wrappers() rust-common.bbclass ? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if they all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

Quoted 76 lines · Etienne Cordonnier via lists.openembedded.org

I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.

Étienne

Quoted 22 lines · Gyorgy Sarvari

I haven't heard back anything, but based on my understanding the reason seems to be the wrapper script, created by cargo_common class, which includes config for both host and target.

$UNPACKDIR/cargo_home/config.toml has the following:
[target.x86_64-unknown-linux-gnu]
linker = "${WORKDIR}/wrapper/build-rust-ccld"

And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS, including the rpath ones to gcc, and it invokes it directly a few lines later.

I think you would see the same issue on Ubuntu if you would pass similar rpath arguments via RUSTFLAGS. E.g. if I do

export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"

(which is kinda comparable in a very simplified way to what's going on in the script, in my understanding), then build coreutils on my machine (without Yocto, just my OS), I see the following:

Quoted 38 lines

[meeee@desktop release]$ strings coreutils | grep EASY EASY_GREP

Quoted 33 lines · Etienne Cordonnier

Hi Gyorgy,
it is nice that you found the root-cause. I had debugged this as part of https://github.com/uutils/coreutils/issues/6833 , but had not found why the yocto build had this issue and not the normal ubuntu build of uutils-coreutils.
Have you received some feedback regarding this patch?

Étienne

Review

Quoted 3 lines · On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org…
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "

-Wl,-rpath,${STAGING_LIBDIR_NATIVE} \
> +
-Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
>
If this patch isn't shot down and you are trying to build this, there is a
chance that it will fail: that's because BUILD_LDFLAGS is excluded from
base config checksum, so your sscache might conflict with the actual recipe state.

If you want, can send a v2, including a PR-bump, or something along the
lines.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115782): https://lists.openembedded.org/g/openembedded-devel/message/115782
Mute This Topic: https://lists.openembedded.org/mt/110820444/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw

I'm not sure how generic this issue is.
In the case of uutils-coreutils the RPATH is set on libstdbuf.so, and then libstdbuf.so is injected into the rust code (see
https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/src/stdbuf.rs#L34
: const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); )
Thus the value of the RPATH ends up in the coreutils binary, even though the RPATH is not set on the binary itself (by this I mean that objdump -x coreutils |grep 'R.*PATH' does not give any result).

Of course ideally this gets fixed in rust-common.bbclass, but short-term fixing it in uutils-coreutils would be a nice improvement, assuming it is not that generic.

Quoted 99 lines · Martin Jansa

Shouldn't it be fixed in do_rust_create_wrappers() rust-common.bbclass ? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if they all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

Quoted 2 lines · Etienne Cordonnier via lists.openembedded.org

I vote for merging this patch. Maybe with a comment pointing to

build-rust-ccld.

Quoted 4 lines

Étienne

On Thu, Mar 6, 2025 at 5:40 PM Gyorgy Sarvari <[email protected]>

Quoted 22 lines · wrote:
Quoted 22 lines

I haven't heard back anything, but based on my understanding the reason seems to be the wrapper script, created by cargo_common class, which includes config for both host and target.

$UNPACKDIR/cargo_home/config.toml has the following:
[target.x86_64-unknown-linux-gnu]
linker = "${WORKDIR}/wrapper/build-rust-ccld"

And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS, including the rpath ones to gcc, and it invokes it directly a few lines later.

I think you would see the same issue on Ubuntu if you would pass similar rpath arguments via RUSTFLAGS. E.g. if I do

export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"

(which is kinda comparable in a very simplified way to what's going on in the script, in my understanding), then build coreutils on my machine (without Yocto, just my OS), I see the following:

Quoted 8 lines
Quoted 8 lines

[meeee@desktop release]$ strings coreutils | grep EASY EASY_GREP

Quoted 3 lines · Etienne Cordonnier

Hi Gyorgy,
it is nice that you found the root-cause. I had debugged this as part of https://github.com/uutils/coreutils/issues/6833 , but had not

found

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

why the yocto build had this issue and not the normal ubuntu build of uutils-coreutils.
Have you received some feedback regarding this patch?

Étienne

On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Review

Quoted 3 lines · <[email protected]> wrote:
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "
    -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
    > +
    -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
    >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

If this patch isn't shot down and you are trying to build this, there is a
chance that it will fail: that's because BUILD_LDFLAGS is excluded from
base config checksum, so your sscache might conflict with the

actual

Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

recipe state.

If you want, can send a v2, including a PR-bump, or something along the
lines.

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#115782):

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115782&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=mv9-JoFG8rCJwz-zydMCBkgwQK24kuO8Jc5VR2QtK9o&e=

Quoted 1 line

Mute This Topic:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_3617156&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=yVIEBlNAg7gptJo6-HlUmQRo2UhHiEQCHS9U7SXZNmg&e=

Quoted 2 lines

Group Owner: [email protected] Unsubscribe:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=Y78_vGNHT-81F0m1bZ8UtjZIGr8OA6Orx60Wfp5pPO8&e=
[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw

Risking that I'm asking the dumbest question ever: so the cross-compiled binary includes the bytecode of the host-compiled libstdbuf, and it works somehow? Isn't libstdbuf compiled incorrectly? If it is, than my patch just hides the issue, but doesn't fix anything (to my regret). Or is it some rust magic, and I'm out of context?

Quoted 135 lines · Etienne Cordonnier

I'm not sure how generic this issue is.
In the case of uutils-coreutils the RPATH is set on libstdbuf.so, and then libstdbuf.so is injected into the rust code
(see https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/src/stdbuf.rs#L34
: const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); )
Thus the value of the RPATH ends up in the coreutils binary, even though the RPATH is not set on the binary itself (by this I mean
that objdump -x coreutils |grep 'R.*PATH' does not give any result).

Of course ideally this gets fixed in rust-common.bbclass, but short-term fixing it in uutils-coreutils would be a nice improvement, assuming it is not that generic.

On Fri, Mar 7, 2025 at 11:18 AM Martin Jansa <[email protected]> wrote:

Shouldn't it be fixed in do_rust_create_wrappers() rust-common.bbclass ? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if they all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

On Fri, Mar 7, 2025 at 11:06 AM Etienne Cordonnier via lists.openembedded.org <http://lists.openembedded.org>
<[email protected]>
wrote:
>
> I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.
>
> Étienne
>
> On Thu, Mar 6, 2025 at 5:40 PM Gyorgy Sarvari <[email protected]> wrote:
>>
>> I haven't heard back anything, but based on my understanding the reason
>> seems to be the wrapper script, created by cargo_common class, which
>> includes config for both host and target.
>>
>> $UNPACKDIR/cargo_home/config.toml has the following:
>> [target.x86_64-unknown-linux-gnu]
>> linker = "${WORKDIR}/wrapper/build-rust-ccld"
>>
>> And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS,
>> including the rpath ones to gcc, and it invokes it directly a few lines
>> later.
>>
>> I think you would see the same issue on Ubuntu if you would pass similar
>> rpath arguments via RUSTFLAGS. E.g. if I do
>>
>> export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"
>>
>> (which is kinda comparable in a very simplified way to what's going on
>> in the script, in my understanding), then build coreutils on my machine
>> (without Yocto, just my OS), I see the following:
>>
>> [meeee@desktop release]$ strings coreutils | grep EASY >> EASY_GREP
>>
>>
>> On 06.03.25 16:59, Etienne Cordonnier wrote:
>> > Hi Gyorgy,
>> > it is nice that you found the root-cause. I had debugged this as part
>> > of https://github.com/uutils/coreutils/issues/6833 , but had not found
>> > why the yocto build had this issue and not the normal ubuntu build of
>> > uutils-coreutils.
>> > Have you received some feedback regarding this patch? >> >
>> > Étienne
>> >
>> > On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via >> > lists.openembedded.org <http://lists.openembedded.org>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=
<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=>
>
>> > <[email protected]> wrote:
>> >
>> >     > -ERROR_QA:remove = "buildpaths"
>> >     > -WARN_QA:append = " buildpaths"
>> >     > +BUILD_LDFLAGS:remove:class-target = "
>> >     -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
>> >     > +
>> >     -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
>> >     >
>> >     If this patch isn't shot down and you are trying to build this,
>> >     there is a
>> >     chance that it will fail: that's because BUILD_LDFLAGS is excluded
>> >     from
>> >     base config checksum, so your sscache might conflict with the actual
>> >     recipe state.
>> >
>> >     If you want, can send a v2, including a PR-bump, or something >> >     along the
>> >     lines.
>> >
>> >
>> >
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#115782):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115782&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=mv9-JoFG8rCJwz-zydMCBkgwQK24kuO8Jc5VR2QtK9o&e=
<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115782&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=mv9-JoFG8rCJwz-zydMCBkgwQK24kuO8Jc5VR2QtK9o&e=>

> Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_3617156&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=yVIEBlNAg7gptJo6-HlUmQRo2UhHiEQCHS9U7SXZNmg&e=
<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_3617156&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=yVIEBlNAg7gptJo6-HlUmQRo2UhHiEQCHS9U7SXZNmg&e=>

> Group Owner: [email protected] <mailto:openembedded-devel%[email protected]> > Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=Y78_vGNHT-81F0m1bZ8UtjZIGr8OA6Orx60Wfp5pPO8&e=
<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=p9JNvdr8YfvJrH9ctNjzqtiQtl_PyZ9uYv6UmwRz0e8b3KLrXuzp1jGDZlveYWrz&s=Y78_vGNHT-81F0m1bZ8UtjZIGr8OA6Orx60Wfp5pPO8&e=>
[[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Responding to my dumb-thread, I think I start to understand (or just digging myself deeper).
My patch is wrong.

The project uses the bytecode of libstdbuf at build-time only (to inject into itself), and because of this it doesn't need the crate at runtime, so it declares it as build-time dependency[1]. (Which technically it is) Since libstdbuf is a declared as a build-dependency, cargo expects it to be usable at build-time - it makes sense that cargo compiles it for the buildhost.

But this of course doesn't work for cross-compiling - the build-dependency is host-compiled, but we need cross-compiled dependency, that we can actually inject in the resulting binary.

Two things that I don't know (yet?):
1. How to declare libstdbuf as a dependency only, and compile it into a .so file with the correct target, and make the relevant build.rs find it also, so it can be injected
2. How does the current cross-compiled binary not segfault all the time?

[1]:
https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/Cargo.toml#L24

Quoted 135 lines · Gyorgy Sarvari via lists.openembedded.org

Risking that I'm asking the dumbest question ever: so the cross-compiled binary includes the bytecode of the host-compiled libstdbuf, and it works somehow? Isn't libstdbuf compiled incorrectly? If it is, than my patch just hides the issue, but doesn't fix anything (to my regret). Or is it some rust magic, and I'm out of context?

Quoted 128 lines · Etienne Cordonnier

I'm not sure how generic this issue is.
In the case of uutils-coreutils the RPATH is set on libstdbuf.so, and then libstdbuf.so is injected into the rust code
(see https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/src/stdbuf.rs#L34
: const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); )
Thus the value of the RPATH ends up in the coreutils binary, even though the RPATH is not set on the binary itself (by this I mean
that objdump -x coreutils |grep 'R.*PATH' does not give any result).

Of course ideally this gets fixed in rust-common.bbclass, but short-term fixing it in uutils-coreutils would be a nice improvement, assuming it is not that generic.

On Fri, Mar 7, 2025 at 11:18 AM Martin Jansa <[email protected]> wrote:

Shouldn't it be fixed in do_rust_create_wrappers() rust-common.bbclass ? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if they all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

On Fri, Mar 7, 2025 at 11:06 AM Etienne Cordonnier via lists.openembedded.org <http://lists.openembedded.org>
<[email protected]>
wrote:
>
> I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.
>
> Étienne
>
> On Thu, Mar 6, 2025 at 5:40 PM Gyorgy Sarvari <[email protected]> wrote:
>>
>> I haven't heard back anything, but based on my understanding the reason
>> seems to be the wrapper script, created by cargo_common class, which
>> includes config for both host and target.
>>
>> $UNPACKDIR/cargo_home/config.toml has the following:
>> [target.x86_64-unknown-linux-gnu]
>> linker = "${WORKDIR}/wrapper/build-rust-ccld"
>>
>> And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS,
>> including the rpath ones to gcc, and it invokes it directly a few lines
>> later.
>>
>> I think you would see the same issue on Ubuntu if you would pass similar
>> rpath arguments via RUSTFLAGS. E.g. if I do
>>
>> export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP"
>>
>> (which is kinda comparable in a very simplified way to what's going on
>> in the script, in my understanding), then build coreutils on my machine
>> (without Yocto, just my OS), I see the following:
>>
>> [meeee@desktop release]$ strings coreutils | grep EASY >> EASY_GREP
>>
>>
>> On 06.03.25 16:59, Etienne Cordonnier wrote:
>> > Hi Gyorgy,
>> > it is nice that you found the root-cause. I had debugged this as part
>> > of https://github.com/uutils/coreutils/issues/6833 , but had not found
>> > why the yocto build had this issue and not the normal ubuntu build of
>> > uutils-coreutils.
>> > Have you received some feedback regarding this patch? >> >
>> > Étienne
>> >
>> > On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via >> > lists.openembedded.org <http://lists.openembedded.org>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=
<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=>
>
>> > <[email protected]> wrote:
>> >
>> >     > -ERROR_QA:remove = "buildpaths"
>> >     > -WARN_QA:append = " buildpaths"
>> >     > +BUILD_LDFLAGS:remove:class-target = "
>> >     -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
>> >     > +
>> >     -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
>> >     >
>> >     If this patch isn't shot down and you are trying to build this,
>> >     there is a
>> >     chance that it will fail: that's because BUILD_LDFLAGS is excluded
>> >     from
>> >     base config checksum, so your sscache might conflict with the actual
>> >     recipe state.
>> >
>> >     If you want, can send a v2, including a PR-bump, or something >> >     along the
>> >     lines.
>> >
>> >
>> >
>
>
>
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115785): https://lists.openembedded.org/g/openembedded-devel/message/115785
Mute This Topic: https://lists.openembedded.org/mt/110820444/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#10 lore raw
Quoted 1 line

so the cross-compiled binary includes the bytecode of the host-compiled

libstdbuf

Good catch. I had not realised that libstdbuf.so was compiled for the native architecture. I think what happened is that I've never tested stdbuf (the recipe uutils-coreutils does not create a symlink for it, because I more or less took over "bindir_progs" and "base_bindir_progs" from the coreutils bitbake recipe).
This looks broken:

:/# coreutils stdbuf -o L ls
ERROR: ld.so: object '/tmp/.tmpbDjsTc/libstdbuf.so' from LD_PRELOAD cannot
be preloaded (cannot open shared object file): ignored.
Quoted 179 lines · Gyorgy Sarvari via lists.openembedded.org

Responding to my dumb-thread, I think I start to understand (or just digging myself deeper).
My patch is wrong.

The project uses the bytecode of libstdbuf at build-time only (to inject into itself), and because of this it doesn't need the crate at runtime, so it declares it as build-time dependency[1]. (Which technically it is) Since libstdbuf is a declared as a build-dependency, cargo expects it to be usable at build-time - it makes sense that cargo compiles it for the buildhost.

But this of course doesn't work for cross-compiling - the build-dependency is host-compiled, but we need cross-compiled dependency, that we can actually inject in the resulting binary.

Two things that I don't know (yet?):
1. How to declare libstdbuf as a dependency only, and compile it into a .so file with the correct target, and make the relevant build.rs find it also, so it can be injected
2. How does the current cross-compiled binary not segfault all the time?

[1]:
https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/Cargo.toml#L24

Quoted 11 lines · Gyorgy Sarvari via lists.openembedded.org

Risking that I'm asking the dumbest question ever: so the cross-compiled binary includes the bytecode of the host-compiled libstdbuf, and it works somehow? Isn't libstdbuf compiled incorrectly? If it is, than my patch just hides the issue, but doesn't fix anything (to my regret). Or is it some rust magic, and I'm out of context?

Quoted 4 lines · Etienne Cordonnier

I'm not sure how generic this issue is.
In the case of uutils-coreutils the RPATH is set on libstdbuf.so, and then libstdbuf.so is injected into the rust code
(see

https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/src/stdbuf.rs#L34

Quoted 6 lines
Quoted 6 lines

: const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); )
Thus the value of the RPATH ends up in the coreutils binary, even though the RPATH is not set on the binary itself (by this I mean that objdump -x coreutils |grep 'R.*PATH' does not give any result).

Quoted 8 lines
Quoted 8 lines

Of course ideally this gets fixed in rust-common.bbclass, but short-term fixing it in uutils-coreutils would be a nice improvement, assuming it is not that generic.

On Fri, Mar 7, 2025 at 11:18 AM Martin Jansa <[email protected]> wrote:

Shouldn't it be fixed in do_rust_create_wrappers()

rust-common.bbclass

Quoted 2 lines
Quoted 2 lines

? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if

they

Quoted 8 lines
Quoted 8 lines

all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

On Fri, Mar 7, 2025 at 11:06 AM Etienne Cordonnier via lists.openembedded.org <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=CU49qB9Xkj_hRSCAsK1ppwNXX2gw6TUNPvYGFp56M6M&e=

Quoted 55 lines
Quoted 55 lines

<[email protected]>
wrote:
>
> I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.
>
> Étienne
>
> On Thu, Mar 6, 2025 at 5:40 PM Gyorgy Sarvari <[email protected]> wrote:
>>
>> I haven't heard back anything, but based on my understanding the reason
>> seems to be the wrapper script, created by cargo_common class, which
>> includes config for both host and target.
>>
>> $UNPACKDIR/cargo_home/config.toml has the following:
>> [target.x86_64-unknown-linux-gnu]
>> linker = "${WORKDIR}/wrapper/build-rust-ccld"
>>
>> And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS,
>> including the rpath ones to gcc, and it invokes it directly a few lines
>> later.
>>
>> I think you would see the same issue on Ubuntu if you would pass similar
>> rpath arguments via RUSTFLAGS. E.g. if I do
>>
>> export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP" >>
>> (which is kinda comparable in a very simplified way to what's going on
>> in the script, in my understanding), then build coreutils on my machine
>> (without Yocto, just my OS), I see the following:
>>
>> [meeee@desktop release]$ strings coreutils | grep EASY >> EASY_GREP
>>
>>
>> On 06.03.25 16:59, Etienne Cordonnier wrote:
>> > Hi Gyorgy,
>> > it is nice that you found the root-cause. I had debugged this as part
>> > of https://github.com/uutils/coreutils/issues/6833 , but had not found
>> > why the yocto build had this issue and not the normal ubuntu build of
>> > uutils-coreutils.
>> > Have you received some feedback regarding this patch? >> >

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Étienne

On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=CU49qB9Xkj_hRSCAsK1ppwNXX2gw6TUNPvYGFp56M6M&e=

Quoted 2 lines
Quoted 2 lines
    <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 1 line
Quoted 1 line
    <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 21 lines
Quoted 21 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

<[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 3 lines
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "
    -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
    > +
    -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
    >
    If this patch isn't shot down and you are trying to build

this,
>> > there is a
>> > chance that it will fail: that's because BUILD_LDFLAGS is
excluded
>> > from
>> > base config checksum, so your sscache might conflict with
the actual
>> > recipe state.
>> >

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

If you want, can send a v2, including a PR-bump, or

something

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

along the
lines.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#115786):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115786&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=bO9oJnOs2PJ7w6E-4SvtcGLMy_cNgtqI2e4TphS7sFw&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=ugNqY_Q5ET-JmW-D9tWvyKnE7aQ4uiGCRUqmBU7JG00&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=8zPAiOspSY0N1j2XasxTV-FgoTUb-qeSrJwACiO18N4&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

I commented at
https://github.com/uutils/coreutils/issues/6591#issuecomment-2706575853
with reproduction steps since the issue is reproducible without yocto, and I will try to fix it when I find some time. I've also sent this follow-up merge-request disabling stdbuf in uutils-coreutils:
https://github.com/openembedded/meta-openembedded/pull/945 and have added Gyorgy as co-author.

Quoted 207 lines · Etienne Cordonnier via lists.openembedded.org
Quoted 1 line

so the cross-compiled binary includes the bytecode of the host-compiled

libstdbuf

Good catch. I had not realised that libstdbuf.so was compiled for the native architecture. I think what happened is that I've never tested stdbuf (the recipe uutils-coreutils does not create a symlink for it, because I more or less took over "bindir_progs" and "base_bindir_progs" from the coreutils bitbake recipe).
This looks broken:

:/# coreutils stdbuf -o L ls
ERROR: ld.so: object '/tmp/.tmpbDjsTc/libstdbuf.so' from LD_PRELOAD cannot
be preloaded (cannot open shared object file): ignored.
Quoted 158 lines · On Fri, Mar 7, 2025 at 2:04 PM Gyorgy Sarvari via lists.openembedded.org…

Responding to my dumb-thread, I think I start to understand (or just digging myself deeper).
My patch is wrong.

The project uses the bytecode of libstdbuf at build-time only (to inject into itself), and because of this it doesn't need the crate at runtime, so it declares it as build-time dependency[1]. (Which technically it is) Since libstdbuf is a declared as a build-dependency, cargo expects it to be usable at build-time - it makes sense that cargo compiles it for the buildhost.

But this of course doesn't work for cross-compiling - the build-dependency is host-compiled, but we need cross-compiled dependency, that we can actually inject in the resulting binary.

Two things that I don't know (yet?):
1. How to declare libstdbuf as a dependency only, and compile it into a .so file with the correct target, and make the relevant build.rs
<https://urldefense.proofpoint.com/v2/url?u=http-3A__build.rs&d=DwMFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=rWysir67u6WCs8I_hzNX5w01kADmHjjQ-XPSsetY3bs&e=>
find it
also, so it can be injected
2. How does the current cross-compiled binary not segfault all the time?

[1]:
https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/Cargo.toml#L24

Quoted 11 lines · Gyorgy Sarvari via lists.openembedded.org

Risking that I'm asking the dumbest question ever: so the cross-compiled binary includes the bytecode of the host-compiled libstdbuf, and it works somehow? Isn't libstdbuf compiled incorrectly? If it is, than my patch just hides the issue, but doesn't fix anything (to my regret). Or is it some rust magic, and I'm out of context?

Quoted 4 lines · Etienne Cordonnier

I'm not sure how generic this issue is.
In the case of uutils-coreutils the RPATH is set on libstdbuf.so, and then libstdbuf.so is injected into the rust code
(see

https://github.com/uutils/coreutils/blob/main/src/uu/stdbuf/src/stdbuf.rs#L34

Quoted 6 lines
Quoted 6 lines

: const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); )
Thus the value of the RPATH ends up in the coreutils binary, even though the RPATH is not set on the binary itself (by this I mean that objdump -x coreutils |grep 'R.*PATH' does not give any result).

Quoted 8 lines
Quoted 8 lines

Of course ideally this gets fixed in rust-common.bbclass, but short-term fixing it in uutils-coreutils would be a nice improvement, assuming it is not that generic.

On Fri, Mar 7, 2025 at 11:18 AM Martin Jansa <[email protected]> wrote:

Shouldn't it be fixed in do_rust_create_wrappers()

rust-common.bbclass

Quoted 2 lines
Quoted 2 lines

? Or why is this specific only for uutils? The buildpaths issue is triggered from more recipes built with rust (I haven't checked if

they

Quoted 8 lines
Quoted 8 lines

all are caused by this BUILD_LDFLAGS), but we shouldn't change all these recipes to remove what rust-common.bbclass added.

+Deepesh who did last rust upgrade and few more people who might be interested in this

On Fri, Mar 7, 2025 at 11:06 AM Etienne Cordonnier via lists.openembedded.org

<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwMFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=MYmdoPFBW1jl-2xFYK0wnj8X6pVU2_wl9EK-s2MertE&e=>
<
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=CU49qB9Xkj_hRSCAsK1ppwNXX2gw6TUNPvYGFp56M6M&e=

Quoted 55 lines
Quoted 55 lines

<[email protected]>
wrote:
>
> I vote for merging this patch. Maybe with a comment pointing to build-rust-ccld.
>
> Étienne
>
> On Thu, Mar 6, 2025 at 5:40 PM Gyorgy Sarvari <[email protected]> wrote:
>>
>> I haven't heard back anything, but based on my understanding the reason
>> seems to be the wrapper script, created by cargo_common class, which
>> includes config for both host and target.
>>
>> $UNPACKDIR/cargo_home/config.toml has the following:
>> [target.x86_64-unknown-linux-gnu]
>> linker = "${WORKDIR}/wrapper/build-rust-ccld"
>>
>> And in turn build-rust-ccld script passes all the the BUILD_LDFLAGS,
>> including the rpath ones to gcc, and it invokes it directly a few lines
>> later.
>>
>> I think you would see the same issue on Ubuntu if you would pass similar
>> rpath arguments via RUSTFLAGS. E.g. if I do
>>
>> export RUSTFLAGS="-C link-args=-Wl,-rpath,EASY_GREP" >>
>> (which is kinda comparable in a very simplified way to what's going on
>> in the script, in my understanding), then build coreutils on my machine
>> (without Yocto, just my OS), I see the following:
>>
>> [meeee@desktop release]$ strings coreutils | grep EASY >> EASY_GREP
>>
>>
>> On 06.03.25 16:59, Etienne Cordonnier wrote:
>> > Hi Gyorgy,
>> > it is nice that you found the root-cause. I had debugged this as part
>> > of https://github.com/uutils/coreutils/issues/6833 , but had not found
>> > why the yocto build had this issue and not the normal ubuntu build of
>> > uutils-coreutils.
>> > Have you received some feedback regarding this patch? >> >

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Étienne

On Sun, Jan 26, 2025 at 12:37 PM Gyorgy Sarvari via lists.openembedded.org

<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwMFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=MYmdoPFBW1jl-2xFYK0wnj8X6pVU2_wl9EK-s2MertE&e=>
<
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qpnwZNudxhYaEIXDMBpSMCByydyk1f6Texh_l85xPOClbwLyyI_Vhi9KP79aYxsH&s=CU49qB9Xkj_hRSCAsK1ppwNXX2gw6TUNPvYGFp56M6M&e=

Quoted 2 lines
Quoted 2 lines
    <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 1 line
Quoted 1 line
    <

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openembedded.org&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=r_TOp8nVaCCSw19cijpXVbcjRvFVX1AYu1oLPSQzp02bVYipc0uH-2PY8vQ3v3Ju&s=OYWpHglwHPZhxYQ4FI7np0IioiBch7cCs5Q_naf7NGQ&e=

Quoted 21 lines
Quoted 21 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

<[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 3 lines
(quoted diff) +1 -2
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = "
    -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
    > +
    -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} "
    >
    If this patch isn't shot down and you are trying to build

this,
>> > there is a
>> > chance that it will fail: that's because BUILD_LDFLAGS is
excluded
>> > from
>> > base config checksum, so your sscache might conflict with
the actual
>> > recipe state.
>> >

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

If you want, can send a v2, including a PR-bump, or

something

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines

along the
lines.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#115787):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_message_115787&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=iKyTOKtjcwVxf4C_Dc-VB8UTCb-v94ZocDwMTntG18E&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_110820444_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=OfiV5AXeXuEPxAYs51QI-5tmvjwiXSv--jSjdy3JDRQ&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=ePkbpDuOl3Y0igEwFzjkQzZvCX7L4UdYx0yfi5orKPhs7dYGF3qHw3dVwWZhqs9V&s=HYqLcQ5y1oQoKoxn6k3ExEWY2CCF0BPW83HN-_xi4wc&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-