From 8b98564840f15bfabf957a641bf532eb6ad318b3 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Sat, 1 Apr 2023 15:11:14 +0200 Subject: [PATCH] libxpm: Fix linking with libintl (#36568) Original Author of this change: Chris Green Two changes: - Remove adding the library path using -L: It is obsolete now that we have the library paths in before the system paths. - Link with -linto only if the gettext recipe provides it: When we are on a glibc system, we can use external gettext, which means we use the libintl inside libc.so: no -lintl then. This change was already submitted in #35450 and reviewed but is stuck in this big PR which is trying to do too in a single PR. --- var/spack/repos/builtin/packages/libxpm/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/libxpm/package.py b/var/spack/repos/builtin/packages/libxpm/package.py index b034967dd8..26e169e74f 100644 --- a/var/spack/repos/builtin/packages/libxpm/package.py +++ b/var/spack/repos/builtin/packages/libxpm/package.py @@ -30,5 +30,5 @@ def setup_build_environment(self, env): # If libxpm is installed as an external package, gettext won't # be available in the spec. See # https://github.com/spack/spack/issues/9149 for details. - if "gettext" in self.spec: - env.append_flags("LDFLAGS", "-L{0} -lintl".format(self.spec["gettext"].prefix.lib)) + if "gettext" in self.spec and "intl" in self.spec["gettext"].libs.names: + env.append_flags("LDFLAGS", "-lintl")