Openembedded Devel Discussions
 help / color / mirror / Atom feed
* [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all
@ 2010-06-22 22:33 Tom Rini
  2010-06-22 22:48 ` Chris Larson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Rini @ 2010-06-22 22:33 UTC (permalink / raw)
  To: openembedded-devel

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.

Signed-off-by: Tom Rini <tom_rini@mentor.com>

diff --git a/classes/cross.bbclass b/classes/cross.bbclass
index 4cf2b4c..e486e30 100644
--- a/classes/cross.bbclass
+++ b/classes/cross.bbclass
@@ -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"
diff --git a/classes/native.bbclass b/classes/native.bbclass
index 3437836..92f5f83 100644
--- a/classes/native.bbclass
+++ b/classes/native.bbclass
@@ -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"
diff --git a/classes/relocatable.bbclass b/classes/relocatable.bbclass
index e4ababa..77b5f87 100644
--- a/classes/relocatable.bbclass
+++ b/classes/relocatable.bbclass
@@ -1,4 +1,5 @@
  SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
+DEPENDS += "chrpath-native"

  CHRPATH_BIN ?= "chrpath"
  PREPROCESS_RELOCATE_DIRS ?= ""
diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
index dfb3010..33ec459 100644
--- a/classes/sanity.bbclass
+++ b/classes/sanity.bbclass
@@ -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):
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 397dbc2..46e6772 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -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}"
diff --git a/recipes/binutils/binutils.inc b/recipes/binutils/binutils.inc
index a1866f3..3764f32 100644
--- a/recipes/binutils/binutils.inc
+++ b/recipes/binutils/binutils.inc
@@ -5,7 +5,7 @@ LICENSE = "GPL"

  INC_PR = "r10"

-inherit autotools gettext
+inherit autotools gettext relocatable

  PACKAGES += "${PN}-symlinks"

diff --git a/recipes/gcc/gcc-common.inc b/recipes/gcc/gcc-common.inc
index 7aee542..d7e022d 100644
--- a/recipes/gcc/gcc-common.inc
+++ b/recipes/gcc/gcc-common.inc
@@ -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}"

diff --git a/recipes/gdb/gdb.inc b/recipes/gdb/gdb.inc
index 3500e1a..7cd47ed 100644
--- a/recipes/gdb/gdb.inc
+++ b/recipes/gdb/gdb.inc
@@ -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"
diff --git a/recipes/perl/perl-native_5.10.1.bb 
b/recipes/perl/perl-native_5.10.1.bb
index 8bafff0..b210115 100644
--- a/recipes/perl/perl-native_5.10.1.bb
+++ b/recipes/perl/perl-native_5.10.1.bb
@@ -23,7 +23,7 @@ SRC_URI[perl-5.10.1.sha256sum] = 
"cb7f26ea4b2b28d6644354d87a269d01cac1b635287dae

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

-inherit native
+inherit native relocatable

  do_configure () {
      ./Configure \
diff --git a/recipes/perl/perl-native_5.8.8.bb 
b/recipes/perl/perl-native_5.8.8.bb
index 336b419..7602d77 100644
--- a/recipes/perl/perl-native_5.8.8.bb
+++ b/recipes/perl/perl-native_5.8.8.bb
@@ -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

-- 
Tom Rini
Mentor Graphics Corporation



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH, RFC] Link with $ORIGIN, mangle only when that's too  hard, get it all
  2010-06-22 22:33 [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all Tom Rini
@ 2010-06-22 22:48 ` Chris Larson
  2010-06-22 23:08 ` Tom Rini
  2010-06-23 17:28 ` Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Larson @ 2010-06-22 22:48 UTC (permalink / raw)
  To: openembedded-devel

On Tue, Jun 22, 2010 at 3:33 PM, Tom Rini <tom_rini@mentor.com> wrote:

> 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.
>
> Signed-off-by: Tom Rini <tom_rini@mentor.com>


Looks like a definite improvement to me.

Acked-by: Chris Larson <chris_larson@mentor.com>
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all
  2010-06-22 22:33 [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all Tom Rini
  2010-06-22 22:48 ` Chris Larson
@ 2010-06-22 23:08 ` Tom Rini
  2010-06-23 17:28 ` Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2010-06-22 23:08 UTC (permalink / raw)
  To: openembedded-devel

Tom Rini wrote:
> 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.

-- 
Tom Rini
Mentor Graphics Corporation



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all
  2010-06-22 22:33 [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all Tom Rini
  2010-06-22 22:48 ` Chris Larson
  2010-06-22 23:08 ` Tom Rini
@ 2010-06-23 17:28 ` Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2010-06-23 17:28 UTC (permalink / raw)
  To: openembedded-devel

On (22/06/10 15:33), Tom Rini wrote:
> 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.
> 
> Signed-off-by: Tom Rini <tom_rini@mentor.com>

Acked-by: Khem Raj <raj.khem@gmail.com>

> 
> diff --git a/classes/cross.bbclass b/classes/cross.bbclass
> index 4cf2b4c..e486e30 100644
> --- a/classes/cross.bbclass
> +++ b/classes/cross.bbclass
> @@ -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"
> diff --git a/classes/native.bbclass b/classes/native.bbclass
> index 3437836..92f5f83 100644
> --- a/classes/native.bbclass
> +++ b/classes/native.bbclass
> @@ -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"
> diff --git a/classes/relocatable.bbclass b/classes/relocatable.bbclass
> index e4ababa..77b5f87 100644
> --- a/classes/relocatable.bbclass
> +++ b/classes/relocatable.bbclass
> @@ -1,4 +1,5 @@
>  SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
> +DEPENDS += "chrpath-native"
> 
>  CHRPATH_BIN ?= "chrpath"
>  PREPROCESS_RELOCATE_DIRS ?= ""
> diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
> index dfb3010..33ec459 100644
> --- a/classes/sanity.bbclass
> +++ b/classes/sanity.bbclass
> @@ -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):
> diff --git a/conf/bitbake.conf b/conf/bitbake.conf
> index 397dbc2..46e6772 100644
> --- a/conf/bitbake.conf
> +++ b/conf/bitbake.conf
> @@ -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}"
> diff --git a/recipes/binutils/binutils.inc b/recipes/binutils/binutils.inc
> index a1866f3..3764f32 100644
> --- a/recipes/binutils/binutils.inc
> +++ b/recipes/binutils/binutils.inc
> @@ -5,7 +5,7 @@ LICENSE = "GPL"
> 
>  INC_PR = "r10"
> 
> -inherit autotools gettext
> +inherit autotools gettext relocatable
> 
>  PACKAGES += "${PN}-symlinks"
> 
> diff --git a/recipes/gcc/gcc-common.inc b/recipes/gcc/gcc-common.inc
> index 7aee542..d7e022d 100644
> --- a/recipes/gcc/gcc-common.inc
> +++ b/recipes/gcc/gcc-common.inc
> @@ -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}"
> 
> diff --git a/recipes/gdb/gdb.inc b/recipes/gdb/gdb.inc
> index 3500e1a..7cd47ed 100644
> --- a/recipes/gdb/gdb.inc
> +++ b/recipes/gdb/gdb.inc
> @@ -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"
> diff --git a/recipes/perl/perl-native_5.10.1.bb
> b/recipes/perl/perl-native_5.10.1.bb
> index 8bafff0..b210115 100644
> --- a/recipes/perl/perl-native_5.10.1.bb
> +++ b/recipes/perl/perl-native_5.10.1.bb
> @@ -23,7 +23,7 @@ SRC_URI[perl-5.10.1.sha256sum] =
> "cb7f26ea4b2b28d6644354d87a269d01cac1b635287dae
> 
>  S = "${WORKDIR}/perl-${PV}"
> 
> -inherit native
> +inherit native relocatable
> 
>  do_configure () {
>      ./Configure \
> diff --git a/recipes/perl/perl-native_5.8.8.bb
> b/recipes/perl/perl-native_5.8.8.bb
> index 336b419..7602d77 100644
> --- a/recipes/perl/perl-native_5.8.8.bb
> +++ b/recipes/perl/perl-native_5.8.8.bb
> @@ -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
> 
> -- 
> Tom Rini
> Mentor Graphics Corporation
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-23 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-22 22:33 [PATCH, RFC] Link with $ORIGIN, mangle only when that's too hard, get it all Tom Rini
2010-06-22 22:48 ` Chris Larson
2010-06-22 23:08 ` Tom Rini
2010-06-23 17:28 ` Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox