EPICS Home

Experimental Physics and Industrial Control System


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

Subject: Re: LINKER_USE_RPATH ignored on darwin systems
From: Michael Davidsaver via Core-talk <core-talk at aps.anl.gov>
To: Colby Sparks <colby.sparks at zaber.com>
Cc: core-talk at aps.anl.gov
Date: Fri, 29 Nov 2024 08:55:13 -0800
On 11/21/24 16:22, Colby Sparks via Core-talk wrote:
I am building a motor driver which makes use of a 3rd party library
that requires its runtime load path be specified during linking.

For linux builds this works fine. If LINKER_USE_PATH=YES, then the
build system will add rpath arguments for all of the libs in
PROD_DEPLIB_DIRS
(https://urldefense.us/v3/__https://github.com/epics-base/epics-base/blob/b7cc33c3c9c1a6cc14290b9a558e97bd89171e80/configure/os/CONFIG.Common.linuxCommon*L26-L27__;Iw!!G_uCfscf7eWS!aQd1UvUH3P8dEftuqQH-HKm-bSaFaUum_-Rbr4CXcTjCNXcCMGwnJd665ADvo-z9AGElFxGyMqYTQFWiMSzxAGm2xBE$ ).
For darwin builds, however, it seems that the default build
configuration ignores LINKER_USE_RPATH and will never add rpaths. This
means an IOC which uses my driver will fail to load its shared libs at
runtime.

I could add the following to my example IOC's CONFIG_SITE file and
make a note that users do the same:

ifneq ($(filter darwin-%, $(T_A)),)
PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%)
PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))
endif

But I am wondering if this is ill-advised. I am not very familiar with
the EPICS build system, so I imagine that there is a better way to
make this work.

If the executable links and runs, that seems promising :)

When dealing with a, presumably closed source, 3rd party library
it isn't surprising to need to jump through some additional hoops.


I am also curious why LINKER_USE_RPATH is ignored by
default when building for macOS.

So far no one has been motivated enough to make it work.
aka. PRs welcomed.

As a note on some ELF vs. Mach-o differences, I have found that
understand '-rpath' with Mach-o also required understanding the
differences between '-soname' vs. '-install_name'.


References:
LINKER_USE_RPATH ignored on darwin systems Colby Sparks via Core-talk

Navigate by Date:
Prev: Build failed: EPICS Base 7 base-7.0-1378 AppVeyor via Core-talk
Next: Build failed: EPICS Base 7 base-7.0-1381 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
Navigate by Thread:
Prev: LINKER_USE_RPATH ignored on darwin systems Colby Sparks via Core-talk
Next: Build failed: EPICS Base 7 base-7.0-1373 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025