[gmx-users] PGI link error: unknown switch --rpath & attempted static link of dynamic object fftw/lib/libfftw3.so

Yudong Sun yudong at nag.co.uk
Mon Nov 15 13:18:06 CET 2010


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 

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/
setenv           FFTW_POST_LINK_OPTS  -L/opt/fftw/ 
-Wl,-rpath=/opt/fftw/ -lfftw3 -lfftw3f
setenv           FFTW_INCLUDE_OPTS  -I/opt/fftw/
setenv           FFTW_DIR /opt/fftw/
setenv           FFTW_INC /opt/fftw/

In make, the link line causing the libfftw3 error is:

cc -DHAVE_CONFIG_H -I. -I../../src -I/usr/include/libxml2 
   -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 
../mdlib/.libs/libmd_mpi_d.a /opt/fftw/ 
/usr/lib64/libxml2.so -lz 
../gmxlib/.libs/libgmx_mpi_d.a -ldl -lnsl -lm   -Wl,--rpath 
-Wl,/opt/fftw/ -Wl,--rpath -Wl,/opt/fftw/
/opt/cray/xt-asyncpe/3.7.24/bin/cc: INFO: linux target is being used
/usr/bin/ld: attempted static link of dynamic object 
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).

# Names of this library.
library_names='libfftw3.so.3.2.4 libfftw3.so.3 libfftw3.so'

# The name of the static archive.
# 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

# Version information for libfftw3.

# Is this an already installed library?

# Should we warn about portability when linking against -modules?

# Files to dlopen/dlpreopen

# Directory that this library needs to be installed in:

Is there any workaround to instruct the linker to use the static libfftw3.a?



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 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/
>             <>
>             -Wl,-rpath=/opt/fftw/ <>
>             -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/
>             <>
>             /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/ <> --rpath
>             /opt/fftw/ <>
>             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/ <>) and
>             rerun the command line, a link error appears:
>             /usr/bin/ld: attempted static link of dynamic object
>             `/opt/fftw/
>             <>'
>             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/ <>'
>     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