[collectd] Building RPM on AWS - RPATH failures

Dan Fandrich dan at coneharvesters.com
Wed Jan 22 21:56:24 CET 2014


On Wed, Jan 22, 2014 at 09:10:53AM +0000, Dan Scott wrote:
> On 22 January 2014 09:06, Dan Scott <dan at danieljamesscott.org> wrote:
> 
>     On 21 January 2014 20:29, Dan Fandrich <dan at coneharvesters.com> wrote:
> 
>         On Tue, Jan 21, 2014 at 08:35:17AM +0000, Dan Scott wrote:
>         > I've attached the rpmbuild SPEC file. The relevant lines are:
>         >
>         > %build
>         > %configure --enable-java --with-java=%{java_home}/ --disable-battery
>         > --disable-rpath
>         > %{__make} %{?_smp_mflags}
> 
>         Those macros can hide a lot. What is the actual configure line?  And
>         what are
>         the actual link lines for one of the binaries that's at issue?
>         Running ./configure --help | grep rpath doesn't actually show me any
>         such option
>         as --disable-rpath when I try it.  There is one hard-coded -Wl,-rpath
>         line in
>         the configure.ac file tha takes effect when linking with libjvm.so.
>         It's
>         possible that is being used, but it would only be a "standard" location
>         if your
>         libjvm.so is in /usr/lib or /usr/lib64, etc., which is unlikely. It
>         could be
>         coming from a pkgconfig source as well. Can you search the config.log
>         file to
>         see where this is being added?
> 
> 
>     The actual configure line is:
> 
>     + ./configure --build=x86_64-redhat-linux --host=x86_64-redhat-linux
>     --target=x86_64-amazon-linux-gnu --program-prefix= --prefix=/usr
>     --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
>     --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
>     --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib
>     --mandir=/usr/share/man --infodir=/usr/share/info --enable-java --with-java
>     =/usr/lib/jvm/java/ --disable-battery --disable-rpath
> 
>     I found these lines related to rpath in the config.log. Is this what you
>     mean?

Yes, but the lines in isolation won't help much without the context of where
they appear in the log. The idea is to find the first instance of an rpath line
that RPM is complaining about and find how it got added.

>     configure:10697: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic   -Wl,-rpath -Wl,/foo conftest.c  >&5

I suspect this is a generic test of the rpath option or the linker. It's not
the one we're looking for.

>     configure:20901: Building with JAVA_LDFLAGS set to:  -L/usr/lib/jvm/java/
>     jre/lib/amd64/server -Wl,-rpath -Wl,/usr/lib/jvm/java/jre/lib/amd64/server
> 
>     configure:21070: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic    -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  
>     -L/usr/lib/jvm/java/jre/lib/amd64/server -Wl,-rpath -Wl,/usr/lib/jvm/java/
>     jre/lib/amd64/server conftest.c -ljvm  -ldl  >&5

These are likely the hard-coded instance I mentioned.

>     configure:22916: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic  -D_REE
>     NTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/
>     local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib64/
>     perl5/CORE    -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector
>      -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil
>     -lpthread -lc conftest.c -ldl  >&5
> 
>     configure:22987: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
>     -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
>     -D_FILE_OFFSET_BITS=64  -I/usr/lib64/perl5/CORE    -Wl,-E -Wl,-rpath,/usr/
>     lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/CORE -lperl
>     -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc conftest.c -ldl  >&5
> 
>     configure:23047: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
>     -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
>     -D_FILE_OFFSET_BITS=64  -I/usr/lib64/perl5/CORE  -Wall -Werror   -Wl,-E
>     -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/
>     CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc conftest.c
>     -ldl  >&5

These are clearly from perl, but still not the one we're looking for.

>     configure:37142: running /bin/sh ./configure --disable-option-checking
>     '--prefix=/usr'  '--build=x86_64-redhat-linux' '--host=x86_64-redhat-linux'
>     '--target=x86_64-amazon-linux-gnu' '--program-prefix=' '--exec-prefix=/usr'
>     '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/
>     usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=
>     /usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=
>     /usr/share/man' '--infodir=/usr/share/info' '--enable-java' '--with-java=/
>     usr/lib/jvm/java/' '--disable-battery' '--disable-rpath' 'build_alias=
>     x86_64-redhat-linux' 'host_alias=x86_64-redhat-linux' 'target_alias=
>     x86_64-amazon-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>     -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=
>     generic' 'PKG_CONFIG_PATH=%{_PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/
>     share/pkgconfig' '--enable-ltdl-convenience' --cache-file=/dev/null
>     --srcdir=.
> 
> 
> 
> Sorry, just realised I forgot a link line:
> 
> libtool: link: gcc -shared  -fPIC -DPIC  .libs/disk_la-disk.o   -Wl,-rpath -Wl,
> /usr/lib64 -Wl,-rpath -Wl,/usr/lib64 /usr/lib64/libstatgrab.so -ldl  -O2 -m64
> -mtune=generic   -Wl,-soname -Wl,disk.so -o .libs/disk.so

Hmmm, yet somehow it finally got into this link line. It appears right before 
libstatgrab.so, which is a library whose dependencies are found with
pkg-config, so this is probably it. What is the output of:

  pkg-config --libs libstatgrab

If it includes that rpath line, then you've found your culprit.

>>> Dan



More information about the collectd mailing list