libtool
[Top][All Lists]
Advanced

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

Re: revisiting condor and libtool


From: Ralf Wildenhues
Subject: Re: revisiting condor and libtool
Date: Tue, 1 Dec 2009 19:54:34 +0100
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Adam,

please trim stuff that you don't refer to from replies, thanks.

* Adam Mercer wrote on Tue, Dec 01, 2009 at 05:48:46PM CET:
> src/bar.c
> 
> #include <stdio.h>
> #include "config.h"

BTW, you should usually include config.h as very first header,
because it can influence the behavior of system headers.

> int bar(void)
> {
>   fprintf(stdout, "Hello world, from libbar.bar()!\n");
>   return 0;
> }
[...]
> which builds, and installs to $HOME/tmp, successfully,

You didn't state whether you built this with --disable-static or some
other interesting flags, and whether both static and shared versions of
libbar were created and installed.

> I then modified
> the condor_libtool example to link against this by adding:
> 
> AC_CHECK_LIB([bar],[bar],,[AC_MSG_ERROR([cannot find bar library])])
> AC_CHECK_HEADERS([bar.h],,[AC_MSG_ERROR([cannot find headers from libbar])])
> 
> and then configured this new code with
> 
> $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/tmp/lib
> $ CPPFLAGS=-I$HOME/tmp/include LDFLAGS="-L$HOME/tmp/lib -lbar"

BTW, the -lbar usually goes in LIBS, so that it comes after the stuff
that links against libbar.  Whether you put -L$HOME/tmp/lib in LDFLAGS
or LIBS depends on whether it should be used for other deplibs too.  I
usually leave it it LDFLAGS.  Not sure whether this would make a
difference for your issue, though.

> ./configure --enable-condor LD=/opt/condor/lib/ld
> 
> which results in a successful configure, but now make fails with:
> 
> /bin/sh ../libtool --tag=CC   --mode=link condor_compile gcc
> -std=gnu99  -g -O2  -L/home/ram/tmp/lib -lbar -o foo foo.o  -lbar
> libtool: link: condor_compile gcc -std=gnu99 -g -O2 -o foo foo.o
> -L/home/ram/tmp/lib /home/ram/tmp/lib/libbar.so -Wl,-rpath
> -Wl,/home/ram/tmp/lib -Wl,-rpath -Wl,/home/ram/tmp/lib
> LINKING FOR CONDOR : /usr/bin/ld -L/opt/condor/lib -Bstatic
> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker
> /lib64/ld-linux-x86-64.so.2 -o foo /opt/condor/lib/condor_rt0.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginT.o -L/home/ram/tmp/lib
> -L/opt/condor/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64
> -L/lib/../lib64 -L/usr/lib/../lib64 foo.o /home/ram/tmp/lib/libbar.so
> -rpath /home/ram/tmp/lib -rpath /home/ram/tmp/lib
> /opt/condor/lib/libcondorsyscall.a /opt/condor/lib/libcondor_z.a
> /opt/condor/lib/libcomp_libstdc++.a /opt/condor/lib/libcomp_libgcc.a
> /opt/condor/lib/libcomp_libgcc_eh.a --as-needed --no-as-needed
> -lcondor_c -lcondor_nss_files -lcondor_nss_dns -lcondor_resolv
> -lcondor_c -lcondor_nss_files -lcondor_nss_dns -lcondor_resolv
> -lcondor_c /opt/condor/lib/libcomp_libgcc.a
> /opt/condor/lib/libcomp_libgcc_eh.a --as-needed --no-as-needed
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o
> /usr/bin/ld: attempted static link of dynamic object
> `/home/ram/tmp/lib/libbar.so'
> collect2: ld returned 1 exit status
> 
> which is a similar error to what I am getting with the main code, ie
> condor_compile is wanting to link a shared library into a static
> executable.

Well, the -Bstatic seems to be added by condor_compile, because it is
not part of the libtool output.

> I reconfigured adding the --disable-shared option to
> configure results in exactly the same error.

--disable-shared does not disable linking against shared libraries,
it only disables creating shared libraries.  To disable dynamic linking
against uninstalled libtool libraries, use -static in the link flags, to
disable dynamic linking against any libtool libraries, use
-static-libtool-libs, and to disable dynamic linking against all
libraries, use -all-static; e.g.,
  foo_LDFLAGS = $(AM_LDFLAGS) -all-static

libtool does not currently support linking only some libraries static,
but there is a proposed patch to add this functionality.

Cheers,
Ralf




reply via email to

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