EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: AW: EPICS linker problem
From: "Zimoch Dirk \(PSI\) via Core-talk" <core-talk at aps.anl.gov>
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: "core-talk at aps.anl.gov" <core-talk at aps.anl.gov>
Date: Thu, 16 Jul 2020 13:46:52 +0000
Mi Mark

Potentially there are other drivers than asyn which may run into the same problem.
I think fixing it once and for all in base may be easier.

Dirk

> -----Ursprüngliche Nachricht-----
> Von: Mark Rivers <rivers at cars.uchicago.edu>
> Gesendet: Donnerstag, 16. Juli 2020 14:15
> An: Zimoch Dirk (PSI) <dirk.zimoch at psi.ch>
> Cc: core-talk at aps.anl.gov
> Betreff: Re: EPICS linker problem
> 
> Hi Dirk,
> 
> 
> I believe I have already fixed the problem you are seeing.  It was an error in the
> Makefile.  It should have been linking with EPICS_BASE_IOC_LIBS, unless
> EPICS_LIBCOM_ONLY was YES.  This is the diff of the master branch from R4-39
> for the Makefile.
> 
> corvette:asyn/asynPortDriver/unittest>git diff R4-39 Makefile
> diff --git a/asyn/asynPortDriver/unittest/Makefile
> b/asyn/asynPortDriver/unittest/Makefile
> index 7618c68..a8a257f 100644
> --- a/asyn/asynPortDriver/unittest/Makefile
> +++ b/asyn/asynPortDriver/unittest/Makefile
> @@ -10,8 +10,17 @@ TOP=../../..
> 
>  include $(TOP)/configure/CONFIG
> 
> +USR_CFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -
> DUSE_TYPED_DRVET
> +USR_CXXFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -
> DUSE_TYPED_DRVET
> +
>  PROD_LIBS += asyn
> -PROD_LIBS += Com
> +ifeq ($(EPICS_LIBCOM_ONLY),YES)
> +  PROD_LIBS += Com
> +  USR_CXXFLAGS += -DEPICS_LIBCOM_ONLY
> +  USR_CFLAGS   += -DEPICS_LIBCOM_ONLY
> +else
> +  PROD_LIBS += $(EPICS_BASE_IOC_LIBS)
> +endif
> 
>  #Tests for the parameters
>  #TESTPROD_HOST += ParamValTest
> 
> 
> 
> Mark
> 
> 
> 
> ________________________________
> From: Core-talk <core-talk-bounces at aps.anl.gov> on behalf of Zimoch Dirk
> (PSI) via Core-talk <core-talk at aps.anl.gov>
> Sent: Thursday, July 16, 2020 4:51 AM
> To: 'core-talk at aps.anl.gov'
> Subject: EPICS linker problem
> 
> Hello folks,
> 
> Today I found that some Linux (cross) architectures (using gcc 4.4.2, 4.7.2)
> require an additional linker flag: -Wl,-rpath-link in addition to -L and -Wl,-rpath. I
> noticed when compiling asyn.
> It worked for me to change in
> <BASE>/configure/os/CONFIG.Common.linuxCommon
> PRODDIR_RPATH_LDFLAGS_YES = $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%)
> to
> PRODDIR_RPATH_LDFLAGS_YES = $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%)
> $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%)
> (Maybe the same should be done for SHRLIBDIR_RPATH_LDFLAGS_YES.)
> 
> Why this? Some linkers do not use -L for indirectly linked libs. E.g. libA.so
> depends on libB.so and the program is linked with -lA but not with -lB, then some
> linkers require that B is found in -rpath-link and do not consider -L or -rpath for
> it. (Maybe the other linkers where it works do not even care about B?)
> 
> In asyn this is the case for test code which links with -lasyn -lCom only. But
> libasyn.so had been linked with -ldbRecStd -ldbCore -lca -lCom and the linker
> refuses to use those other libraries from -L<EPICS_BASE_LIBDIR> or -Wl,-
> rpath<EPICS_BASE_LIBDIR>.
> 
> /opt/eldk-5.3/powerpc-4xx/sysroots/i686-eldk-linux/usr/bin/ppc440e-
> linux/powerpc-linux-g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -m32 -
> mcpu=440fp -mhard-float --sysroot=/opt/eldk-5.3/powerpc-
> 4xx/sysroots/ppc440e-linux  -DUNIX  -Dlinux  -fno-strict-aliasing    -O3 -g -g   -
> Wall             -I. -I../O.Common -I. -I. -I.. -I../../../../include/compiler/gcc -
> I../../../../include/os/Linux -I../../../../include          -I/usr/local/epics/base-
> 7.0.4.1/include/compiler/gcc -I/usr/local/epics/base-7.0.4.1/include/os/Linux -
> I/usr/local/epics/base-7.0.4.1/include        -c ../asynPortDriverTest.cpp
> /opt/eldk-5.3/powerpc-4xx/sysroots/i686-eldk-linux/usr/bin/ppc440e-
> linux/powerpc-linux-g++ -o asynPortDriverTest  -
> L/afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP -
> L/usr/local/epics/base-7.0.4.1/lib/eldk53-ppc4xxFP -Wl,-
> rpath,/afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP -Wl,-
> rpath,/usr/local/epics/base-7.0.4.1/lib/eldk53-ppc4xxFP       --sysroot=/opt/eldk-
> 5.3/powerpc-4xx/sysroots/ppc440e-linux    -rdynamic         asynPortDriverTest.o
> -lasyn -lCom
> /net/gfa-fs-4/export/cross_tools/eldk-5.3/powerpc-4xx/sysroots/i686-eldk-
> linux/usr/bin/ppc440e-linux/../../libexec/ppc440e-linux/gcc/powerpc-
> linux/4.7.2/ld: warning: libdbRecStd.so, needed by
> /afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP/libasyn.so, not
> found (try using -rpath or -rpath-link)
> /net/gfa-fs-4/export/cross_tools/eldk-5.3/powerpc-4xx/sysroots/i686-eldk-
> linux/usr/bin/ppc440e-linux/../../libexec/ppc440e-linux/gcc/powerpc-
> linux/4.7.2/ld: warning: libdbCore.so, needed by
> /afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP/libasyn.so, not
> found (try using -rpath or -rpath-link)
> /net/gfa-fs-4/export/cross_tools/eldk-5.3/powerpc-4xx/sysroots/i686-eldk-
> linux/usr/bin/ppc440e-linux/../../libexec/ppc440e-linux/gcc/powerpc-
> linux/4.7.2/ld: warning: libca.so, needed by
> /afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP/libasyn.so, not
> found (try using -rpath or -rpath-link)
> /afs/psi.ch/group/8211/dirk/git/DRV/asyn/lib/eldk53-ppc4xxFP/libasyn.so:
> undefined reference to `scanIoRequest'
> [... more undefined reference errors...]
> 
> Even though the warning suggests using -rpath or -rpath-link, only -rpath-link
> actually does the job.
> 
> Is there any (old) Linux architecture where adding -rpath-link may cause
> problems?
> 
> Dirk


Replies:
Re: EPICS linker problem Mark Rivers via Core-talk
References:
EPICS linker problem Zimoch Dirk (PSI) via Core-talk
Re: EPICS linker problem Mark Rivers via Core-talk

Navigate by Date:
Prev: Re: EPICS linker problem Mark Rivers via Core-talk
Next: Re: EPICS linker problem Mark Rivers via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS linker problem Mark Rivers via Core-talk
Next: Re: EPICS linker problem Mark Rivers via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 16 Jul 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·