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  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Why does libca.so depend on libreadline.so?
From: Andrew Johnson via Tech-talk <tech-talk at aps.anl.gov>
To: "Dmitry Yu. Bolkhovityanov" <D.Yu.Bolkhovityanov at inp.nsk.su>
Cc: tech-talk at aps.anl.gov
Date: Wed, 10 May 2023 11:25:23 -0500
Hi Dmitry,

On 5/10/23 3:06 AM, Dmitry Yu. Bolkhovityanov via Tech-talk wrote:
        The core of iocsh is a part of libCom.

Yes, this explains it all.

Albeit the design looks extremely surprising -- as if some IP implementation included an integrated ksh...


However, a brief investigation had found this had changed in the 7.0.x between 7.0.2 and 7.0.7: in 7.0.2 the libca.so.4.13.3 does have a dependency on libreadline, while 7.0.7's libca.so.4.14.2 does NOT.

So, if 7.0.x was refactored to get rid of this dependency, then this change can probably be back-ported to 3.15.x.  A quick inspection of https://epics.anl.gov/base/R7-0/7-docs/RELEASE_NOTES.html doesn't show any traces of this change; probably a "diff -Naur" between sources is required.  I'm not sure my skills are sufficient for this back-porting, but I'll try.
I suspect that your brief investigation missed the fact that there were changes to the build system's detection of whether the target has a usable copy of readline installed, and those changes are almost certainly why some of your builds linked the libCom shared library with it and others didn't.

If you don't want your builds of libCom and libCa to depend on readline, you should ensure that it doesn't get built in by setting COMMANDLINE_LIBRARY=EPICS in an appropriate CONFIG_SITE* file. Our default build configuration is likely to always try to make use of readline if it's available, since it makes the IOC's shell so much easier to interact with. That is especially true now that the command-line completion features that readline provides have been integrated into iocsh.

I'd be more than happy for us to apply the -Wl,--as-needed linker option in future releases if that resolves the issue, GitHub Pull Requests are welcome.

HTH,

- Andrew

On Mon, May 8, 2023 at 9:46?PM Dmitry Yu. Bolkhovityanov via Tech-talk <
tech-talk at aps.anl.gov> wrote:

Michael,

On Sun, 7 May 2023, Michael Davidsaver wrote:

On 5/6/23 23:12, Dmitry Yu. Bolkhovityanov via Tech-talk wrote:
 P.S. Yes, I'm aware of a "COMMANDLINE_LIBRARY=EPICS" flag (which took
some
 time to figure out :D), but the question remains -- why any commandline
 editing is needed for network communication libraries at all?

This is a side-effect of the convention we use to support both dynamic
and
static linking
with one configuration.  Since static libraries do not carry dependency
information, when
linking statically it is necessary to give a complete list of all
dependent
libraries
when linking any executable.  This includes libreadline when libCom
depends
on it.

One simple way to avoid this over-linking in the dynamic case by passing
"-Wl,--as-needed"
when linking.

(assumes GCC or clang on an ELF target)

Thanks for this -- I didn't know of this linker option!

However, I still don't understand: why libCom depends on libreadline (or
any commandline-editing library)?


With best regards,
Dmitry

-- 
Complexity comes for free, Simplicity you have to work for.

Replies:
Re: Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk
References:
Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk
Re: Why does libca.so depend on libreadline.so? Michael Davidsaver via Tech-talk
Re: Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk
Re: Why does libca.so depend on libreadline.so? Han Lee via Tech-talk
Re: Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk

Navigate by Date:
Prev: Re: Change to dbRecordsOnceOnly? Andrew Johnson via Tech-talk
Next: sequencer problem Mark Rivers via Tech-talk
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  <20232024 
Navigate by Thread:
Prev: Re: Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk
Next: Re: Why does libca.so depend on libreadline.so? Dmitry Yu. Bolkhovityanov via Tech-talk
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  <20232024 
ANJ, 11 May 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·