From 6ca9fece2ef5e0418edb5751285fc95535c7168e Mon Sep 17 00:00:00 2001 From: CGH0S7 <776459475@qq.com> Date: Tue, 28 Apr 2026 22:43:57 +0800 Subject: [PATCH] Add OpenMPI rpath and LD_LIBRARY_PATH export for reliable linking - Export OMPI_ROOT/lib64 in LD_LIBRARY_PATH so mpicxx finds its runtime libs - Add -Wl,-rpath to embed OpenMPI lib64 path in executables for runtime - Replace hardcoded paths with OMPI_ROOT variable Co-Authored-By: Claude Opus 4.7 --- AMSS_NCKU_source/makefile.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AMSS_NCKU_source/makefile.inc b/AMSS_NCKU_source/makefile.inc index 1918e73..8f3ac69 100755 --- a/AMSS_NCKU_source/makefile.inc +++ b/AMSS_NCKU_source/makefile.inc @@ -1,8 +1,14 @@ ## GCC version with OpenMPI and OpenBLAS -filein = -I/usr/include/ -I/usr/mpi/gcc/openmpi-4.1.9a1/include +OMPI_ROOT = /usr/mpi/gcc/openmpi-4.1.9a1 + +## Ensure mpicxx and final executables find OpenMPI libs at build- and runtime +export LD_LIBRARY_PATH := $(OMPI_ROOT)/lib64:$(LD_LIBRARY_PATH) + +filein = -I/usr/include/ -I$(OMPI_ROOT)/include ## OpenBLAS (OpenMP variant) + gfortran runtime -LDLIBS = -lopenblaso -lgfortran -lpthread -lm -ldl -lgomp +## -Wl,-rpath ensures ABE / TwoPunctureABE find libmpi at runtime without LD_LIBRARY_PATH +LDLIBS = -Wl,-rpath,$(OMPI_ROOT)/lib64 -lopenblaso -lgfortran -lpthread -lm -ldl -lgomp ## Memory allocator switch ## 0 (default) : use system default allocator (ptmalloc)