From ffb4e02a53760dff03cccadd27f1f199c8303a2a Mon Sep 17 00:00:00 2001 From: "Kelly (KT) Thompson" Date: Mon, 28 Oct 2019 16:31:23 -0600 Subject: [PATCH] Fix gcc recipe for RHEL7. (#13460) * Fix gcc recipe for RHEL7. + It appears that macOS related changes to the gcc recipe broke gcc on RHEL7. This bug manifests as `libstdc++.so: undefined reference to libiconv` when gcc is used. + Fixes #13452 by moving `--with-libiconv-prefix={0}'.format(spec['libiconv'].prefix)` into the darwin OS section of the configuration. + Change qualification of `depends_on(libiconv)` to limit dependency to macOS. * Replace deprecated 'setup_environment' with 'setup_run_environment'. * Fix cut and paste error. * Rename 'run_env' to just 'env'. --- var/spack/repos/builtin/packages/gcc/package.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index 836c018604..e42d977698 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -100,7 +100,7 @@ class Gcc(AutotoolsPackage): depends_on('isl@0.15:0.18', when='@6:8.9') depends_on('isl@0.15:0.20', when='@9:') depends_on('zlib', when='@6:') - depends_on('libiconv') + depends_on('libiconv', when='platform=darwin') depends_on('gnat', when='languages=ada') depends_on('binutils~libiberty', when='+binutils') depends_on('zip', type='build', when='languages=java') @@ -279,7 +279,6 @@ def configure_args(self): ','.join(spec.variants['languages'].value)), # Drop gettext dependency '--disable-nls', - '--with-libiconv-prefix={0}'.format(spec['libiconv'].prefix), '--with-mpfr={0}'.format(spec['mpfr'].prefix), '--with-gmp={0}'.format(spec['gmp'].prefix), ] @@ -328,7 +327,8 @@ def configure_args(self): if sys.platform == 'darwin': options.extend([ '--with-native-system-header-dir=/usr/include', - '--with-sysroot={0}'.format(macos_sdk_path()) + '--with-sysroot={0}'.format(macos_sdk_path()), + '--with-libiconv-prefix={0}'.format(spec['libiconv'].prefix) ]) return options @@ -424,7 +424,7 @@ def write_rpath_specs(self): self.prefix.lib, self.prefix.lib64)) set_install_permissions(specs_file) - def setup_environment(self, spack_env, run_env): + def setup_run_environment(self, env): # Search prefix directory for possibly modified compiler names from spack.compilers.gcc import Gcc as Compiler @@ -450,6 +450,6 @@ def setup_environment(self, spack_env, run_env): continue # Set the proper environment variable - run_env.set(lang.upper(), abspath) + env.set(lang.upper(), abspath) # Stop searching filename/regex combos for this language break