<br><br><div class="gmail_quote">On Fri, Oct 29, 2010 at 7:16 AM, Szilárd Páll <span dir="ltr"><<a href="mailto:szilard.pall@cbr.su.se">szilard.pall@cbr.su.se</a>></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>
> On Thu, Oct 28, 2010 at 6:42 PM, Szilárd Páll <<a href="mailto:szilard.pall@cbr.su.se">szilard.pall@cbr.su.se</a>><br>
> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> > Too me this looks like a bug in cmake. It has<br>
>> > (in Modules/Platform/Linux.cmake) LINK_STATIC_C_FLAGS "-Wl,-Bstatic".<br>
>> > But I<br>
>> > think it should include the -static for gcc. It might have been<br>
>> > sufficient<br>
>> > to have the Wl,-Bstatic but at least now gcc requires also the static<br>
>> > option. If you agree we should file a cmake bug report.<br>
>><br>
>> I'm not sure it's a bug. The man page of ld clearly states that<br>
>> -Bstatic, -static, -dn, and -non_shared are equivalent. It'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>
><br>
> Yes their are equivalent for ld. But not for gcc. Gcc adds the required<br>
> libraries (e.g. libc, crt1.o, ...) before calling ld. And if you use<br>
> dynamic libraries the required libraries include libgcc_s. Thus you get this<br>
> error. But since this is a compiler argument, I think it is wrong that cmake<br>
> adds -Wl,-Bstatic without -static. "-Wl,-static" would be as wrong as<br>
> "-Wl,Bstatic". Only -static (without the "-Wl") is OK (optionally togehter<br>
> with the other flags). Because it is not enough to tell the linker without<br>
> telling the compiler to generate the correct list of required libs.<br>
<br>
</div>OK, that makes sense. I'll post today on the CMake mailing list and<br>
will get back with an update.<br>
<div class="im"><br>
>><br>
>> s<br>
>> > Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)?<br>
>> > If<br>
>> > so, I think step 1 by itself is good enough.<br>
>><br>
>> No, for the gramcs internal libs there is the BUILD_SHARED_LIBS<br>
>> option. This is for the external libraries (fftw3, libxml2, etc).<br>
><br>
> Yes. Just realized that.<br>
> I suggest to add step 1 and wait on step 2. Step 1 by itself is very useful.<br>
> It reduces the number of required libraries (often probably enough). And it<br>
> allows to compile a fully static library relatively easily. One only needs<br>
> to add the static flag correctly for the compiler (e.g. -static for GCC).<br>
> And one won't get error messages like "attempted static link of dynamic<br>
> object".<br>
<br>
</div>I'll add step 1. Just checked and it seems that on most UNIX systems<br>
static libraries have ".a" 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'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'll do that.<br></blockquote><div>Don'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>