[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool - warnings when installing GMP using DESTDIR

From: Robert Boehne
Subject: Re: libtool - warnings when installing GMP using DESTDIR
Date: Fri, 20 Sep 2013 07:34:02 -0500

The relinking warning is just to let you know it is linking, it isn't a potential problem.

Robert Boehne

On Sep 19, 2013 6:21 PM, "Michael Young" <address@hidden> wrote:
I was originally going to post this to the gmp-discuss list, but after reviewing
it, it seems like it fits better here.  Please kindly redirect me if this is
better handled elsewhere...

I'm trying to do a staged build/install of libgmp(xx) release 5.1.2.  This is
part of an effort to develop a "general" build system (mostly bash scripts, make
files, etc.) for toolchains I will be using.  I intend to use these scripts to
build both native and cross-builds, depending on configuration / arguments, so
using DESTDIR for prefixing the install tree is important.  Right now, I'm 
working on native builds on an Ubuntu 12.04 32-bit x86 machine; libtool 
version = 2.4.2.)

When building/installing gmp, I use DESTDIR with make install (as follows, with
the configured prefix being 
"/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install"), as follows:

   make install DESTDIR=/home/youngmj/tmp

I get the following warning / output:

libtool: install: warning: relinking `'
libtool: install: (cd /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/build; /bin/bash /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/build/libtool  --tag CXX --mode=relink g++ -version-info 7:2:3 -o -rpath /home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib dummy.lo cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo -inst-prefix-dir /home/youngmj/tmp)
libtool: relink: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6/crtbeginS.o  .libs/dummy.o cxx/.libs/isfuns.o cxx/.libs/ismpf.o cxx/.libs/ismpq.o cxx/.libs/ismpz.o cxx/.libs/ismpznw.o cxx/.libs/limits.o cxx/.libs/osdoprnti.o cxx/.libs/osfuns.o cxx/.libs/osmpf.o cxx/.libs/osmpq.o cxx/.libs/osmpz.o   -Wl,-rpath -Wl,/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib -L/home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib -L/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib -lgmp -L/usr/lib/gcc/i686-linux-gnu/4.6 -L/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L. -L/usr/lib/gcc/i686-linux-gnu/4.6/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.6/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crtn.o    -Wl,-soname -Wl, -o .libs/
libtool: install: /usr/bin/install -c .libs/ /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/
libtool: install: (cd /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib && { ln -s -f || { rm -f && ln -s; }; })
libtool: install: (cd /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib && { ln -s -f || { rm -f && ln -s; }; })
libtool: install: /usr/bin/install -c .libs/libgmpxx.lai /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/
libtool: install: /usr/bin/install -c .libs/libgmp.a /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmp.a
libtool: install: chmod 644 /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmp.a
libtool: install: ranlib /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmp.a
libtool: install: /usr/bin/install -c .libs/libgmpxx.a /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmpxx.a
libtool: install: chmod 644 /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmpxx.a
libtool: install: ranlib /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/libgmpxx.a
libtool: install: warning: remember to run `libtool --finish /home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib'

[BTW - the "T" in the .so library version (4th line) looks wierd... can anyone
verify this is OK?]

The second warning is not the primary problem - I run the finish command once I 
move the installation into place.  The first warning (relinking) is what I'm most 
concerned about. I see where the warning is coming from - the following is in after the build and verification (make check), but prior to install:

# Libraries that this one depends upon.
dependency_libs=' /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/build/'
# Directory that this library needs to be installed in:
relink_command="(cd /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/build; /bin/bash /home/youngmj/tmp/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/build/libtool  --tag CXX --mode=relink g++ -version-info 7:2:3 -o -rpath /home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib dummy.lo cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo @inst_prefix_dir@)"

I did some searching on the web, and I found some discussions for gmp
version 4.1 (circa 2002!) - see here for an example of what I found:
"".  (I also found 
suggested workarounds that set LD_LIBRARY_PATH to include the staging
directory, instead of adding -Lstage_path to libtool's relink.)  However, this
information is ~10 years old.  Libtool may now handle this situation more
elegantly, using -inst-prefix-dir (based on my reading of info here: 

Here's what I *think* I understand:
a) there is a need to relink libgmpxx upon install (for staged installs) to
correctly set rpath (to pick up libgmp) in
b) libtool uses -inst-prefix-dir for this relink to ensure that the relink uses
the correct object files and (from the staging directory), but sets
rpath to the final destination for

I do see that my installed (after moving it to its final destination
and running "libtool --finish" as directed) does have the correct rpath in it:

$ readelf -d /home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib/ | grep RPATH
 0x0000000f (RPATH)                      Library rpath: [/home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib]

For my testing, there was nothing in the final destination directory prior to me
moving the newly built entity there (but this will probably not be the case in
general usage of my build scripts), so the only place that could be
picked up is either in the staging directory or in the default system location
(/usr/lib/i386-linux-gnu), as there is no version of this library elsewhere in 

Based on what I see in (as copied above, from "dependency_libs" and
"relink_command" lines), I would *assume* that is being picked up from
the staging directory when relinking, although I don't know how I can verify
this.  But if this is the case, why is libtool issuing a warning?  Is this
really just a red herring, and only there for "informational" purposes, or am I
doing something wrong/questionable?

Lastly, as I previously mentioned, I run the "libtool --finish" command as
directed.  (For "native" builds, this command is performed on the build machine
itself, but for cross-builds, I assume it is to be performed on the target 
machine once the library files are moved into place.)  But I'm very confused
about what it actually does.  From my readings, and looking at the output from
the command (at bottom), I gather that it sets the library search path for the
system - using ldconfig - so users can pick up the newly installed (libgmp)
library.  But if it's really doing that,
a) why am I not seeing any change via ldconfig?  (Perhaps I need to run the
finish command using sudo?)  
b) why is the output stating that I need to set LD_LIBRARY_PATH or edit/add a 
*.conf file when I use ld (vs. libtool)?
Based on observation, I can only conclude it's NOT actually making changes to 
the system configuration via ldconfig.  If it's only processing the specified
path, not updating the linker cache, and not updating the configuration files
( or its includes), what is it doing?  The only thing that I could
detect that it does is create the libtool control (.la) files for the newly
installed libraries.  Can anyone confirm that this is the case?

In truth, this is really what I think I want.  I don't want libtool to update
system configuration files because I will have multiple (native + cross-builds,
all different versions) toolchains and libraries on my build system and do not
want to "disturb"/replace the "default" system configuration.  I was not
intending to use automake/libtool for my own projects that use the built tools,
and I was expecting to explicitly set LD_LIBRARY_PATH to pull in the correct
(libgmp) libraries.  Other than being somewhat of a maintenance headache (hence,
I'm developing a "SET_BUILD_ENVIRONMENT" utility script to simplify things for
using the tools and libraries), is there any reason this won't work?  If 
"libtool --finish" only creates the .la files (and not affect system 
configuration), I'll still do it, since other tools (e.g., gcc) may use gmp and

Thanks for any feedback/insight.
  - Michael

libtool: finish: PATH="xxx__my_path__xxx" ldconfig -n /home/youngmj/DevTools_3/gmp/Version_5.1.2/gmp__native/install/lib
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]