Skip to content

Commit ba7b856

Browse files
authored
Merge pull request idaholab#32842 from lindsayad/deduplicate-rpaths
Deduplicate rpath flags in libmesh_LIBS and libmesh_LDFLAGS to suppress MacOS linker warnings
2 parents 541a9f6 + 9a00425 commit ba7b856

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

framework/build.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ libmesh_LIBS := $(shell METHOD=$(METHOD) $(libmesh_config) --libs)
5353
libmesh_HOST := $(shell METHOD=$(METHOD) $(libmesh_config) --host)
5454
libmesh_LDFLAGS := $(shell METHOD=$(METHOD) $(libmesh_config) --ldflags)
5555

56+
# Deduplicate rpath flags; libmesh-config --libs embeds rpaths from each bundled
57+
# dependency (libmesh, timpi, petsc) that share an installation prefix, producing
58+
# duplicate -rpath entries that macOS ld warns about.
59+
libmesh_LIBS := $(shell printf '%s\n' $(libmesh_LIBS) | awk '!seen[$$0]++' | tr '\n' ' ')
60+
libmesh_LDFLAGS := $(shell printf '%s\n' $(libmesh_LDFLAGS) | awk '!seen[$$0]++' | tr '\n' ' ')
61+
5662
# In the event that we're using something like mpicxx, query it for
5763
# the underlying compiler (like mpicxx -show); otherwise, fallback to
5864
# whatever libmesh_CXX is

framework/moose.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ else
211211
PYMOD_COMPILEFLAGS := -L$(shell $(pyconfig) --prefix)/lib -Wl,-rpath,$(shell $(pyconfig) --prefix)/lib $(shell $(pyconfig) --includes)
212212
endif
213213

214+
# Deduplicate rpath flags accumulated from wasp, MFEM, NEML2, etc. to suppress
215+
# duplicate -rpath linker warnings on macOS when dependencies share an install prefix.
216+
libmesh_LDFLAGS := $(shell printf '%s\n' $(libmesh_LDFLAGS) | awk '!seen[$$0]++' | tr '\n' ' ')
217+
214218
$(pyhit_srcfiles) $(hit_CLI_srcfiles): | prebuild
215219

216220
pyhit_LIB := $(HIT_DIR)/hit.$(PYMOD_EXTENSION)

0 commit comments

Comments
 (0)