libtool
[Top][All Lists]
Advanced

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

Re: revisiting condor and libtool


From: Adam Mercer
Subject: Re: revisiting condor and libtool
Date: Tue, 1 Dec 2009 10:48:46 -0600

On Tue, Dec 1, 2009 at 00:26, Ralf Wildenhues <address@hidden> wrote:

> Yes, the condor_compile script puts the quotes all in the wrong places.
> To work around it, use AC_CONFIG_HEADERS([config.h]) and include that
> from your code.  Your build setup looks ok otherwise.

Thanks, using AC_CONFIG_HEADERS results in a sucessfull build. But the
main code uses config.h for defines so this is not the main error I
have been running in. In order to make this example more like the main
code I created a very small library to link against, libbar which has
the following configure.ac:

AC_INIT([libbar],[0.1],address@hidden)
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_AUX_DIR([gnuscripts])
AC_CONFIG_MACRO_DIR([gnuscripts])
AC_CONFIG_FILES([ \
  Makefile \
  gnuscripts/Makefile
  src/Makefile
])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST
AC_PROG_CC_STDC
LT_INIT
AC_OUTPUT

with src/Makefile.am

INCLUDES = -I$(top_builddir)/src
libbarincludedir = $(includedir)
libbarinclude_HEADERS = bar.h
lib_LTLIBRARIES = libbar.la
libbar_la_SOURCES = bar.c

src/bar.c

#include <stdio.h>
#include "config.h"
int bar(void)
{
  fprintf(stdout, "Hello world, from libbar.bar()!\n");
  return 0;
}

src/bar.h

#include <stdio.h>
int bar(void);

which builds, and installs to $HOME/tmp, successfully, 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"
./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. I reconfigured adding the --disable-shared option to
configure results in exactly the same error.

Can anyone see anything in my configure.ac that could explain this, or
is this another problem with condor_compile?

Cheers

Adam

> Below's a completely untested patch for condor_compile, to fix the worst
> quoting issues I found upon inspection.  The patch is completely
> untested, but if you could test it, I'd like to ask you to send it
> upstream, too.  Thanks.
>
> Cheers,
> Ralf
>
>
> --- ./src/condor_scripts/condor_compile.orig    2009-12-01 07:14:37.000000000 
> +0100
> +++ ./src/condor_scripts/condor_compile 2009-12-01 07:22:29.000000000 +0100
> @@ -134,35 +134,35 @@
>        fi
>
>
> -       if [ $1 = "-condor_syscall_lib" ]; then
> +       if [ "$1" = "-condor_syscall_lib" ]; then
>                shift
>                CONDOR_SPECIAL_CLIB=$1
>                shift
>                continue
>        fi
>
> -       if [ $1 = "-condor_rt0" ]; then
> +       if [ "$1" = "-condor_rt0" ]; then
>                shift
>                CONDOR_RT0=$1
>                shift
>                continue
>        fi
>
> -       if [ $1 = "-condor_c++_support" ]; then
> +       if [ "$1" = "-condor_c++_support" ]; then
>                shift
>                CONDOR_CPLUS=$1
>                shift
>                continue
>        fi
>
> -       if [ $1 = "-condor_ld_dir" ]; then
> +       if [ "$1" = "-condor_ld_dir" ]; then
>                shift
>                CONDOR_LD_DIR=$1
>                shift
>                continue
>        fi
>
> -       if [ $1 = "-condor_standalone" ]; then
> +       if [ "$1" = "-condor_standalone" ]; then
>                #
>                # This option is ignored.  Standalone checkpointing
>                # has the same build procedure as standard jobs now.
> @@ -172,7 +172,7 @@
>                continue
>        fi
>
> -       if [ $1 = "-condor_lib" ]; then
> +       if [ "$1" = "-condor_lib" ]; then
>                shift
>                CONDOR_LIBDIR=$1
>                shift
> @@ -194,7 +194,7 @@
>  # If the compressed ckpt library is available, use it.
>  #
>
> -if [ -r $CONDOR_ZCLIB ]; then
> +if [ -r "$CONDOR_ZCLIB" ]; then
>        CONDOR_CLIB="$CONDOR_ZCLIB"
>  fi
>
> @@ -204,7 +204,7 @@
>
>  CONDOR_CLIB="$CONDOR_CLIB $STATIC_ZLIB"
>
> -if [ -r $CONDOR_SPECIAL_CLIB ]; then
> +if [ -r "$CONDOR_SPECIAL_CLIB" ]; then
>        CONDOR_CLIB="$CONDOR_SPECIAL_CLIB"
>  fi
>
> @@ -315,23 +315,18 @@
>  # hit our special ld
>
>  if [ $CONDOR_FULLINSTALL = true ]; then
> -       invoke_linker $*
> +       invoke_linker "$@"
>  fi
>
>  # If we were passed a -c, we're not going to be used for linking, so
>  # we don't have to do anything special to make sure our special ld is
>  # used.
> -ARGS=$*
>  NAME=$1
> -while [ A = A ]
> +for arg
>  do
> -       if [ $# = 0 ]; then
> -               break;
> +       if [ "$arg" = "-c" ]; then
> +               exec "$@"
>        fi
> -       if [ $1 = "-c" ]; then
> -               exec $ARGS;
> -       fi
> -       shift
>  done
>
>
> @@ -346,19 +341,19 @@
>  # Handle GNU compilers
>
>  if [ $myname = "gcc" ]; then
> -       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +       invoke_linker "$@" -B$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "g++" ]; then
> -       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +       invoke_linker "$@" -B$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "g77" ]; then
> -       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +       invoke_linker "$@" -B$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "gfortran" ]; then
> -       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +       invoke_linker "$@" -B$CONDOR_LD_DIR/
>  fi
>
>  # Handle Portland compilers.
> @@ -366,19 +361,19 @@
>  # Their run-time support libraries conflict with libcondorc++support.a
>
>  if [ $myname = "pgcc" ]; then
> -       invoke_linker $ARGS -Yl,$CONDOR_LD_DIR/
> +       invoke_linker "$@" -Yl,$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "pgf77" ]; then
> -       invoke_linker $ARGS -Yl,$CONDOR_LD_DIR/
> +       invoke_linker "$@" -Yl,$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "pgf90" ]; then
> -       invoke_linker $ARGS -Yl,$CONDOR_LD_DIR/
> +       invoke_linker "$@" -Yl,$CONDOR_LD_DIR/
>  fi
>
>  if [ $myname = "pghpf" ]; then
> -       invoke_linker $ARGS -Yl,$CONDOR_LD_DIR/
> +       invoke_linker "$@" -Yl,$CONDOR_LD_DIR/
>  fi
>
>  # Handle ld (linker).  Since the user might have specified a full path
> @@ -386,7 +381,7 @@
>  # call our ld directly with the remaining arguments.
>  if [ $myname = "ld" ]; then
>        shift;
> -       invoke_linker $CONDOR_LD_DIR/ld $ARGS
> +       invoke_linker $CONDOR_LD_DIR/ld "$@"
>  fi
>
>  # Handle all the vendor system compilers ---------------
> @@ -403,45 +398,45 @@
>                if [ $myname = "cc" ]; then
>                        VCCRET=`cc -tul 2>&1 | head -1 | grep 'WARNING'`
>                        if [ "X$VCCRET" = "X" ]; then
> -                               invoke_linker $ARGS -tul -h$CONDOR_LD_DIR -B
> +                               invoke_linker "$@" -tul -h$CONDOR_LD_DIR -B
>                        else
> -                               invoke_linker $ARGS -Y l,$CONDOR_LD_DIR -B 
> dynamic
> +                               invoke_linker "$@" -Y l,$CONDOR_LD_DIR -B 
> dynamic
>                        fi
>                fi
>
>                if [ $myname = "CC" ]; then
>                        VCPPRET=`CC -tul 2>&1 | head -1 | grep 'WARNING'`
>                        if [ "X$VCPPRET" = "X" ]; then
> -                               invoke_linker $ARGS -tul -h$CONDOR_LD_DIR -B
> +                               invoke_linker "$@" -tul -h$CONDOR_LD_DIR -B
>                        else
> -                               invoke_linker $ARGS -Y l,$CONDOR_LD_DIR -B 
> dynamic
> +                               invoke_linker "$@" -Y l,$CONDOR_LD_DIR -B 
> dynamic
>                        fi
>                fi
>
>                if [ $myname = "c89" ]; then
>                        VC89RET=`c89 -tul 2>&1 | head -1 | grep 'WARNING'`
>                        if [ "X$VC89RET" = "X" ]; then
> -                               invoke_linker $ARGS -tul -h$CONDOR_LD_DIR -B
> +                               invoke_linker "$@" -tul -h$CONDOR_LD_DIR -B
>                        else
> -                               invoke_linker $ARGS -Y l,$CONDOR_LD_DIR -B 
> dynamic
> +                               invoke_linker "$@" -Y l,$CONDOR_LD_DIR -B 
> dynamic
>                        fi
>                fi
>
>                if [ $myname = "f77" ]; then
>                        VF77RET=`f77 -tul 2>&1 | head -1 | grep 'WARNING'`
>                        if [ "X$VF77RET" = "X" ]; then
> -                               invoke_linker $ARGS -tul -h$CONDOR_LD_DIR -B
> +                               invoke_linker "$@" -tul -h$CONDOR_LD_DIR -B
>                        else
> -                               invoke_linker $ARGS -Y l,$CONDOR_LD_DIR -B 
> dynamic
> +                               invoke_linker "$@" -Y l,$CONDOR_LD_DIR -B 
> dynamic
>                        fi
>                fi
>
>                if [ $myname = "f90" ]; then
>                        VF90RET=`f90 -tul 2>&1 | head -1 | grep 'WARNING'`
>                        if [ "X$VF90RET" = "X" ]; then
> -                               invoke_linker $ARGS -tul -h$CONDOR_LD_DIR -B
> +                               invoke_linker "$@" -tul -h$CONDOR_LD_DIR -B
>                        else
> -                               invoke_linker $ARGS -Y l,$CONDOR_LD_DIR -B 
> dynamic
> +                               invoke_linker "$@" -Y l,$CONDOR_LD_DIR -B 
> dynamic
>                        fi
>                fi
>
> @@ -449,31 +444,31 @@
>
>        OSF1 )
>                if [ $myname = "cc" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "CC" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "cxx" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "c89" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "f77" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "f90" ]; then
> -                       invoke_linker $ARGS -tl -h$CONDOR_LD_DIR -B
> +                       invoke_linker "$@" -tl -h$CONDOR_LD_DIR -B
>                fi
>
>                if [ $myname = "KCC" ]; then
> -                       invoke_linker $ARGS --backend -tl --backend \
> +                       invoke_linker "$@" --backend -tl --backend \
>                        -h$CONDOR_LD_DIR --backend -B
>                fi
>
> @@ -481,27 +476,27 @@
>
>        HP-UX )
>                if [ $myname = "cc" ]; then
> -                       invoke_linker $ARGS -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                if [ $myname = "CC" ]; then
> -                       invoke_linker $ARGS +A -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" +A -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                if [ $myname = "aCC" ]; then
> -                       invoke_linker $ARGS +A -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" +A -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                if [ $myname = "c89" ]; then
> -                       invoke_linker $ARGS -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                if [ $myname = "f77" ]; then
> -                       invoke_linker $ARGS -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                if [ $myname = "fort77" ]; then
> -                       invoke_linker $ARGS -tl,$CONDOR_LD_DIR/ld
> +                       invoke_linker "$@" -tl,$CONDOR_LD_DIR/ld
>                fi
>
>                ;;
> @@ -509,26 +504,26 @@
>        SunOS )
>                use_qpath=`cc -help -flags | grep Qpath | wc -l`
>                if [ $myname = "cc" -a $use_qpath = 0 ]; then
> -                       invoke_linker $ARGS -Yl,$CONDOR_LD_DIR
> +                       invoke_linker "$@" -Yl,$CONDOR_LD_DIR
>                fi
>                if [ $myname = "cc" -a $use_qpath != 0 ]; then
> -                       invoke_linker $ARGS -Qpath $CONDOR_LD_DIR
> +                       invoke_linker "$@" -Qpath $CONDOR_LD_DIR
>                fi
>
>                if [ $myname = "acc" ]; then
> -                       invoke_linker $ARGS -Qpath $CONDOR_LD_DIR
> +                       invoke_linker "$@" -Qpath $CONDOR_LD_DIR
>                fi
>
>                if [ $myname = "CC" ]; then
> -                       invoke_linker $ARGS -Qpath $CONDOR_LD_DIR
> +                       invoke_linker "$@" -Qpath $CONDOR_LD_DIR
>                fi
>
>                if [ $myname = "f77" ]; then
> -                       invoke_linker $ARGS -Qpath $CONDOR_LD_DIR
> +                       invoke_linker "$@" -Qpath $CONDOR_LD_DIR
>                fi
>
>                if [ $myname = "f90" ]; then
> -                       invoke_linker $ARGS -Qpath $CONDOR_LD_DIR
> +                       invoke_linker "$@" -Qpath $CONDOR_LD_DIR
>                fi
>
>                ;;
> @@ -536,23 +531,23 @@
>        Linux )
>                # Linux's system compilers are GNU
>                if [ $myname = "cc" ]; then
> -                       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +                       invoke_linker "$@" -B$CONDOR_LD_DIR/
>                fi
>
>                if [ $myname = "CC" ]; then
> -                       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +                       invoke_linker "$@" -B$CONDOR_LD_DIR/
>                fi
>
>                if [ $myname = "c++" ]; then
> -                       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +                       invoke_linker "$@" -B$CONDOR_LD_DIR/
>                fi
>
>                if [ $myname = "f77" ]; then
> -                       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +                       invoke_linker "$@" -B$CONDOR_LD_DIR/
>                fi
>
>                if [ $myname = "gfortran" ]; then
> -                       invoke_linker $ARGS -B$CONDOR_LD_DIR/
> +                       invoke_linker "$@" -B$CONDOR_LD_DIR/
>                fi
>
>                ;;
>




reply via email to

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