Hi Janet,
Thanks, that worked!
This is very useful when building shareable libraries that we distribute to users without EPICS build systems. The library is then completely self-contained and they don't need to install libCom.so, libezca.so, etc. somewhere and make the system find them at run-time with LD_LIBRARY_PATH or some other mechanism.
Mark
-----Original Message-----
From: Janet Anderson [mailto:[email protected]]
Sent: Thursday, September 27, 2012 10:08 AM
To: Andrew Johnson
Cc: [email protected]; Mark Rivers
Subject: Re: Building a self-contained shareable library
You could try adding the following lines to the Makefile that creates the
shareable library.
SHARED_LIBRARIES = YES
STATIC_BUILD = YES
<libraryname>_LDFLAGS = $(STATIC_LDFLAGS)
On 09/26/2012 05:56 PM, Andrew Johnson wrote:
> 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
- References:
- Building a self-contained shareable library Mark Rivers
- Re: Building a self-contained shareable library Andrew Johnson
- Re: Building a self-contained shareable library Janet Anderson
- Navigate by Date:
- Prev:
Re: Building a self-contained shareable library Janet Anderson
- Next:
Re: How can I collect data values Tim Mooney
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Building a self-contained shareable library Janet Anderson
- 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
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|