Skip to contentSkip to conversation

Link with $ORIGIN, mangle only when that's too hard, get it all

RFC PATCH In review Tom Rini 3 participants 4 messages Jun 22, 2010 – Jun 23, 2010

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

RFC PATCH 1/1 Link with $ORIGIN, mangle only when that's too hard, get it all

The following changes relocatable.bbclass to an always for native (and disabled for cross) to an opt-in for hard to get right recipes.

With this, cross / native things like with $ORIGIN directly, for the common case. We do this as an in addition to so that programs that run before install still work fine. In addition doing this makes sure that the initial RPATH will be long enough, even in the cross case, that we can patch in a correct $ORIGIN[1].

Advantages? Less tasks, one less must have host utility (*cough*3rd party yum repos*cough*). Having an exists but not right second known part of RPATH ensures cross recipes are now chrpath/patchelf patchable and gets us one step closer to pstaging being relocatable (will have to run some tests to look at the last corner cases). Disadvantages? One "ugly" escape sequence in bitbake.conf.

classes/cross.bbclass +0 -3
index 4cf2b4c..e486e30 100644
@@ -1,6 +1,3 @@
-# Disabled for now since the relocation paths are too long
-#inherit relocatable
-
 # Cross packages are built indirectly via dependency,
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
classes/native.bbclass +0 -3
index 3437836..92f5f83 100644
@@ -1,6 +1,3 @@
-# We want native packages to be relocatable
-inherit relocatable
-
 # Native packages are built indirectly via dependency,
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
classes/relocatable.bbclass +1 -0
index e4ababa..77b5f87 100644
@@ -1,4 +1,5 @@
 SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
+DEPENDS += "chrpath-native"
 
 CHRPATH_BIN ?= "chrpath"
 PREPROCESS_RELOCATE_DIRS ?= ""
classes/sanity.bbclass +1 -1
index dfb3010..33ec459 100644
@@ -83,7 +83,7 @@ def check_sanity(e):
 	if not check_app_exists('${BUILD_PREFIX}g++', e.data):
 		missing = missing + "C++ Compiler (${BUILD_PREFIX}g++),"
 
-	required_utilities = "patch help2man diffstat texi2html makeinfo cvs svn bzip2 tar gzip gawk md5sum chrpath"
+	required_utilities = "patch help2man diffstat texi2html makeinfo cvs svn bzip2 tar gzip gawk md5sum"
 
 	# If we'll be running qemu, perform some sanity checks
 	if data.getVar('ENABLE_BINARY_LOCALE_GENERATION', e.data, True):
conf/bitbake.conf +2 -1
index 397dbc2..46e6772 100644
@@ -482,8 +482,9 @@ export CXXFLAGS = "${TARGET_CXXFLAGS}"
 export TARGET_CXXFLAGS = "${TARGET_CFLAGS} -fpermissive"
 export SDK_CXXFLAGS = "${SDK_CFLAGS} -fpermissive"
 
+export RELATIVERPATH = "${@base_path_relative(d.getVar('bindir', 1), d.getVar('STAGING_LIBDIR_NATIVE', 1))}"
 export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \
-                        -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} \
+                        -Wl,-rpath,\\\$\$ORIGIN/${RELATIVERPATH} -Wl,-O1 \
                         -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-O1"
 
 export LDFLAGS = "${TARGET_LDFLAGS}"
recipes/binutils/binutils.inc +1 -1
index a1866f3..3764f32 100644
@@ -5,7 +5,7 @@ LICENSE = "GPL"
 
 INC_PR = "r10"
 
-inherit autotools gettext
+inherit autotools gettext relocatable
 
 PACKAGES += "${PN}-symlinks"
 
recipes/gcc/gcc-common.inc +1 -1
index 7aee542..d7e022d 100644
@@ -5,7 +5,7 @@ LICENSE = "GPL"
 
 NATIVEDEPS = ""
 
-inherit autotools gettext
+inherit autotools gettext relocatable
 
 FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
 
recipes/gdb/gdb.inc +1 -1
index 3500e1a..7cd47ed 100644
@@ -14,7 +14,7 @@ RRECOMMENDS_gdb_append_linux-uclibc = " uclibc-thread-db "
 RRECOMMENDS_gdb_append_linux-uclibceabi = " uclibc-thread-db "
 RRECOMMENDS_gdb_append_linux-spe = " uclibc-thread-db "
 
-inherit gettext
+inherit gettext relocatable
 
 SRC_URI += "file://kill_arm_map_symbols.patch \
             file://gdbserver-cflags-last.diff;striplevel=0"
recipes/perl/perl-native_5.10.1.bb +1 -1
index 8bafff0..b210115 100644
@@ -23,7 +23,7 @@ SRC_URI[perl-5.10.1.sha256sum] = "cb7f26ea4b2b28d6644354d87a269d01cac1b635287dae
 
 S = "${WORKDIR}/perl-${PV}"
 
-inherit native
+inherit native relocatable
 
 do_configure () {
     ./Configure \
recipes/perl/perl-native_5.8.8.bb +1 -1
index 336b419..7602d77 100644
@@ -20,7 +20,7 @@ SRC_URI = "http://ftp.funet.fi/pub/CPAN/src/5.0/perl-${PV}.tar.gz \
 
 S = "${WORKDIR}/perl-${PV}"
 
-inherit native
+inherit native relocatable
 
 do_configure () {
     ./Configure \

[1]: gcc/binutils/gdb are the hard ones as they re-run configure and lead to escape-hell and gcc has an extra layer of fun with mpfr + cc1 in libexec

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tom Rini

The following changes relocatable.bbclass to an always for native (and disabled for cross) to an opt-in for hard to get right recipes.

With this, cross / native things like with $ORIGIN directly, for the common case. We do this as an in addition to so that programs that run before install still work fine. In addition doing this makes sure that the initial RPATH will be long enough, even in the cross case, that we can patch in a correct $ORIGIN[1].

Quoted 8 lines

Advantages? Less tasks, one less must have host utility (*cough*3rd party yum repos*cough*). Having an exists but not right second known part of RPATH ensures cross recipes are now chrpath/patchelf patchable and gets us one step closer to pstaging being relocatable (will have to run some tests to look at the last corner cases). Disadvantages? One "ugly" escape sequence in bitbake.conf.

Looks like a definite improvement to me.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
author
#2 lore raw
In reply to Tom Rini
Quoted 5 lines · Tom Rini

The following changes relocatable.bbclass to an always for native (and disabled for cross) to an opt-in for hard to get right recipes.

With this, cross / native things like with $ORIGIN directly, for the common case. We do this as an in addition to so that programs that run before install still work fine. In addition doing this makes sure that the initial RPATH will be long enough, even in the cross case, that we can patch in a correct $ORIGIN[1].

Advantages? Less tasks, one less must have host utility (*cough*3rd party yum repos*cough*). Having an exists but not right second known part of RPATH ensures cross recipes are now chrpath/patchelf patchable and gets us one step closer to pstaging being relocatable (will have to run some tests to look at the last corner cases). Disadvantages? One "ugly" escape sequence in bitbake.conf.

So for the moment, I need to retract this. As soon as we hit a legacy do_stage, we go off and mangle everyone. So more incentive to clear all of those out from -cross / -native :) And as an aside, relocatable should use the relative function we have. Will include that next time.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
Acked-by on v1 1/1
#3 lore raw
In reply to Tom Rini
Quoted 9 lines · Tom Rini

The following changes relocatable.bbclass to an always for native (and disabled for cross) to an opt-in for hard to get right recipes.

With this, cross / native things like with $ORIGIN directly, for the common case. We do this as an in addition to so that programs that run before install still work fine. In addition doing this makes sure that the initial RPATH will be long enough, even in the cross case, that we can patch in a correct $ORIGIN[1].

Quoted 8 lines

Advantages? Less tasks, one less must have host utility (*cough*3rd party yum repos*cough*). Having an exists but not right second known part of RPATH ensures cross recipes are now chrpath/patchelf patchable and gets us one step closer to pstaging being relocatable (will have to run some tests to look at the last corner cases). Disadvantages? One "ugly" escape sequence in bitbake.conf.

Quoted 146 lines
classes/cross.bbclass +0 -3
index 4cf2b4c..e486e30 100644
@@ -1,6 +1,3 @@
-# Disabled for now since the relocation paths are too long
-#inherit relocatable
-
 # Cross packages are built indirectly via dependency,
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
classes/native.bbclass +0 -3
index 3437836..92f5f83 100644
@@ -1,6 +1,3 @@
-# We want native packages to be relocatable
-inherit relocatable
-
 # Native packages are built indirectly via dependency,
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
classes/relocatable.bbclass +1 -0
index e4ababa..77b5f87 100644
@@ -1,4 +1,5 @@
 SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
+DEPENDS += "chrpath-native"
 
 CHRPATH_BIN ?= "chrpath"
 PREPROCESS_RELOCATE_DIRS ?= ""
classes/sanity.bbclass +0 -1
index dfb3010..33ec459 100644
@@ -83,7 +83,7 @@ def check_sanity(e):
 	if not check_app_exists('${BUILD_PREFIX}g++', e.data):
 		missing = missing + "C++ Compiler (${BUILD_PREFIX}g++),"
 
-	required_utilities = "patch help2man diffstat texi2html makeinfo

cvs svn bzip2 tar gzip gawk md5sum chrpath"

classes/sanity.bbclass +1 -0
+	required_utilities = "patch help2man diffstat texi2html makeinfo

cvs svn bzip2 tar gzip gawk md5sum"

classes/sanity.bbclass +0 -0
 	# If we'll be running qemu, perform some sanity checks
 	if data.getVar('ENABLE_BINARY_LOCALE_GENERATION', e.data, True):
conf/bitbake.conf +1 -0
index 397dbc2..46e6772 100644
@@ -482,8 +482,9 @@ export CXXFLAGS = "${TARGET_CXXFLAGS}"
 export TARGET_CXXFLAGS = "${TARGET_CFLAGS} -fpermissive"
 export SDK_CXXFLAGS = "${SDK_CFLAGS} -fpermissive"
 
+export RELATIVERPATH = "${@base_path_relative(d.getVar('bindir',

1), d.getVar('STAGING_LIBDIR_NATIVE', 1))}"
export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \

conf/bitbake.conf +1 -1
-                        -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} \
+                        -Wl,-rpath,\\\$\$ORIGIN/${RELATIVERPATH} -Wl,-O1 \
                         -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-O1"
 
 export LDFLAGS = "${TARGET_LDFLAGS}"
recipes/binutils/binutils.inc +1 -1
index a1866f3..3764f32 100644
@@ -5,7 +5,7 @@ LICENSE = "GPL"
 
 INC_PR = "r10"
 
-inherit autotools gettext
+inherit autotools gettext relocatable
 
 PACKAGES += "${PN}-symlinks"
 
recipes/gcc/gcc-common.inc +1 -1
index 7aee542..d7e022d 100644
@@ -5,7 +5,7 @@ LICENSE = "GPL"
 
 NATIVEDEPS = ""
 
-inherit autotools gettext
+inherit autotools gettext relocatable
 
 FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
 
recipes/gdb/gdb.inc +1 -1
index 3500e1a..7cd47ed 100644
@@ -14,7 +14,7 @@ RRECOMMENDS_gdb_append_linux-uclibc = " uclibc-thread-db "
 RRECOMMENDS_gdb_append_linux-uclibceabi = " uclibc-thread-db "
 RRECOMMENDS_gdb_append_linux-spe = " uclibc-thread-db "
 
-inherit gettext
+inherit gettext relocatable
 
 SRC_URI += "file://kill_arm_map_symbols.patch \
             file://gdbserver-cflags-last.diff;striplevel=0"
recipes/perl/perl-native_5.10.1.bb +0 -0
index 8bafff0..b210115 100644
@@ -23,7 +23,7 @@ SRC_URI[perl-5.10.1.sha256sum] =

"cb7f26ea4b2b28d6644354d87a269d01cac1b635287dae

S = "${WORKDIR}/perl-${PV}"

recipes/perl/perl-native_5.10.1.bb +1 -1
-inherit native
+inherit native relocatable
 
 do_configure () {
     ./Configure \
recipes/perl/perl-native_5.8.8.bb +1 -1
index 336b419..7602d77 100644
@@ -20,7 +20,7 @@ SRC_URI =
 "http://ftp.funet.fi/pub/CPAN/src/5.0/perl-${PV}.tar.gz \
 
 S = "${WORKDIR}/perl-${PV}"
 
-inherit native
+inherit native relocatable
 
 do_configure () {
     ./Configure \

[1]: gcc/binutils/gdb are the hard ones as they re-run configure and lead to escape-hell and gcc has an extra layer of fun with mpfr + cc1 in libexec

Signature · 7 lines
Tom Rini
Mentor Graphics Corporation

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel