Hi,<div><br></div><div>this is a bug in the autoconf version GROMACS is using. Since we are moving to cmake we are not updating it thus this is an issue which won&#39;t be fixed.</div><div><br></div><div>There are two options:</div>

<div>- Create a folder. Copy (or symlink) the static library into that folder. Point the linker (-L) to that folder. Because your folder only has the static libraries it will work. </div><div>- Use cmake. For cmake this issue is solved.</div>

<div><br></div><div>Roland</div><div><br><div class="gmail_quote">On Mon, Nov 15, 2010 at 7:18 AM, Yudong Sun <span dir="ltr">&lt;<a href="mailto:yudong@nag.co.uk">yudong@nag.co.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br>
<br>
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.<br>
<br>
My configure line for GCC is:<br>
<br>
./configure --prefix=/path-to/gromacs_4.5.3 --enable-mpi --enable-double CC=cc CFLAGS=-O3 MPICC=cc<br>
<br>
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.<br>
<br>
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:<br>
<br>
prepend-path     LD_LIBRARY_PATH /opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a><br>
setenv           FFTW_POST_LINK_OPTS  -L/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> -Wl,-rpath=/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> -lfftw3 -lfftw3f<br>
setenv           FFTW_INCLUDE_OPTS  -I/opt/fftw/<a href="http://3.2.2.1/include" target="_blank">3.2.2.1/include</a><br>
setenv           FFTW_DIR /opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a><br>
setenv           FFTW_INC /opt/fftw/<a href="http://3.2.2.1/include" target="_blank">3.2.2.1/include</a><br>
<br>
In make, the link line causing the libfftw3 error is:<br>
<br>
cc -DHAVE_CONFIG_H -I. -I../../src -I/usr/include/libxml2 -I../../include -DGMXLIBDIR=\&quot;/usr/local/packages/nag/GROMACS/phase2b_4.5.3/share/top\&quot;   -O3 -MT grompp.o -MD -MP -MF .deps/grompp.Tpo -c -o grompp.o grompp.c<br>


mv -f .deps/grompp.Tpo .deps/grompp.Po<br>
/bin/sh ../../libtool --tag=CC   --mode=link cc  -O3   -o grompp grompp.o <a href="http://libgmxpreprocess_mpi_d.la" target="_blank">libgmxpreprocess_mpi_d.la</a>  ../mdlib/<a href="http://libmd_mpi_d.la" target="_blank">libmd_mpi_d.la</a> ../gmxlib/<a href="http://libgmx_mpi_d.la" target="_blank">libgmx_mpi_d.la</a>  -lnsl -lm<br>


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/<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">3.2.2.1/lib/libfftw3.so</a> /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/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> -Wl,--rpath -Wl,/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a><br>


/opt/cray/xt-asyncpe/3.7.24/bin/cc: INFO: linux target is being used<div class="im"><br>
/usr/bin/ld: attempted static link of dynamic object `/opt/fftw/<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">3.2.2.1/lib/libfftw3.so</a>&#39;<br></div>
collect2: ld returned 1 exit status<br>
<br>
GCC doesn&#39;t support the -rpath flag but it seems not a problem here.<br>
<br>
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 <a href="http://libfftw3.la" target="_blank">libfftw3.la</a>:<br>
<br>
# <a href="http://libfftw3.la" target="_blank">libfftw3.la</a> - a libtool library file<br>
# Generated by ltmain.sh (GNU libtool) 2.2.6 Debian-2.2.6a-4<br>
#<br>
# Please DO NOT delete this file!<br>
# It is necessary for linking the library.<br>
<br>
# The name that we can dlopen(3).<br>
dlname=&#39;libfftw3.so.3&#39;<br>
<br>
# Names of this library.<br>
library_names=&#39;libfftw3.so.3.2.4 libfftw3.so.3 libfftw3.so&#39;<br>
<br>
# The name of the static archive.<br>
old_library=&#39;libfftw3.a&#39;<br>
# Linker flags that can not go in dependency_libs.<br>
inherited_linker_flags=&#39; -pthread&#39;<br>
<br>
# Libraries that this one depends upon.<br>
dependency_libs=&#39; -lm&#39;<br>
<br>
# Names of additional weak libraries provided by this library<br>
weak_library_names=&#39;&#39;<br>
<br>
# Version information for libfftw3.<br>
current=5<br>
age=2<br>
revision=4<br>
<br>
# Is this an already installed library?<br>
installed=yes<br>
<br>
# Should we warn about portability when linking against -modules?<br>
shouldnotlink=no<br>
<br>
# Files to dlopen/dlpreopen<br>
dlopen=&#39;&#39;<br>
dlpreopen=&#39;&#39;<br>
<br>
# Directory that this library needs to be installed in:<br>
libdir=&#39;/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a>&#39;<br>
<br>
<br>
Is there any workaround to instruct the linker to use the static libfftw3.a?<br>
<br>
Thanks,<br>
<br>
Yudong<br>
<br>
Roland Schulz wrote, On 12/11/2010 18:53:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Little bit more background/context would help.<br>
<br>
Do you try to compile an all static library? If so you of course need a<br>
static library of fftw. If it is not all static it normally should<br>
accept the dynamic fftw. Then please give us the full configure line,<br>
the gcc command line of the link step and the full error message.<br>
<br>
Roland<br>
<br>
On Fri, Nov 12, 2010 at 12:17 PM, Yudong Sun &lt;<a href="mailto:yudong@nag.co.uk" target="_blank">yudong@nag.co.uk</a><br></div><div class="im">
&lt;mailto:<a href="mailto:yudong@nag.co.uk" target="_blank">yudong@nag.co.uk</a>&gt;&gt; wrote:<br>
<br>
    Mark Abraham wrote, On 12/11/2010 17:02:<br>
<br>
        On 13/11/2010 3:15 AM, Yudong Sun wrote:<br>
<br>
            Hi,<br>
<br>
            I have some troubles when compiling GROMACS 4.5.3 using PGI<br>
            compiler<br>
            on the -rpath flag and also a static link to dynamic<br>
            libfftw3.so.<br>
<br>
            I use the pre-installed FFTW 3.2.2.1 library on my Linux<br>
            system. The<br>
            FFTW library is managed by the Modules package. The fftw module<br>
            automatically sets the environ variable as:<br>
<br>
            FFTW_POST_LINK_OPTS = -L/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a><br></div>
            &lt;<a href="http://3.2.2.1/lib" target="_blank">http://3.2.2.1/lib</a>&gt;<br>
            -Wl,-rpath=/opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> &lt;<a href="http://3.2.2.1/lib" target="_blank">http://3.2.2.1/lib</a>&gt;<div class="im"><br>
            -lfftw3 -lfftw3f<br>
<br>
<br>
        So how does configure use this information? (hint: providing the<br>
        configure command line is essential for us to understand any<br>
        context!)<br>
<br>
<br>
            When compiling, an error occurs on the -rpath:<br>
<br>
            pgcc -fast -o grompp grompp.o ./.libs/libgmxpreprocess_mpi_d.a<br>
            /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/mdlib/.libs/libmd_mpi_d.a<br>
            ../mdlib/.libs/libmd_mpi_d.a<br>
            /opt/fftw/<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">3.2.2.1/lib/libfftw3.so</a><br></div>
            &lt;<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">http://3.2.2.1/lib/libfftw3.so</a>&gt;<div class="im"><br>
            /usr/local/packages/nag/GROMACS/gromacs-4.5.3/src/gmxlib/.libs/libgmx_mpi_d.a<br>
            ../gmxlib/.libs/libgmx_mpi_d.a -ldl -lnsl -lm --rpath<br></div>
            /opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> &lt;<a href="http://3.2.2.1/lib" target="_blank">http://3.2.2.1/lib</a>&gt; --rpath<br>
            /opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> &lt;<a href="http://3.2.2.1/lib" target="_blank">http://3.2.2.1/lib</a>&gt;<div class="im"><br>
            pgcc-Error-Unknown switch: --rpath<br>
            pgcc-Error-Unknown switch: --rpath<br>
<br>
            Pgcc doesn&#39;t recognize --rpath. The correct format is a<br>
            single dash<br>
            only -rpath.<br>
<br>
<br>
        Sounds like configure isn&#39;t handling pgcc properly. However,<br>
        GROMACS is<br>
        using very vanilla autoconf stuff, so I&#39;m strongly of the<br>
        opinion that<br>
        the problem isn&#39;t on the GROMACS side.<br>
<br>
<br>
            If I manually remove the extra &#39;-&#39; (-rpath<br></div>
            /opt/fftw/<a href="http://3.2.2.1/lib" target="_blank">3.2.2.1/lib</a> &lt;<a href="http://3.2.2.1/lib" target="_blank">http://3.2.2.1/lib</a>&gt;) and<div class="im"><br>
            rerun the command line, a link error appears:<br>
<br>
            /usr/bin/ld: attempted static link of dynamic object<br>
            `/opt/fftw/<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">3.2.2.1/lib/libfftw3.so</a><br></div>
            &lt;<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">http://3.2.2.1/lib/libfftw3.so</a>&gt;&#39;<div class="im"><br>
<br>
            The command line links the dynamic fftw library. As the<br>
            &#39;configure<br>
            --help&#39; shows the default is a static build. Why doesn&#39;t the<br>
            configure<br>
            pick the libfftw3.a but the libfftw3.so? The fftw library on<br>
            my system<br>
            contains both static and dynamic libraries.<br>
<br>
<br>
        Don&#39;t know. Ask the autoconf list.<br>
<br>
<br>
            I have also tried to make the old GROMACS 4.0.7 which has<br>
            shown the<br>
            same problems as above.<br>
<br>
            Any workarounds to the problems or what options should I<br>
            pass to the<br>
            configure?<br>
<br>
<br>
        Don&#39;t bother with PGI compilers. GROMACS performance is 99%<br>
        compiler-independent, thanks to hand-coded assembly for the<br>
        inner loops.<br>
        Use gcc.<br>
<br>
<br>
    I have tried GCC. It has the same static link problem:<br>
<br>
<br>
    attempted static link of dynamic object<br></div>
    `/opt/fftw/<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">3.2.2.1/lib/libfftw3.so</a> &lt;<a href="http://3.2.2.1/lib/libfftw3.so" target="_blank">http://3.2.2.1/lib/libfftw3.so</a>&gt;&#39;<br>
<br>
    Yudong<br>
<br>
        Mark<br>
<br>
</blockquote><div><div></div><div class="h5">
<br>
________________________________________________________________________<br>
The Numerical Algorithms Group Ltd is a company registered in England<br>
and Wales with company number 1249803. The registered office is:<br>
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.<br>
<br>
This e-mail has been scanned for all viruses by Star. The service is<br>
powered by MessageLabs. ________________________________________________________________________<br>
-- <br>
gmx-users mailing list    <a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a><br>
<a href="http://lists.gromacs.org/mailman/listinfo/gmx-users" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-users</a><br>
Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/Search" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/Search</a> before posting!<br>
Please don&#39;t post (un)subscribe requests to the list. Use the www interface or send it to <a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a>.<br>
Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov">cmb.ornl.gov</a><br>865-241-1537, ORNL PO BOX 2008 MS6309<br>
</div>