From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC PATCH v3 00/10] Make the SDK relocatable
Date: Wed, 21 Jun 2017 23:03:08 +0200 [thread overview]
Message-ID: <dec2b16c-50f5-15d2-2082-c31ca82170ec@mind.be> (raw)
In-Reply-To: <8b074253-3002-1db9-d902-a73bb47e734b@grandegger.com>
Hi Wolfgang,
On 21-06-17 09:59, Wolfgang Grandegger wrote:
> Hello,
>
> this topic is still pending... some more input below...
>
> Am 27.04.2017 um 11:37 schrieb Wolfgang Grandegger:
>> Hello Arnout,
>>
>> Am 12.04.2017 um 15:59 schrieb Arnout Vandecappelle:
>>>
>>>
>>> On 23-03-17 08:54, Wolfgang Grandegger wrote:
>>>> Hello,
>>>>
>>>> this is v3 of my RFC patch series to make the buildroot SDK (HOST_DIR)
>>>> relocatable. It sanitizes the RPATH of all ELF files in the "target"
>>>> and "host" tree using "patchelf --make-rpath-relative". I have started
>>>> the mainlining process implementing "--make-rpath-relative" using
>>>> GitHub pull request [1]... till now, no answer!
>>>>
>>>> Furthermore this patch creates the script "relocate-sdk.sh" in the top
>>>> directory of the "host" tree allowing to relocate the SDK after it has
>>>> been moved to a new location. It replaces the old path with the new
>>>> one in all text files identified by "file --mime-type". The location
>>>> is stored in "usr/share/buildroot/sdk-location".
>>>>
>>>> Unfortunately, "qmake" uses hard-coded pathes compiled into the QT5
>>>> libraries. To overcome this problem, "qt5pase" now creates "qt.conf".
>>>>
>>>> Other Questions:
>>>>
>>>> - Why do we want relative RPATHs starting with "$ORIGIN" also for ELF
>>>> files in the target tree. "/lib" and "/usr/lib" have been removed
>>>> already.
>>>
>>> Good point, I don't think we want that... Neither for the ones in staging, I
>>> suppose. The RPATHs there should all be absolute paths which should be
>>> interpreted relative to $(TARGET_DIR) resp. $(STAGING_DIR).
>>
>> Could be done, no problem. Just requires some further modifications to
>
> I just learned that using relative path for the target breaks "sudo", at least.
So if you change sudo's RPATH to $ORIGIN/../libexec/sudo it doesn't find
libsudo_util.so.0 at runtime? Or how does it break?
> I'm going to rework patchelf...
>
>> patchelf. BTW, so far I have not received any response to my related Github
>> pull request... like many others:
>>
>> https://github.com/NixOS/patchelf/pulls
>>
>> The project seems not really to be maintained... or I use the wrong channel.
>> In principle we could maintain your own version.
>
> I have little hope that we can get this patch accepted. Nobody seems to care :(.
> What about maintaining our own version?
Since we need just a single patch for the time being, I think maintaining it as
a patch is sufficient.
>>> I'm not entirely sure about staging, whether ld will use RPATH as an
>>> alternative to -L and in that case whether it is done relative to sysroot or
>>> not.
>>
>> So far, the patch series works for me very well. Just my usecase, of course.
IIRC I checked a while ago and it looked like ld would use RPATH as a link path
(i.e. as if it's given with -L), and I think it was NOT relative to sysroot.
Which means that we shouldn't make the RPATHs in staging relative to
STAGING_DIR, otherwise it may pick up the library from the host. This really
shouldn't happen because the link normally should get the appropriate -L flag to
find the target lib and the -L has precedence over RPATH, but better be safe.
Again, I don't remember exactly so the previous paragraph could be entirely
wrong :-)
>>>> Things not yet addressed:
>>>>
>>>> - "make toolchain" creates a toolchain tree which still has references
>>>> to the build system (in ELF and text files).
>>>
>>> A solution to this (and other problems) is to use the same approach as
>>> check-bin-arch: do it as an instrumentation hook for each package, and only look
>>> at the files added by that package. That way, the overhead is spread out over
>>> the entire build process, and doing rebuilds doesn't run patchelf on all files
>>> anymore in the finalize step.
>>
>> This is just to solve the issue mentioned above or a general approach (instead
>> of doning rtpath sanitation at the end)?
>
> Any opinions here?
Preferably as an instrumentation hook, because:
- it speeds things up dramatically if you do 'make foo-rebuild';
- things are still correct if you interrupt the build in the middle;
- it makes no difference if you do a rebuild (if patchelf is done at the end,
and then you rebuild a package, the RPATH in the libs you link with is different
than the first time you built it).
>> How should I go ahead to get this patch series accepted sooner than later? We
>> could make the option configurable, for example, to reduce the risk of
>> breaking something.
>
> Is a relocatable SDK still on the wish list? How should/could I proceed to get
> the feature accepted sooner than later?
You should pray that someone takes the time to continue the review :-)
Occasionally drawing attention to the series like you do know definitely helps.
Regards,
Arnout
--
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
next prev parent reply other threads:[~2017-06-21 21:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 7:54 [Buildroot] [RFC PATCH v3 00/10] Make the SDK relocatable Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 01/10] package/patchelf: use most recent version as a base for rpath sanitation Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 02/10] package/patchelf: add patch for rpath sanitation under a root directory Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 03/10] support/scripts: add fix-rpath script to sanitize the rpath Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 04/10] core: sanitize RPATH in host tree at the very end of the build Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 05/10] core: sanitize RPATH in target tree at the end of the target finalization Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 06/10] support/scripts: add reloacte-sdk.sh script for SDK relocation Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 07/10] core: install relocation script and location at the end of the build Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 08/10] external-toolchain: check if a buildroot SDK has already been relocated Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 09/10] support/scripts: check-host-rpath now handles $ORIGIN as well Wolfgang Grandegger
2017-03-23 7:54 ` [Buildroot] [RFC PATCH v3 10/10] package/qt5base: provide "qt.conf" to make "qmake" relocatable Wolfgang Grandegger
2017-04-12 13:59 ` [Buildroot] [RFC PATCH v3 00/10] Make the SDK relocatable Arnout Vandecappelle
2017-04-27 9:37 ` Wolfgang Grandegger
2017-06-21 7:59 ` Wolfgang Grandegger
2017-06-21 21:03 ` Arnout Vandecappelle [this message]
2017-06-21 21:06 ` Arnout Vandecappelle
2017-06-27 10:54 ` Wolfgang Grandegger
2017-06-27 22:41 ` Arnout Vandecappelle
2017-06-28 6:51 ` Wolfgang Grandegger
2017-06-28 10:44 ` Arnout Vandecappelle
2017-06-28 10:59 ` Wolfgang Grandegger
2017-06-22 6:37 ` Wolfgang Grandegger
2017-06-27 22:47 ` Arnout Vandecappelle
2017-06-28 6:40 ` Peter Korsgaard
2017-06-28 6:45 ` Wolfgang Grandegger
2017-06-28 10:41 ` Arnout Vandecappelle
2017-06-28 10:57 ` Wolfgang Grandegger
2017-06-28 11:16 ` Arnout Vandecappelle
2017-06-28 12:36 ` Wolfgang Grandegger
2017-06-28 19:33 ` Arnout Vandecappelle
2017-06-29 6:13 ` Wolfgang Grandegger
2017-06-29 8:02 ` Wolfgang Grandegger
2017-06-30 8:50 ` Wolfgang Grandegger
2017-06-30 9:14 ` Wolfgang Grandegger
2017-06-30 10:25 ` Arnout Vandecappelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dec2b16c-50f5-15d2-2082-c31ca82170ec@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox