BUILD_LDFLAGS is primarily (but not exclusively) defined by bitbake.conf.
Beside other things, it adds STAGING_LIBDIR_NATIVE and 
STAGING_BASE_LIBDIR_NATIVE
as both rpath and rpath-link arguments to this variable.

Usually this shouldn't matter for class-target compilation, as it's normally
expected to use only TARGET_* variables, not BUILD_* ones.

This is not always the case with Rust - some crates are compiled for the host
target even when the recipe target is class-target, e.g. for some compiler
plugins, and I'm sure there are other reasons also. This makes some BUILD_*
variables to be used in the this process, making the rpath variables from 
BUILD_LDFLAGS
ending up in the final binary.

>From the manpage of ld(1): "The difference between -rpath and -rpath-link is 
>that
directories specified by -rpath options are included in the executable and used 
at
runtime, whereas the -rpath-link option is only effective at link time."

Based on this, it should be safe to remove these options from BUILD_LDFLAGS:
these folders don't exist during runtime, but since they are present as 
rpath-link
also in BUILD_LDFLAGS, they can be still used link-time, if needed.

This allows generating reproducible binaries for this recipe.

Signed-off-by: Gyorgy Sarvari <[email protected]>
---
 .../recipes-core/uutils-coreutils/uutils-coreutils_0.0.28.bb  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.28.bb 
b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.28.bb
index 5608b0347..c2bc9ca34 100644
--- a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.28.bb
+++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.28.bb
@@ -72,5 +72,5 @@ python __anonymous() {
         d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % 
(d.getVar('sbindir'), prog))
 }
 
-ERROR_QA:remove = "buildpaths"
-WARN_QA:append = " buildpaths"
+BUILD_LDFLAGS:remove:class-target = " -Wl,-rpath,${STAGING_LIBDIR_NATIVE}  \
+                                      -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} 
"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115100): 
https://lists.openembedded.org/g/openembedded-devel/message/115100
Mute This Topic: https://lists.openembedded.org/mt/110820444/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

  • [oe] [meta-oe][PATCH] uutils-cor... Gyorgy Sarvari via lists.openembedded.org

Reply via email to