From 573ce3fe81b1a11443dc678b3e225e7959943604 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 20 Aug 2020 17:42:18 +0200 Subject: gcc: fixed compilation on OpenSUSE (#18190) Set location for dependencies specifying explicitly both the include and lib path. This permits to handle cases where the libraries are installed in lib64 instead of lib. fixes #17556 fixes #10842 closes #18150 --- var/spack/repos/builtin/packages/gcc/package.py | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index a5ceb46046..991f0fadb0 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -451,9 +451,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): '--enable-languages={0}'.format( ','.join(spec.variants['languages'].value)), # Drop gettext dependency - '--disable-nls', - '--with-mpfr={0}'.format(spec['mpfr'].prefix), - '--with-gmp={0}'.format(spec['gmp'].prefix), + '--disable-nls' ] # Use installed libz @@ -483,13 +481,23 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): '--enable-bootstrap', ]) - # MPC - if 'mpc' in spec: - options.append('--with-mpc={0}'.format(spec['mpc'].prefix)) + # Configure include and lib directories explicitly for these + # dependencies since the short GCC option assumes that libraries + # are installed in "/lib" which might not be true on all OS + # (see #10842) + # + # More info at: https://gcc.gnu.org/install/configure.html + for dep_str in ('mpfr', 'gmp', 'mpc', 'isl'): + if dep_str not in spec: + continue - # ISL - if 'isl' in spec: - options.append('--with-isl={0}'.format(spec['isl'].prefix)) + dep_spec = spec[dep_str] + include_dir = dep_spec.headers.directories[0] + lib_dir = dep_spec.libs.directories[0] + options.extend([ + '--with-{0}-include={1}'.format(dep_str, include_dir), + '--with-{0}-lib={1}'.format(dep_str, lib_dir) + ]) # nvptx-none offloading for host compiler if spec.satisfies('+nvptx'): -- cgit v1.2.3-70-g09d2