summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py26
1 files 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'):