diff --git a/configure/os/CONFIG.Common.V69-ppc32 b/configure/os/CONFIG.Common.V69-ppc32 index f5b25c476..a17c86c15 100644 --- a/configure/os/CONFIG.Common.V69-ppc32 +++ b/configure/os/CONFIG.Common.V69-ppc32 @@ -1,3 +1,3 @@ include $(CONFIG)/os/CONFIG.Common.vxWorks-ppc32 VXWORKS_VERSION = 6.9 -#export LD_LIBRARY_PATH=$(WIND_BASE)/lmapi-5.0/$(WIND_HOST_TYPE)/lib +#export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH:%=%:)$(WIND_BASE)/lmapi-5.0/$(WIND_HOST_TYPE)/lib diff --git a/configure/os/CONFIG.Common.V69-ppc604 b/configure/os/CONFIG.Common.V69-ppc604 index 9640bc381..0706636b0 100644 --- a/configure/os/CONFIG.Common.V69-ppc604 +++ b/configure/os/CONFIG.Common.V69-ppc604 @@ -1,6 +1,6 @@ include $(CONFIG)/os/CONFIG.Common.vxWorks-ppc604_long VXWORKS_VERSION = 6.9 -#export LD_LIBRARY_PATH=$(WIND_BASE)/lmapi-5.0/$(WIND_HOST_TYPE)/lib +#export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH:%=%:)($(WIND_BASE)/lmapi-5.0/$(WIND_HOST_TYPE)/lib # -fno-implicit-fp causes error: "unable to find a register to spill in class 'FLOAT_REGS'" ARCH_DEP_CFLAGS = -mcpu=604 -mstrict-align diff --git a/configure/os/CONFIG.Common.linuxCommon b/configure/os/CONFIG.Common.linuxCommon index 8e33d6950..dfd059cf4 100644 --- a/configure/os/CONFIG.Common.linuxCommon +++ b/configure/os/CONFIG.Common.linuxCommon @@ -35,16 +35,6 @@ PRODDIR_RPATH_LDFLAGS_ORIGIN = $(shell $(MAKERPATH) -O '\$$ORIGIN' -F $(FINAL_DI PRODDIR_LDFLAGS += \ $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) -# Make sure hosts tools find their libraries during build even if -# FINAL_LOCATION differs from INSTALL_LOCATION -ifneq ($(LINKER_USE_RPATH:NO=),) -ifeq ($(T_A),$(EPICS_HOST_ARCH)) -ifneq ($(FINAL_LOCATION:$(INSTALL_LOCATION)=),) -export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH:%=%:)$(INSTALL_LIB) -endif -endif -endif - # Link libraries controlled by COMMANDLINE_LIBRARY # The newest Linux versions only need readline, older ones need both # readline and ncurses, and the oldest need readline and curses diff --git a/configure/os/CONFIG.Common.nilrt7-armv7a b/configure/os/CONFIG.Common.nilrt7-armv7a index 410212d2b..11a005732 100644 --- a/configure/os/CONFIG.Common.nilrt7-armv7a +++ b/configure/os/CONFIG.Common.nilrt7-armv7a @@ -10,7 +10,9 @@ GNU_TARGET = arm-linux-gnu SYSROOT = /opt/LabVIEW-RT-19.5.1/arm/sysroots/armv7a-vfp-neon-nilrt-linux-gnueabi GNU_BIN = /opt/RHEL7/bin -LD_LIBRARY_PATH=/usr/$$LIB:/opt/RHEL7/$$LIB + +# Needed on RHEL9: +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH:%=%:)/usr/$$LIB:/opt/RHEL7/$$LIB ARCH_DEP_CPPFLAGS += -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon ARCH_DEP_CXXFLAGS += -I=/usr/include/c++/4.7.2/arm-nilrt-linux-gnueabi diff --git a/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 b/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 index c1a994b5c..7f4c852cd 100644 --- a/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 +++ b/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 @@ -12,7 +12,10 @@ include $(CONFIG)/os/CONFIG.linux-x86.linux-x86 SYSROOT = /opt/RHEL7 # "Cross" TOOLSET progs need to find their libraries -LD_LIBRARY_PATH = $(TOOLSET_DIR:%=$(SYSROOT)%/usr/$$LIB) +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH:%=%:)$(TOOLSET_DIR:%=$(SYSROOT)%/usr/$$LIB) + +# The linker has problems to find indirectly referenced libraries +ARCH_DEP_LDFLAGS+=-Wl,-rpath-link,$(INSTALL_LIB) # These programs have library problems when using them # from SYSROOT but without TOOLSET. diff --git a/configure/os/CONFIG.RHEL9-x86_64.RHEL7-x86_64 b/configure/os/CONFIG.RHEL9-x86_64.RHEL7-x86_64 index 47c5acfa0..58eb39b57 100644 --- a/configure/os/CONFIG.RHEL9-x86_64.RHEL7-x86_64 +++ b/configure/os/CONFIG.RHEL9-x86_64.RHEL7-x86_64 @@ -12,7 +12,7 @@ include $(CONFIG)/os/CONFIG.linux-x86.linux-x86 SYSROOT = /opt/RHEL7 # "Cross" TOOLSET progs need to find their libraries -LD_LIBRARY_PATH = $(TOOLSET_DIR:%=$(SYSROOT)%/usr/$$LIB:)/usr/$$LIB:$(SYSROOT)/usr/$$LIB +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH:%=%:)$(TOOLSET_DIR:%=$(SYSROOT)%/usr/$$LIB:)/usr/$$LIB:$(SYSROOT)/usr/$$LIB # The linker has problems to find indirectly referenced libraries PROD_LDLIBS += $(LDLIBS) diff --git a/configure/os/CONFIG.RHEL9-x86_64.RHEL8-x86_64 b/configure/os/CONFIG.RHEL9-x86_64.RHEL8-x86_64 index 8fc6cec5b..6f0ed17e8 100644 --- a/configure/os/CONFIG.RHEL9-x86_64.RHEL8-x86_64 +++ b/configure/os/CONFIG.RHEL9-x86_64.RHEL8-x86_64 @@ -15,7 +15,6 @@ SYSROOT = /opt/RHEL8 # Thus only wrap the compiler. WRAPPER = -wrapper env,LD_LIBRARY_PATH=$(TOOLSET_DIR:%=$(SYSROOT)%/usr/lib64:)/usr/lib64:$(SYSROOT)/usr/lib64 TARGET_CPPFLAGS += $(WRAPPER) -TARGET_PROD_LDFLAGS += $(WRAPPER) # These programs as cross tools would also need LD_LIBRARY_PATH. # But but our host versions work just fine. diff --git a/configure/os/CONFIG_SITE.UnixCommon.Common b/configure/os/CONFIG_SITE.UnixCommon.Common new file mode 100644 index 000000000..6944e2155 --- /dev/null +++ b/configure/os/CONFIG_SITE.UnixCommon.Common @@ -0,0 +1,5 @@ +# Make sure hosts tools find their libraries during build +# even if FINAL_LOCATION differs from INSTALL_LOCATION +ifneq ($(FINAL_LOCATION:$(INSTALL_LOCATION)=),) +export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH:%=%:)$(INSTALL_HOST_LIB) +endif diff --git a/configure/os/CONFIG_SITE.linux-x86.Common b/configure/os/CONFIG_SITE.linux-x86.Common index 2dd057195..7ffb448d5 100644 --- a/configure/os/CONFIG_SITE.linux-x86.Common +++ b/configure/os/CONFIG_SITE.linux-x86.Common @@ -11,10 +11,6 @@ INSTALL_LOCATION=/usr/local/epics/base-$(EPICS_VERSION).$(EPICS_REVISION).$(EPIC GNU_HOST_ARCH=i686 GNU_HOST_OS=linux -# set LD_LIBRARY_PATH may cause problems for eldk53-ppc4xxFP -# not exported LD_LIBRARY_PATH causes problem for RHEL7 cross compilation -export LD_LIBRARY_PATH= - # vxWorks for MVxxxx boards #CROSS_COMPILER_TARGET_ARCHS += T2-ppc604 #CROSS_COMPILER_TARGET_ARCHS += V67-ppc604 diff --git a/configure/os/CONFIG_SITE.linux-x86.RTEMS b/configure/os/CONFIG_SITE.linux-x86.RTEMS index 8b0fd9131..b34229673 100644 --- a/configure/os/CONFIG_SITE.linux-x86.RTEMS +++ b/configure/os/CONFIG_SITE.linux-x86.RTEMS @@ -4,5 +4,5 @@ #------------------------------------------------------- # Needed by gcc -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(RTEMS_BASE)/lib +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH:%=%:)$(RTEMS_BASE)/lib