<br><br><div class="gmail_quote">On Thu, Oct 28, 2010 at 6:42 PM, 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;  Too me this looks like a bug in cmake. It has<br>
&gt; (in Modules/Platform/Linux.cmake) LINK_STATIC_C_FLAGS &quot;-Wl,-Bstatic&quot;. But I<br>
&gt; think it should include the -static for gcc. It might have been sufficient<br>
&gt; to have the Wl,-Bstatic but at least now gcc requires also the static<br>
&gt; option. If you agree we should file a cmake bug report.<br>
<br>
</div>I&#39;m not sure it&#39;s a bug. The man page of ld clearly states that<br>
-Bstatic, -static, -dn, and -non_shared are equivalent. It&#39;s just that<br>
while gcc -Bstatic gets simply passed down to the linker, -static<br>
actually does something and this something makes things work -- I<br>
guess. Also, asking on the CMake mailing list first might might be a<br>
good idea.<br></blockquote><div>Yes their are equivalent for ld. But not for gcc. Gcc adds the required libraries (e.g. libc,  crt1.o, ...) before calling ld. And if you use dynamic libraries the required libraries include <font class="Apple-style-span" face="arial, sans-serif" size="3"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 12.7315px;">libgcc_s. Thus you get this error. But since this is a compiler argument, I think it is wrong that cmake adds -Wl,-Bstatic without -static. &quot;-Wl,-static&quot; would be as wrong as &quot;-Wl,Bstatic&quot;. Only -static (without the &quot;-Wl&quot;) is OK (optionally togehter with the other </span></font><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">flags</span></font><font class="Apple-style-span" face="arial, sans-serif" size="3"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 12.7315px;">). Because it is not enough to tell the linker without telling the compiler to generate the correct list of required libs.</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif" size="3"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 12.7315px;"><br></span></font></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


<div class="im">s<br>
&gt; Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)? If<br>
&gt; so, I think step 1 by itself is good enough.<br>
<br>
</div>No, for the gramcs internal libs there is the BUILD_SHARED_LIBS<br>
option. This is for the external libraries (fftw3, libxml2, etc).</blockquote><div>Yes. Just realized that. </div><div><br></div><div>I suggest to add step 1 and wait on step 2. Step 1 by itself is very useful. It reduces the number of required libraries (often probably enough). And it allows to compile a fully static library relatively easily. One only needs to add the static flag correctly for the compiler (e.g. -static for GCC). And one won&#39;t get error messages like &quot;attempted static link of dynamic object&quot;.</div>

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