<br><br><div class="gmail_quote">On Fri, Oct 29, 2010 at 7:16 AM, Szilárd Páll <span dir="ltr">&lt;<a href="mailto:szilard.pall@cbr.su.se">szilard.pall@cbr.su.se</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>
<div class="im"><br>
&gt; On Thu, Oct 28, 2010 at 6:42 PM, Szilárd Páll &lt;<a href="mailto:szilard.pall@cbr.su.se">szilard.pall@cbr.su.se</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; &gt;  Too me this looks like a bug in cmake. It has<br>
&gt;&gt; &gt; (in Modules/Platform/Linux.cmake) LINK_STATIC_C_FLAGS &quot;-Wl,-Bstatic&quot;.<br>
&gt;&gt; &gt; But I<br>
&gt;&gt; &gt; think it should include the -static for gcc. It might have been<br>
&gt;&gt; &gt; sufficient<br>
&gt;&gt; &gt; to have the Wl,-Bstatic but at least now gcc requires also the static<br>
&gt;&gt; &gt; option. If you agree we should file a cmake bug report.<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m not sure it&#39;s a bug. The man page of ld clearly states that<br>
&gt;&gt; -Bstatic, -static, -dn, and -non_shared are equivalent. It&#39;s just that<br>
&gt;&gt; while gcc -Bstatic gets simply passed down to the linker, -static<br>
&gt;&gt; actually does something and this something makes things work -- I<br>
&gt;&gt; guess. Also, asking on the CMake mailing list first might might be a<br>
&gt;&gt; good idea.<br>
&gt;<br>
&gt; Yes their are equivalent for ld. But not for gcc. Gcc adds the required<br>
&gt; libraries (e.g. libc,  crt1.o, ...) before calling ld. And if you use<br>
&gt; dynamic libraries the required libraries include libgcc_s. Thus you get this<br>
&gt; error. But since this is a compiler argument, I think it is wrong that cmake<br>
&gt; adds -Wl,-Bstatic without -static. &quot;-Wl,-static&quot; would be as wrong as<br>
&gt; &quot;-Wl,Bstatic&quot;. Only -static (without the &quot;-Wl&quot;) is OK (optionally togehter<br>
&gt; with the other flags). Because it is not enough to tell the linker without<br>
&gt; telling the compiler to generate the correct list of required libs.<br>
<br>
</div>OK, that makes sense. I&#39;ll post today on the CMake mailing list and<br>
will get back with an update.<br>
<div class="im"><br>
&gt;&gt;<br>
&gt;&gt; s<br>
&gt;&gt; &gt; Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)?<br>
&gt;&gt; &gt; If<br>
&gt;&gt; &gt; so, I think step 1 by itself is good enough.<br>
&gt;&gt;<br>
&gt;&gt; No, for the gramcs internal libs there is the BUILD_SHARED_LIBS<br>
&gt;&gt; option. This is for the external libraries (fftw3, libxml2, etc).<br>
&gt;<br>
&gt; Yes. Just realized that.<br>
&gt; I suggest to add step 1 and wait on step 2. Step 1 by itself is very useful.<br>
&gt; It reduces the number of required libraries (often probably enough). And it<br>
&gt; allows to compile a fully static library relatively easily. One only needs<br>
&gt; to add the static flag correctly for the compiler (e.g. -static for GCC).<br>
&gt; And one won&#39;t get error messages like &quot;attempted static link of dynamic<br>
&gt; object&quot;.<br>
<br>
</div>I&#39;ll add step 1. Just checked and it seems that on most UNIX systems<br>
static libraries have &quot;.a&quot; suffix (a suffix preference list is used<br>
internally in CMake). Can you (or anyone else) confirm that on most<br>
common HPC *NIX systems this is the case?<br>
<br>
Moreover, as it&#39;s not very harmful to have an exclusive check that<br>
enables the option for all UNIX but APPLE and CYGWIN (CMake<br>
terminology) I&#39;ll do that.<br></blockquote><div>Don&#39;t  know about HPUX. Cygwin should work too. And even MingW. If you use CMAKE_STATIC_LIBRARY_SUFFIX which is lib for MingW. How about you just disable the option if CMAKE_STATIC_LIBRARY_SUFFIX  is not set by Cmake?</div>

<div><br></div><div>Roland</div></div>-- <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>