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  2011  <20122013  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  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Building a self-contained shareable library
From: Andrew Johnson <[email protected]>
To: [email protected]
Date: Wed, 26 Sep 2012 17:56:21 -0500
Hi Mark,

On 2012-09-26 Mark Rivers wrote:
> I would like to build an EPICS shareable library on Linux that is
> self-contained, i.e. it does not depend on any other shareable library. 
> For example, with IDL I would like libezcaIDL.so to not depend on
> libca.so, libCom.so, libezca.so, and libEzcaScan.so.
...
> But I am looking for a cleaner solution.  When EPICS is built with
> SHARED_LIBRARIES=YES it actually builds both .a and .so files for every
> library.  I would like a way to specify that ezcaIDL should be built as a
> .so file, but it should be linked with .a files for everything it depends
> on.
> 
> Is there a way to do this?

You can change the command that we use to link a shared library by modifying 
the variable LINK.shrlib in your Makefile.  The value for this variable is set 
in one or more of the Base/configure/os/CONFIG.* files according to your 
platform.  For GNU-based platforms we actually use g++ to do the linking 
because it has to do more than the ld program normally does when linking C++ 
code.

Your replacement linker command should use the the -Wl,-Bstatic command-line 
option (or any of its synonyms which I won't list here) immediately before any 
-l options naming libraries that you want to statically link against, then -
Wl,-Bdynamic (or its synonyms) before the -l options naming shared libraries.  
You'll probably want to run this manually to get the right combination.

The EPICS build system doesn't have a way to do this automatically, and I 
think it would be rather complicated to try to make it do so.  Note that the 
resulting Makefile rule probably won't be portable; the above options apply to 
the GNU linker, you may have to adjust them for other platforms you want to 
use.

HTH,

- Andrew
-- 
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte

Replies:
Re: Building a self-contained shareable library Janet Anderson
References:
Building a self-contained shareable library Mark Rivers

Navigate by Date:
Prev: Building a self-contained shareable library Mark Rivers
Next: MKS937B Vacuum Gauge Controllers.... David Reid
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Building a self-contained shareable library Mark Rivers
Next: Re: Building a self-contained shareable library Janet Anderson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  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 ·