n***@gmail.com
2020-07-20 03:32:20 UTC
Hi Everyone,
I'm trying to build Perl 5.32.0 from sources on Solaris 11.3 i86pc. Perl screws up runpath options in LDFLAGS so I need to fix them using elfedit(1). Perl won't fix their bug so waiting is not an option; see https://github.com/Perl/perl5/issues/17978.
I have two runpaths as follows. '$ORIGIN' is a literal and includes the dollar sign. Also see https://blogs.oracle.com/solaris/avoiding-ldlibrarypath%3a-the-options-v2.
RUNPATH="\$ORIGIN/../lib:/export/home/jwalton/tmp/ok2delete/lib"
When I run elfedit manually the runpaths are changed. When elfedit is scripted I get:
elfedit: invalid option -- e
Usage: elfedit <option(s)> elffile(s)
Update the ELF header of ELF files
The options are:
--input-mach <machine> Set input machine type to <machine>
--output-mach <machine> Set output machine type to <machine>
...
There's not much to the script. It finds programs and shared libraries, and runs elfedit on them.
What am I doing wrong here?
==========
THIS_RUNPATH="\$ORIGIN/../lib:/export/home/jwalton/tmp/ok2delete/lib"
echo "Using \"$THIS_RUNPATH\""
# Non-anemic grep
GREP=/usr/gnu/bin/grep
# Find find programs and libraries using the shell wildcard. Some programs
# and libraries are _not_ executable and get missed in the do loop.
IFS="" find . -type f -name '*' -print | while read -r file
do
# Quick smoke test. Object files have ELF signature.
if [[ $(echo "$file" | $GREP -E '\.o$') ]]; then continue; fi
# Check for ELF signature
sig=$(cut -b 2-4 "$file" | head -n 1)
if [[ "x$sig" != "xELF" ]]; then continue; fi
echo "$file" | sed 's/^\.\///g'
chmod a+w "$file"
elfedit -e "dyn:rpath $THIS_RUNPATH" "$file"
elfedit -e "dyn:runpath $THIS_RUNPATH" "$file"
chmod go-w "$file"
done
I'm trying to build Perl 5.32.0 from sources on Solaris 11.3 i86pc. Perl screws up runpath options in LDFLAGS so I need to fix them using elfedit(1). Perl won't fix their bug so waiting is not an option; see https://github.com/Perl/perl5/issues/17978.
I have two runpaths as follows. '$ORIGIN' is a literal and includes the dollar sign. Also see https://blogs.oracle.com/solaris/avoiding-ldlibrarypath%3a-the-options-v2.
RUNPATH="\$ORIGIN/../lib:/export/home/jwalton/tmp/ok2delete/lib"
When I run elfedit manually the runpaths are changed. When elfedit is scripted I get:
elfedit: invalid option -- e
Usage: elfedit <option(s)> elffile(s)
Update the ELF header of ELF files
The options are:
--input-mach <machine> Set input machine type to <machine>
--output-mach <machine> Set output machine type to <machine>
...
There's not much to the script. It finds programs and shared libraries, and runs elfedit on them.
What am I doing wrong here?
==========
THIS_RUNPATH="\$ORIGIN/../lib:/export/home/jwalton/tmp/ok2delete/lib"
echo "Using \"$THIS_RUNPATH\""
# Non-anemic grep
GREP=/usr/gnu/bin/grep
# Find find programs and libraries using the shell wildcard. Some programs
# and libraries are _not_ executable and get missed in the do loop.
IFS="" find . -type f -name '*' -print | while read -r file
do
# Quick smoke test. Object files have ELF signature.
if [[ $(echo "$file" | $GREP -E '\.o$') ]]; then continue; fi
# Check for ELF signature
sig=$(cut -b 2-4 "$file" | head -n 1)
if [[ "x$sig" != "xELF" ]]; then continue; fi
echo "$file" | sed 's/^\.\///g'
chmod a+w "$file"
elfedit -e "dyn:rpath $THIS_RUNPATH" "$file"
elfedit -e "dyn:runpath $THIS_RUNPATH" "$file"
chmod go-w "$file"
done