Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions install/DEFAULTS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,18 @@ else
endif
endif

# Embed the netcdf library directories in the executables. Without this the
# codes link against $(NETCDFDIR) but resolve at run time against whatever the
# loader finds first, which fails with e.g.
# symbol lookup error: undefined symbol: netcdf_mp_nf90_create_
# when a system netcdf shadows the bundled one, and silently mixes libraries
# when the two were built by different compilers.
NETCDF_RPATH = -Wl,-rpath,$(NETCDFDIR)
ifneq ($(NETCDF_C_DIR),$(NETCDFDIR))
NETCDF_RPATH += -Wl,-rpath,$(NETCDF_C_DIR)
endif
NETCDF_EXTRA_LIBS += $(NETCDF_RPATH)

# Intel specifics
#----------------
# include compiler specific libs for intel fast moves
Expand Down
8 changes: 6 additions & 2 deletions install/TARGETS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ netcdf-c: v hdf5
cd ../; git submodule update --init deps/src/netcdf-c;
if [ ! -f ../deps/src/netcdf-c/Makefile ]; then \
cd ../deps/src/netcdf-c; \
CC="$(CC)" FC="$(FC)" F77="$(FC)" \
CPPFLAGS="-I$(realpath $(DEPSINSTALLDIR))/include" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib -Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/netcdf-c; \
Expand All @@ -56,8 +57,9 @@ netcdf-fortran: v netcdf-c
cd ../; git submodule update --init deps/src/netcdf-fortran;
if [ ! -f ../deps/src/netcdf-fortran/Makefile ]; then \
cd ../deps/src/netcdf-fortran; \
CC="$(CC)" FC="$(FC)" F77="$(FC)" \
CPPFLAGS="-I$(realpath $(DEPSINSTALLDIR))/include" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib -Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/netcdf-fortran; \
Expand All @@ -69,6 +71,8 @@ hdf5: v
cd ../; git submodule update --init deps/src/hdf5;
if [ ! -f ../deps/src/hdf5/Makefile ]; then \
cd ../deps/src/hdf5; \
CC="$(CC)" FC="$(FC)" \
LDFLAGS="-Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/hdf5; \
Expand Down
16 changes: 16 additions & 0 deletions install/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ realclean: clean clear
# only for regenerating it when source USE/MODULE relationships change, and
# require python3 (used by maintainers and the CI deps job, not end users).
PYTHON ?= python3
# Remove the autotools configuration of the bundled dependencies. The netcdf
# and hdf5 rules only run ./configure when no Makefile is present, so a plain
# `clean` keeps whatever toolchain configured them first. Switching FC/CC
# without this leaves gfortran-built module files in place, and the codes then
# fail with a confusing "module file was not generated by any release of this
# compiler" followed by cascading kind-parameter errors.
.PHONY: depsclean
depsclean:
for d in hdf5 netcdf-c netcdf-fortran; do \
if [ -f ../deps/src/$$d/Makefile ]; then \
(cd ../deps/src/$$d && $(MAKE) distclean >/dev/null 2>&1 || true); \
fi; \
rm -f ../deps/src/$$d/Makefile ../deps/src/$$d/config.cache; \
done
rm -rf ../deps/lib/* ../deps/include/* ../deps/bin/* ../deps/share ../deps/hdf5

.PHONY: deps checkdeps
deps:
$(PYTHON) gen_deps.py > DEPENDENCIES.inc
Expand Down
Loading