All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
@ 2018-05-03 19:15 Ciro Santilli
  2018-05-03 21:16 ` Arnout Vandecappelle
  0 siblings, 1 reply; 6+ messages in thread
From: Ciro Santilli @ 2018-05-03 19:15 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
---
As explained on the Config, the rationale is to speed up BR2_EXTERNAL
package development build iteration.

This would make users targetting virtual machines happy.

It may be argued that embedded images are not supposed to be small,
but a counter argument is that there are already in-tree packages
that benefit considerably from this, e.g. ltp-testsuite, which drops
the build iteration from 18s to 5s on my machine, which is a huge
life improvement.

Additionaly, this will also make it easier for us to find and report
the offending packages mentioned at 5f4ca518094f7690536074246ab765f36a213783
and push for a correct upstream fix, are we tracking that somewhere?
Removing the rpath fix actually makes those packages not work is that it?

I'm not sure if this should be an actual config, thus the RFC.
Without the config, it is also possible to use it just as:

    make BR2_SANITIZE_RPATH=n

 Config.in | 7 +++++++
 Makefile  | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/Config.in b/Config.in
index 6b5b2b043c..6b39bd9f8b 100644
--- a/Config.in
+++ b/Config.in
@@ -678,6 +678,13 @@ config BR2_COMPILER_PARANOID_UNSAFE_PATH
 	  and external toolchain backends (through the toolchain
 	  wrapper).
 
+config BR2_SANITIZE_RPATH
+	bool "sanitize rpath"
+	default y
+	help
+	  You may want to disable this while developing a package with
+	  BR2_EXTERNAL to make build iterations faster.
+
 config BR2_REPRODUCIBLE
 	bool "Make the build reproducible (experimental)"
 	# SOURCE_DATE_EPOCH support in toolchain-wrapper requires GCC 4.4
diff --git a/Makefile b/Makefile
index 54f940659c..a9c1b82b3f 100644
--- a/Makefile
+++ b/Makefile
@@ -743,8 +743,10 @@ endif
 	) >  $(TARGET_DIR)/usr/lib/os-release
 	ln -sf ../usr/lib/os-release $(TARGET_DIR)/etc
 
+ifeq ($(BR2_SANITIZE_RPATH),y)
 	@$(call MESSAGE,"Sanitizing RPATH in target tree")
 	$(TOPDIR)/support/scripts/fix-rpath target
+endif
 
 	@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
 		$(call MESSAGE,"Copying overlay $(d)"); \
-- 
2.16.1

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

* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
  2018-05-03 19:15 [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree Ciro Santilli
@ 2018-05-03 21:16 ` Arnout Vandecappelle
  2018-05-03 21:21   ` Ciro Santilli
  0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2018-05-03 21:16 UTC (permalink / raw)
  To: buildroot



On 03-05-18 21:15, Ciro Santilli wrote:
> Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
> ---
> As explained on the Config, the rationale is to speed up BR2_EXTERNAL
> package development build iteration.

 I don't see what this has to do with package development. Anyway, when you're
developing package foo, wouldn't you run 'make foo' rather than just 'make' (and
thus never even hit that code path)?

> This would make users targetting virtual machines happy.

 Huh? Or you mean building in virtual machines?

> 
> It may be argued that embedded images are not supposed to be small,
> but a counter argument is that there are already in-tree packages
> that benefit considerably from this, e.g. ltp-testsuite, which drops
> the build iteration from 18s to 5s on my machine, which is a huge
> life improvement.
> 
> Additionaly, this will also make it easier for us to find and report
> the offending packages mentioned at 5f4ca518094f7690536074246ab765f36a213783
> and push for a correct upstream fix, are we tracking that somewhere?

 No, it falls in the category "not worth the time to try to fix upstream",
especially since we're talking about things like SELinux which consists of
dozens of packages that all do it wrong.

> Removing the rpath fix actually makes those packages not work is that it?

 Usually not, the rpaths are mostly useless. They are typically added because
the executable is linked with a library that may not yet be installed.


> I'm not sure if this should be an actual config, thus the RFC.
> Without the config, it is also possible to use it just as:

 TBH, I don't think it's worth the bother either way. Just skip the entire
finalize/rootfs creation step if you're not interested.

 Regards,
 Arnout

> 
>     make BR2_SANITIZE_RPATH=n
> 
>  Config.in | 7 +++++++
>  Makefile  | 2 ++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/Config.in b/Config.in
> index 6b5b2b043c..6b39bd9f8b 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -678,6 +678,13 @@ config BR2_COMPILER_PARANOID_UNSAFE_PATH
>  	  and external toolchain backends (through the toolchain
>  	  wrapper).
>  
> +config BR2_SANITIZE_RPATH
> +	bool "sanitize rpath"
> +	default y
> +	help
> +	  You may want to disable this while developing a package with
> +	  BR2_EXTERNAL to make build iterations faster.
> +
>  config BR2_REPRODUCIBLE
>  	bool "Make the build reproducible (experimental)"
>  	# SOURCE_DATE_EPOCH support in toolchain-wrapper requires GCC 4.4
> diff --git a/Makefile b/Makefile
> index 54f940659c..a9c1b82b3f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -743,8 +743,10 @@ endif
>  	) >  $(TARGET_DIR)/usr/lib/os-release
>  	ln -sf ../usr/lib/os-release $(TARGET_DIR)/etc
>  
> +ifeq ($(BR2_SANITIZE_RPATH),y)
>  	@$(call MESSAGE,"Sanitizing RPATH in target tree")
>  	$(TOPDIR)/support/scripts/fix-rpath target
> +endif
>  
>  	@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
>  		$(call MESSAGE,"Copying overlay $(d)"); \
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
  2018-05-03 21:16 ` Arnout Vandecappelle
@ 2018-05-03 21:21   ` Ciro Santilli
  2018-05-03 21:27     ` Arnout Vandecappelle
  0 siblings, 1 reply; 6+ messages in thread
From: Ciro Santilli @ 2018-05-03 21:21 UTC (permalink / raw)
  To: buildroot

On Thu, May 3, 2018 at 10:16 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
> On 03-05-18 21:15, Ciro Santilli wrote:
>> Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
>> ---
>> As explained on the Config, the rationale is to speed up BR2_EXTERNAL
>> package development build iteration.
>
>  I don't see what this has to do with package development. Anyway, when you're
> developing package foo, wouldn't you run 'make foo' rather than just 'make' (and
> thus never even hit that code path)?
>

How to test the modification without rebuilding the image to run it on
the target?

>> This would make users targetting virtual machines happy.
>
>  Huh? Or you mean building in virtual machines?
>

No, cross compiling for VMs from host as opposed to real hardware.

>>
>> It may be argued that embedded images are not supposed to be small,
>> but a counter argument is that there are already in-tree packages
>> that benefit considerably from this, e.g. ltp-testsuite, which drops
>> the build iteration from 18s to 5s on my machine, which is a huge
>> life improvement.
>>
>> Additionaly, this will also make it easier for us to find and report
>> the offending packages mentioned at 5f4ca518094f7690536074246ab765f36a213783
>> and push for a correct upstream fix, are we tracking that somewhere?
>
>  No, it falls in the category "not worth the time to try to fix upstream",
> especially since we're talking about things like SELinux which consists of
> dozens of packages that all do it wrong.
>
>> Removing the rpath fix actually makes those packages not work is that it?
>
>  Usually not, the rpaths are mostly useless. They are typically added because
> the executable is linked with a library that may not yet be installed.
>
>
>> I'm not sure if this should be an actual config, thus the RFC.
>> Without the config, it is also possible to use it just as:
>
>  TBH, I don't think it's worth the bother either way. Just skip the entire
> finalize/rootfs creation step if you're not interested.
>
>  Regards,
>  Arnout
>
>>
>>     make BR2_SANITIZE_RPATH=n
>>
>>  Config.in | 7 +++++++
>>  Makefile  | 2 ++
>>  2 files changed, 9 insertions(+)
>>
>> diff --git a/Config.in b/Config.in
>> index 6b5b2b043c..6b39bd9f8b 100644
>> --- a/Config.in
>> +++ b/Config.in
>> @@ -678,6 +678,13 @@ config BR2_COMPILER_PARANOID_UNSAFE_PATH
>>         and external toolchain backends (through the toolchain
>>         wrapper).
>>
>> +config BR2_SANITIZE_RPATH
>> +     bool "sanitize rpath"
>> +     default y
>> +     help
>> +       You may want to disable this while developing a package with
>> +       BR2_EXTERNAL to make build iterations faster.
>> +
>>  config BR2_REPRODUCIBLE
>>       bool "Make the build reproducible (experimental)"
>>       # SOURCE_DATE_EPOCH support in toolchain-wrapper requires GCC 4.4
>> diff --git a/Makefile b/Makefile
>> index 54f940659c..a9c1b82b3f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -743,8 +743,10 @@ endif
>>       ) >  $(TARGET_DIR)/usr/lib/os-release
>>       ln -sf ../usr/lib/os-release $(TARGET_DIR)/etc
>>
>> +ifeq ($(BR2_SANITIZE_RPATH),y)
>>       @$(call MESSAGE,"Sanitizing RPATH in target tree")
>>       $(TOPDIR)/support/scripts/fix-rpath target
>> +endif
>>
>>       @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
>>               $(call MESSAGE,"Copying overlay $(d)"); \
>>
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
  2018-05-03 21:21   ` Ciro Santilli
@ 2018-05-03 21:27     ` Arnout Vandecappelle
  2018-05-03 21:58       ` Ciro Santilli
  2018-05-09  6:12       ` Ciro Santilli
  0 siblings, 2 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2018-05-03 21:27 UTC (permalink / raw)
  To: buildroot



On 03-05-18 23:21, Ciro Santilli wrote:
> On Thu, May 3, 2018 at 10:16 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>>
>>
>> On 03-05-18 21:15, Ciro Santilli wrote:
>>> Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
>>> ---
>>> As explained on the Config, the rationale is to speed up BR2_EXTERNAL
>>> package development build iteration.
>>
>>  I don't see what this has to do with package development. Anyway, when you're
>> developing package foo, wouldn't you run 'make foo' rather than just 'make' (and
>> thus never even hit that code path)?
>>
> 
> How to test the modification without rebuilding the image to run it on
> the target?

 Ah, I usually just scp or rsync the (unstripped) binaries to the target system.
I'll typically write a little script that does something like 'make
FOO_OVERRIDE_SRCDIR=... foo; ssh target rm -f /usr/bin/foo; scp
output/target/usr/bin/foo target:/usr/bin; ssh target killall foo; ssh -f target
foo"

> 
>>> This would make users targetting virtual machines happy.
>>
>>  Huh? Or you mean building in virtual machines?
>>
> 
> No, cross compiling for VMs from host as opposed to real hardware.

 What difference does it make whether your target is a VM or real hardware?

 Regards,
 Arnout

[snip]

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
  2018-05-03 21:27     ` Arnout Vandecappelle
@ 2018-05-03 21:58       ` Ciro Santilli
  2018-05-09  6:12       ` Ciro Santilli
  1 sibling, 0 replies; 6+ messages in thread
From: Ciro Santilli @ 2018-05-03 21:58 UTC (permalink / raw)
  To: buildroot

On Thu, May 3, 2018 at 10:27 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
> On 03-05-18 23:21, Ciro Santilli wrote:
>> On Thu, May 3, 2018 at 10:16 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>>>
>>>
>>> On 03-05-18 21:15, Ciro Santilli wrote:
>>>> Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
>>>> ---
>>>> As explained on the Config, the rationale is to speed up BR2_EXTERNAL
>>>> package development build iteration.
>>>
>>>  I don't see what this has to do with package development. Anyway, when you're
>>> developing package foo, wouldn't you run 'make foo' rather than just 'make' (and
>>> thus never even hit that code path)?
>>>
>>
>> How to test the modification without rebuilding the image to run it on
>> the target?
>
>  Ah, I usually just scp or rsync the (unstripped) binaries to the target system.
> I'll typically write a little script that does something like 'make
> FOO_OVERRIDE_SRCDIR=... foo; ssh target rm -f /usr/bin/foo; scp
> output/target/usr/bin/foo target:/usr/bin; ssh target killall foo; ssh -f target
> foo"
>

That is a possibility.

But I feel it is simpler and more reliable if can just let Buildroot do
exactly what it normally does, especially if a package installs many
files in different directories, and since reboot is so fast.

Otherwise we force users to come up with those setups themselves for
every new package they want to modify.

Even cooler would be if QEMU could Build a separate image with just a
single package (automatically for all OVERRIDE_SRCIDR ?), and then if
I found out how to overlay mount it on root:
https://stackoverflow.com/questions/41119656/how-can-i-overlayfs-the-root-filesystem-on-linux

But OK, let's start simple :-)

>>
>>>> This would make users targetting virtual machines happy.
>>>
>>>  Huh? Or you mean building in virtual machines?
>>>
>>
>> No, cross compiling for VMs from host as opposed to real hardware.
>
>  What difference does it make whether your target is a VM or real hardware?
>

Just the idea that real embedded HW has more limited disk space, and
therefore RPATH fixup time will be small.

But true, now that I think about it this should be annoying for real
embedded boards hardware as well, 4Gb on a RPI is more than enough.

>  Regards,
>  Arnout
>
> [snip]
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree
  2018-05-03 21:27     ` Arnout Vandecappelle
  2018-05-03 21:58       ` Ciro Santilli
@ 2018-05-09  6:12       ` Ciro Santilli
  1 sibling, 0 replies; 6+ messages in thread
From: Ciro Santilli @ 2018-05-09  6:12 UTC (permalink / raw)
  To: buildroot

On Thu, May 3, 2018 at 10:27 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
> On 03-05-18 23:21, Ciro Santilli wrote:
>> On Thu, May 3, 2018 at 10:16 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>>>
>>>
>>> On 03-05-18 21:15, Ciro Santilli wrote:
>>>> Signed-off-by: Ciro Santilli <ciro.santilli@gmail.com>
>>>> ---
>>>> As explained on the Config, the rationale is to speed up BR2_EXTERNAL
>>>> package development build iteration.
>>>
>>>  I don't see what this has to do with package development. Anyway, when you're
>>> developing package foo, wouldn't you run 'make foo' rather than just 'make' (and
>>> thus never even hit that code path)?
>>>
>>
>> How to test the modification without rebuilding the image to run it on
>> the target?
>
>  Ah, I usually just scp or rsync the (unstripped) binaries to the target system.
> I'll typically write a little script that does something like 'make
> FOO_OVERRIDE_SRCDIR=... foo; ssh target rm -f /usr/bin/foo; scp
> output/target/usr/bin/foo target:/usr/bin; ssh target killall foo; ssh -f target
> foo"
>

@Thomas: do you have a better solution? How to you avoid the RPATH
wait time when the image is large?

>>
>>>> This would make users targetting virtual machines happy.
>>>
>>>  Huh? Or you mean building in virtual machines?
>>>
>>
>> No, cross compiling for VMs from host as opposed to real hardware.
>
>  What difference does it make whether your target is a VM or real hardware?
>
>  Regards,
>  Arnout
>
> [snip]
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

end of thread, other threads:[~2018-05-09  6:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 19:15 [Buildroot] [RFC PATCH 1/1] core: add option to disable RPATH sanitation in target tree Ciro Santilli
2018-05-03 21:16 ` Arnout Vandecappelle
2018-05-03 21:21   ` Ciro Santilli
2018-05-03 21:27     ` Arnout Vandecappelle
2018-05-03 21:58       ` Ciro Santilli
2018-05-09  6:12       ` Ciro Santilli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.