[Buildroot] [PATCH v8 03/10] support/scripts: add fix-rpath script to sanitize the rpath

Arnout Vandecappelle arnout at mind.be
Thu Jul 20 21:05:59 UTC 2017



On 20-07-17 22:49, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 20 Jul 2017 16:35:14 +0200, Wolfgang Grandegger wrote:
>> From: Samuel Martin <s.martin49 at gmail.com>
>>
>> This commit introduces the script "fix-rpath" able to scan a tree,
>> detect ELF files, check their RPATH and fix it in a proper way.
>> The RPATH fixup is done by the patchelf utility using the option
>> "--make-rpath-relative <root-directory>".
>>
>> Signed-off-by: Samuel Martin <s.martin49 at gmail.com>
>> Signed-off-by: Wolfgang Grandegger <wg at grandegger.com>
>> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
>> ---
>>  support/scripts/fix-rpath | 133 ++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 133 insertions(+)
>>  create mode 100755 support/scripts/fix-rpath
> 
> I've applied to master, after removing trailing slashes.

 Which trailing slashes?


> However, I noticed that when patchelf is not available in HOST_DIR,
> this script does nothing, but doesn't show any error:
> 
> thomas at windsurf:~/projets/buildroot (master)$ rm output/host/usr/bin/patchelf 
> thomas at windsurf:~/projets/buildroot (master)$ make
> [...]
>>>>   Sanitizing RPATH in target tree
> /home/thomas/projets/buildroot/support/scripts/fix-rpath target
> thomas at windsurf:~/projets/buildroot (master)$
> 
> This is a little bit disturbing, so I believe it should be fixed in a
> follow-up patch.

 Right! That's because the "if ${PATCHELF} ..." just fails and the error is
redirected to /dev/null.

 Better check if ${PATCHELF} is executable somewhere in the beginning.

 However, there is never a guarantee. If e.g. it would be missing a shared
library, it would still fail in the same way. To be really sure, you'd have do
e.g. call patchelf on itself to verify it is actually working.

 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


More information about the buildroot mailing list