EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Static Linking...
From: "J. Lewis Muir" <[email protected]>
To: David Dudley <[email protected]>
Cc: EPICS Tech Talk <[email protected]>
Date: Thu, 21 Jul 2011 14:06:34 -0500
On 7/21/11 1:25 PM, David Dudley wrote:
> I seem to have discovered a problem on a MAC darwin-x86 where I can¹t static
> link programs.
> 
> Whenever I try to set STATIC_BUILD=YES in the CONFIG_SITE file, and do a
> clean rebuild, it fails when it¹s trying to link antelope, saying that it
> can¹t find the crt0.0 library.
> 
> 
> Did I delete a file I shouldn¹t have, or is this something that darwin-x86
> doesn¹t support?

Hi, David.

Mac OS X doesn't support statically linking binaries.  Well,
technically it does, but it's difficult because you would need a
static version of libSystem.dylib and crt0.o, neither of which
are provided.  This is according to the Mac OS X 10.6.8 gcc man
page section for the '-static' option which says:

  On systems that support dynamic linking, this prevents linking
  with the shared libraries.  On other systems, this option has
  no effect.

  This option will not work on Mac OS X unless all libraries
  (including libgcc.a) have also been compiled with -static.
  Since neither a static version of libSystem.dylib nor crt0.o
  are provided, this option is not useful to most people.

This used to be stated in the Mac OS X Technical Q&A, but it is
now only listed in the legacy Technical Q&A at:

http://developer.apple.com/legacy/mac/library/#qa/qa2001/qa1118.html

So, basically, you can build static libraries, but not static
binaries.  You can build mostly static binaries, but they will
still be partly dynamic binaries in that they require
libSystem.dylib or crt0.o or whatever.  But since the binary is
for a Mac, that should be OK.

Lewis

References:
Static Linking... David Dudley

Navigate by Date:
Prev: Re: Static Linking... Eric Norum
Next: Re: Static Linking... Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Static Linking... David Dudley
Next: Re: Static Linking... Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·