Skip to content
Snippets Groups Projects
Commit 9592a38f authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'mnt/rpath' into 'master'

MNT: rpath

See merge request !27
parents 140720d1 845c5617
No related branches found
No related tags found
1 merge request!27MNT: rpath
Pipeline #11435 passed
include:
- file: .gitlab-ci.yml
project: fsl/fsl-ci-rules
project: fsl/conda/fsl-ci-rules
stages:
- test
......
# FSL base project changelog
## 2111.0 (Thursday 11th November 2021)
- The `rpath` is explicitly set on executables and shared libraries,
and the `install_name` set on shared libraries under macOS. This
is to support local development, and execution of commands from
their `$FSLDIR/src/` directory.
## 2109.1 (Wednesday 22nd September 2021)
......
......@@ -77,6 +77,22 @@ ARCHNVCCLDFLAGS =
# macOS.
#
#####################################################################
# Drop -rpath flags from LDFLAGS if it is
# set in the environment - we explicitly
# add them below such that executables
# will be able to find libs in $(pwd) and
# in $FSLDIR/lib *in that order*. This is
# so that executables located in the
# project source dir can be executed in
# place with sensible behaviour (i.e. any
# shared libs located in the same dir will
# take precedence over libs of the same
# name in $FSLDIR/lib/).
COMMA := ,
_LDFLAGS := $(patsubst -Wl${COMMA}-rpath%,,${LDFLAGS})
LDFLAGS = ${_LDFLAGS}
ifeq ($(SYSTYPE), Darwin)
# CC, CXX, CFLAGS, CXXFLAGS, and LDFLAGS
......@@ -85,8 +101,20 @@ ifeq ($(SYSTYPE), Darwin)
CXX ?= clang++
CFLAGS ?= -arch x86_64 -Wall -pedantic
CXXFLAGS ?= -arch x86_64 -Wall -pedantic
LDFLAGS ?= -Wl,-search_paths_first
LDFLAGS += -Wl,-rpath,"@executable_path/" \
-Wl,-rpath,"${FSLDIR}/lib"
ARCHLIBS += -llapack -lblas -lz -lm
# On macOS, we need to change the install
# name of shared libs so that they can be
# looked up according to the rpath of
# executables that depend on them. Note
# that we give shared libs a suffix of
# .so (not .dylib) on both linux and
# macOS.
ifeq ($(patsubst %.so,,$@),)
LDFLAGS += -Wl,-install_name,@rpath/$@
endif
endif
#####################################################################
......@@ -105,9 +133,8 @@ ifeq ($(SYSTYPE), Linux)
-Wall -pedantic -Wno-long-long
CXXFLAGS ?= -fexpensive-optimizations \
-Wall -pedantic -Wno-long-long
# TODO add extra rpath here to
# support local development?
LDFLAGS ?= -Wl,-rpath,'$$ORIGIN/../lib'
LDFLAGS += -Wl,-rpath,'$$ORIGIN:${FSLDIR}/lib' \
-Wl,-rpath-link,'$$ORIGIN:${FSLDIR}/lib'
ARCHLIBS += -lopenblas -lz -lm
endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment