I have a problem with the static build on Mac OS X using gcc and gfortran
now, and I think the issue is with gfortran/Apple, not with CMake. (Things
work fine with the intel compilers too.) However, on the off chance that
someone has a fix or some advice I thought I would run the issue past all
of you.

On Mac the -static flag doesn't work because there is no way to statically
link against crt0.o and libSystem.dylib, but that's fine, these should be
present on any reasonable OS X system. AFAICT, gfortran and gcc have no
flag to specify that libquadmath should be statically linked. This library
is distributed with gfortran, and there is no guarantee that it will be
present on the end user's system. (I'd like to just be able to distribute
the compiled binary without the sources, build system, etc.) Also, moving
to an older version of gfortran is not an option since many new features
are required by the software. A static version of libquadmath is
distributed with gcc/gfortran and is available
at: /opt/local/lib/gcc48/libquadmath.a

What is the best way to setup my link command using CMake so that the
binary executable is linked against the static libquadmath.a instead of the
.dylib version? (I couldn't find any examples or solutions via an extensive
search online.)

After spending nearly the entire afternoon trying to create a statically
linked executable on Mac, now using gcc and gfortran instead of the Intel
compilers, I can understand the wisdom in not attempting to fully support
static builds: they are a royal pain!



Izaak Beekman
===================================
(301)244-9367
Princeton University Doctoral Candidate
Mechanical and Aerospace Engineering
[email protected]

UMD-CP Visiting Graduate Student
Aerospace Engineering
[email protected]
[email protected]


On Tue, Apr 15, 2014 at 10:56 AM, Zaak Beekman <[email protected]> wrote:

> Brad, thanks so much for your help! From the online documentation it can
> be hard to figure out which variable/property controls certain features as
> someone with limited CMake experience.
>
> One strange detail I forgot was that this problem does not appear on
> Mac/OS X for the same project using the intel 13.x compilers. It seems on
> Mac all the implicit link libraries exist in static form. I'm going to poke
> around some more now that I know where to look and which variables to
> watch, etc. and I may file a bug report and/or submit a patch if I can
> determine a better but still safe way to detect required implicit link
> libraries.
>
> Thanks again for your help
>
> Izaak Beekman
> ===================================
> (301)244-9367
> Princeton University Doctoral Candidate
> Mechanical and Aerospace Engineering
> [email protected]
>
> UMD-CP Visiting Graduate Student
> Aerospace Engineering
> [email protected]
> [email protected]
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to