[gmx-developers] Re: help needed: static builds with cmake
szilard.pall at cbr.su.se
Fri Oct 29 00:47:59 CEST 2010
Ideally, CMake should take care of the platform-specific stuff and on
OSX this should mean that no flag will be generated when the
LINK_STATIC_C_FLAGS is used. This is also suggested by the discussion
about this feature in the CMake bugtracking system
On Fri, Oct 29, 2010 at 12:18 AM, Justin A. Lemkul <jalemkul at vt.edu> wrote:
> Roland Schulz wrote:
>> On Thu, Oct 28, 2010 at 3:47 PM, Szilárd Páll <szilard.pall at cbr.su.se
>> <mailto:szilard.pall at cbr.su.se>> wrote:
>> >> 1) works fine, but referring to file extensions/endings might not
>> >> general enough. Making it more general/robust would require
>> >> the way external libraries are treated: instead of adding them with
>> >> full path we'd need to add -Lpath -llibname separately. However,
>> >> needs quite a bit more time than I have now...
>> > I'm confused, is the later part ( -Lpath -llibname separately)
>> part of the
>> > 2nd step below. Or not? Why does it take a lot of time?
>> Probably not a lot, but it smells like it's is/might turn out to be
>> more then I have ATM :)
>> The cmake find scripts (maybe not all, but most) do not return a
>> separate library name and library path.
>> Now I understand. BTW: their is a CMAKE_STATIC_LIBRARY_SUFFIX. You can use
>> that instead of specifying ".a" directly.
>> >> 2) Should work with the target property LINK_SEARCH_END_STATIC
>> >> essentially puts a -Wl,-Bstatic (for gcc on Linux, but it's
>> >> to work on many platforms) at the end of the final link call
>> >> list.
>> > If the later part of step 1 above has not been done, than how
>> does it help
>> > to set "-Wl,-Bstatic"? Does it use the static version even when
>> you specify
>> > the library file with the full path?
>> From the Cmake docs:
>> "LINK_SEARCH_END_STATIC: End a link line such that static system
>> libraries are used."
>> If I understand correctly, when "-Wl,-Bstatic" is placed at the end of
>> the link argument list it does not affect the arguments that precede
>> it and therefor 1) and 2) could work together, just that if e.g. fftw
>> is only available as shared library, this would be linked in
>> Too me this looks like a bug in cmake. It has (in
>> Modules/Platform/Linux.cmake) LINK_STATIC_C_FLAGS "-Wl,-Bstatic". But I
>> think it should include the -static for gcc. It might have been sufficient
>> to have the Wl,-Bstatic but at least now gcc requires also the static
>> option. If you agree we should file a cmake bug report.
> I don't know a whole lot about the ins and outs of compiler options, but I
> do know that on Mac OSX systems, gcc -static can frequently cause problems,
>> Does step 1 apply to the gromacs internal libraries (libmd, libgmx, ..)?
>> If so, I think step 1 by itself is good enough.
>> ORNL/UT Center for Molecular Biophysics cmb.ornl.gov <http://cmb.ornl.gov>
>> 865-241-1537, ORNL PO BOX 2008 MS6309
> Justin A. Lemkul
> Ph.D. Candidate
> ICTAS Doctoral Scholar
> MILES-IGERT Trainee
> Department of Biochemistry
> Virginia Tech
> Blacksburg, VA
> jalemkul[at]vt.edu | (540) 231-9080
> gmx-developers mailing list
> gmx-developers at gromacs.org
> Please don't post (un)subscribe requests to the list. Use the www interface
> or send it to gmx-developers-request at gromacs.org.
More information about the gromacs.org_gmx-developers