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: "Dmitry Yu. Bolkhovityanov via Tech-talk" <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: tech-talk at aps.anl.gov
Date: Sat, 13 May 2023 13:32:38 +0700 (+07)
Hi Michael,

On Thu, 11 May 2023, Michael Davidsaver wrote:

On 5/11/23 01:38, Dmitry Yu. Bolkhovityanov via Tech-talk wrote:
 ...
 The next step will be to find which git commit bringed this change.

https://github.com/epics-base/epics-base/pull/254

May I suggest a small addition to your patch? It modifies behaviour for old, non-__has_include()-enabled compilers, thus eliminating a regression (and solving Mark Rivers' problem mentioned in https://epics.anl.gov/core-talk/2022/msg00385.php). The idea is to fall back to old readline detection method instead of defaulting to =EPICS (the whole file is attached):

% diff -ub ./base-7.0.7/configure/toolchain.c{.orig,}
--- ./base-7.0.7/configure/toolchain.c.orig	2022-09-08 01:50:35.000000000 +0700
+++ ./base-7.0.7/configure/toolchain.c	2023-05-13 13:12:20.967486783 +0700
@@ -45,5 +45,7 @@
 COMMANDLINE_LIBRARY ?= EPICS
 #  endif
 #else
-COMMANDLINE_LIBRARY ?= EPICS
+COMMANDLINE_LIBRARY ?= $(strip $(if $(wildcard \\
+    $(firstword $(READLINE_DIR) $(GNU_DIR))/include/readline/readline.h), \\
+  READLINE, EPICS))
 #endif

The detection snippet was copied from configure/os/CONFIG_SITE.Common.linux-arm as it tries 2 dirs instead of 1 as most other places do.

I've tested it on CentOS-7.3 (gcc version 4.8.5 20150623) and now libCom.so.3.22.0 does get a libreadline.so dependency. (However, as I don't have access to neither vxWorks/RTEMS nor MinGW etc., can't check behaviour on such systems.)


 The only oddity which puzzled me is integration of commandline editing
 into libCom -- that looks completely out of place.

Hardly the only historical oddity in a ~30 year old code base.

(at least we don't link in libX11 ...)

As funny as linking in libX11 looks, there could be a reasonable scenario for libXt: that can be used as application's main loop, taking care of file descriptors and timeouts, similarly to fdManager. :)


With best regards,
Dmitry
#ifdef _COMMENT_
/* Extract compiler pre-defined macros as Make variables
 *
 * Expanded as $(INSTALL_CFG)/TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A)
 *
 * Must be careful not to #include any C definitions
 * into what is really a Makefile snippet
 *
 * cf. https://sourceforge.net/p/predef/wiki/Home/
 */
/* GCC preprocessor drops C comments from output.
 * MSVC preprocessor emits C comments in output
 */
#endif

#if defined(__GNUC__) && !defined(__clang__)
GCC_MAJOR = __GNUC__
GCC_MINOR = __GNUC_MINOR__
GCC_PATCH = __GNUC_PATCHLEVEL__

#elif defined(__clang__)
CLANG_MAJOR = __clang_major__
CLANG_MINOR = __clang_minor__
CLANG_PATCH = __clang_patchlevel__

#elif defined(_MSC_VER)
MSVC_VER = _MSC_VER
#endif

#ifdef __rtems__
#include <rtems/score/cpuopts.h>
#  if __RTEMS_MAJOR__>=5
OS_API = posix
#  else
OS_API = score
#  endif
#endif

#ifdef __has_include
#  if defined(__rtems__) && __RTEMS_MAJOR__<5 && __has_include(<libtecla.h>)
COMMANDLINE_LIBRARY ?= LIBTECLA
#  elif __has_include(<readline/readline.h>)
COMMANDLINE_LIBRARY ?= READLINE
#  else
COMMANDLINE_LIBRARY ?= EPICS
#  endif
#else
COMMANDLINE_LIBRARY ?= $(strip $(if $(wildcard \\
    $(firstword $(READLINE_DIR) $(GNU_DIR))/include/readline/readline.h), \\
  READLINE, EPICS))
#endif

Replies:
Re: Why does libca.so depend on libreadline.so? Michael Davidsaver 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
Re: Why does libca.so depend on libreadline.so? Andrew Johnson 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? Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: RE: When I use an IOC in a container, streamDevice occasionally reports that protocol has been aborted, which causes the records in the IOC to become inaccessible from the host computer. Wang, Andrew via Tech-talk
Next: Re: Why does libca.so depend on libreadline.so? Michael Davidsaver 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? Ralph Lange via Tech-talk
Next: Re: Why does libca.so depend on libreadline.so? Michael Davidsaver 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, 13 May 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·