[gmx-users] PGI link error: unknown switch --rpath & attempted static link of dynamic object fftw/lib/libfftw3.so
Mark Abraham
Mark.Abraham at anu.edu.au
Wed Nov 17 04:09:41 CET 2010
On 15/11/2010 11:18 PM, Yudong Sun wrote:
> Hi,
>
> I want to build an all static library because a job running on
> background nodes may not be able to find the dynamic libraries
> installed on the front node in my system.
>
> My configure line for GCC is:
>
> ./configure --prefix=/path-to/gromacs_4.5.3 --enable-mpi
> --enable-double CC=cc CFLAGS=-O3 MPICC=cc
>
> Here I use cc for both C compiler and MPI compiler because it is the
> name of the C compiler wrapper used on my system which is also
> functioning for the MPI C compiler.
>
> The fftw library is pre-installed on my system which is managed by the
> Modules package. When loaded, the fftw module sets the environment
> variables as:
>
> prepend-path LD_LIBRARY_PATH /opt/fftw/3.2.2.1/lib
> setenv FFTW_POST_LINK_OPTS -L/opt/fftw/3.2.2.1/lib
> -Wl,-rpath=/opt/fftw/3.2.2.1/lib -lfftw3 -lfftw3f
> setenv FFTW_INCLUDE_OPTS -I/opt/fftw/3.2.2.1/include
> setenv FFTW_DIR /opt/fftw/3.2.2.1/lib
> setenv FFTW_INC /opt/fftw/3.2.2.1/include
>
> In make, the link line causing the libfftw3 error is:
>
> cc -DHAVE_CONFIG_H -I. -I../../src -I/usr/include/libxml2
> -I../../include
> -DGMXLIBDIR=\"/usr/local/packages/nag/GROMACS/phase2b_4.5.3/share/top\"
> -O3 -MT grompp.o -MD -MP -MF .deps/grompp.Tpo -c -o grompp.o grompp.c
> mv -f .deps/grompp.Tpo .deps/grompp.Po
> /bin/sh ../../libtool --tag=CC --mode=link cc -O3 -o grompp
> grompp.o libgmxpreprocess_mpi_d.la ../mdlib/libmd_mpi_d.la
> ../gmxlib/libgmx_mpi_d.la -lnsl -lm
> cc -O3 -o grompp grompp.o ./.libs/libgmxpreprocess_mpi_d.a
> /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/mdlib/.libs/libmd_mpi_d.a
> ../mdlib/.libs/libmd_mpi_d.a /opt/fftw/3.2.2.1/lib/libfftw3.so
> /usr/lib64/libxml2.so -lz
> /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/gmxlib/.libs/libgmx_mpi_d.a
> ../gmxlib/.libs/libgmx_mpi_d.a -ldl -lnsl -lm -Wl,--rpath
> -Wl,/opt/fftw/3.2.2.1/lib -Wl,--rpath -Wl,/opt/fftw/3.2.2.1/lib
> /opt/cray/xt-asyncpe/3.7.24/bin/cc: INFO: linux target is being used
> /usr/bin/ld: attempted static link of dynamic object
> `/opt/fftw/3.2.2.1/lib/libfftw3.so'
> collect2: ld returned 1 exit status
>
> GCC doesn't support the -rpath flag but it seems not a problem here.
>
> The fftw library has the static and dynamic libraries provided. The
> linker picks the libfftw3.so. This may be relevant to the
> specification in the libfftw3.la:
>
> # libfftw3.la - a libtool library file
> # Generated by ltmain.sh (GNU libtool) 2.2.6 Debian-2.2.6a-4
> #
> # Please DO NOT delete this file!
> # It is necessary for linking the library.
>
> # The name that we can dlopen(3).
> dlname='libfftw3.so.3'
>
> # Names of this library.
> library_names='libfftw3.so.3.2.4 libfftw3.so.3 libfftw3.so'
>
> # The name of the static archive.
> old_library='libfftw3.a'
> # Linker flags that can not go in dependency_libs.
> inherited_linker_flags=' -pthread'
>
> # Libraries that this one depends upon.
> dependency_libs=' -lm'
>
> # Names of additional weak libraries provided by this library
> weak_library_names=''
>
> # Version information for libfftw3.
> current=5
> age=2
> revision=4
>
> # Is this an already installed library?
> installed=yes
>
> # Should we warn about portability when linking against -modules?
> shouldnotlink=no
>
> # Files to dlopen/dlpreopen
> dlopen=''
> dlpreopen=''
>
> # Directory that this library needs to be installed in:
> libdir='/opt/fftw/3.2.2.1/lib'
>
>
> Is there any workaround to instruct the linker to use the static
> libfftw3.a?
Sure. Your compiler is somehow picking up more than the contents of
LD_LIBRARY_PATH (e.g. the rpath stuff), and then something is confusing
it into using libfftw3.so. I think there must be something wrong with
how your FFTW/modules/compiler combination is set up, because I've never
seen GROMACS installation do things this weird.
Accordingly, don't use the modules, and give
LD_FLAGS=/opt/fftw/3.2.2.1/lib/libfftw3.a
Mark
>
> Thanks,
>
> Yudong
>
> Roland Schulz wrote, On 12/11/2010 18:53:
>> Little bit more background/context would help.
>>
>> Do you try to compile an all static library? If so you of course need a
>> static library of fftw. If it is not all static it normally should
>> accept the dynamic fftw. Then please give us the full configure line,
>> the gcc command line of the link step and the full error message.
>>
>> Roland
>>
>> On Fri, Nov 12, 2010 at 12:17 PM, Yudong Sun <yudong at nag.co.uk
>> <mailto:yudong at nag.co.uk>> wrote:
>>
>> Mark Abraham wrote, On 12/11/2010 17:02:
>>
>> On 13/11/2010 3:15 AM, Yudong Sun wrote:
>>
>> Hi,
>>
>> I have some troubles when compiling GROMACS 4.5.3 using PGI
>> compiler
>> on the -rpath flag and also a static link to dynamic
>> libfftw3.so.
>>
>> I use the pre-installed FFTW 3.2.2.1 library on my Linux
>> system. The
>> FFTW library is managed by the Modules package. The fftw
>> module
>> automatically sets the environ variable as:
>>
>> FFTW_POST_LINK_OPTS = -L/opt/fftw/3.2.2.1/lib
>> <http://3.2.2.1/lib>
>> -Wl,-rpath=/opt/fftw/3.2.2.1/lib <http://3.2.2.1/lib>
>> -lfftw3 -lfftw3f
>>
>>
>> So how does configure use this information? (hint: providing the
>> configure command line is essential for us to understand any
>> context!)
>>
>>
>> When compiling, an error occurs on the -rpath:
>>
>> pgcc -fast -o grompp grompp.o
>> ./.libs/libgmxpreprocess_mpi_d.a
>>
>> /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/mdlib/.libs/libmd_mpi_d.a
>> ../mdlib/.libs/libmd_mpi_d.a
>> /opt/fftw/3.2.2.1/lib/libfftw3.so
>> <http://3.2.2.1/lib/libfftw3.so>
>>
>> /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/gmxlib/.libs/libgmx_mpi_d.a
>> ../gmxlib/.libs/libgmx_mpi_d.a -ldl -lnsl -lm --rpath
>> /opt/fftw/3.2.2.1/lib <http://3.2.2.1/lib> --rpath
>> /opt/fftw/3.2.2.1/lib <http://3.2.2.1/lib>
>> pgcc-Error-Unknown switch: --rpath
>> pgcc-Error-Unknown switch: --rpath
>>
>> Pgcc doesn't recognize --rpath. The correct format is a
>> single dash
>> only -rpath.
>>
>>
>> Sounds like configure isn't handling pgcc properly. However,
>> GROMACS is
>> using very vanilla autoconf stuff, so I'm strongly of the
>> opinion that
>> the problem isn't on the GROMACS side.
>>
>>
>> If I manually remove the extra '-' (-rpath
>> /opt/fftw/3.2.2.1/lib <http://3.2.2.1/lib>) and
>> rerun the command line, a link error appears:
>>
>> /usr/bin/ld: attempted static link of dynamic object
>> `/opt/fftw/3.2.2.1/lib/libfftw3.so
>> <http://3.2.2.1/lib/libfftw3.so>'
>>
>> The command line links the dynamic fftw library. As the
>> 'configure
>> --help' shows the default is a static build. Why doesn't the
>> configure
>> pick the libfftw3.a but the libfftw3.so? The fftw library on
>> my system
>> contains both static and dynamic libraries.
>>
>>
>> Don't know. Ask the autoconf list.
>>
>>
>> I have also tried to make the old GROMACS 4.0.7 which has
>> shown the
>> same problems as above.
>>
>> Any workarounds to the problems or what options should I
>> pass to the
>> configure?
>>
>>
>> Don't bother with PGI compilers. GROMACS performance is 99%
>> compiler-independent, thanks to hand-coded assembly for the
>> inner loops.
>> Use gcc.
>>
>>
>> I have tried GCC. It has the same static link problem:
>>
>>
>> attempted static link of dynamic object
>> `/opt/fftw/3.2.2.1/lib/libfftw3.so <http://3.2.2.1/lib/libfftw3.so>'
>>
>> Yudong
>>
>> Mark
>>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________
More information about the gromacs.org_gmx-users
mailing list