Removed pkg.headers.directories from the include list (#10604)
fixes #10601 Due to a bug this attribute is wrong for packages that use directories as namespaces. For instance it will add "<boost-prefix>/include/boost" instead of "<boost-prefix>/include" to the include path. As a minor addition a few loops in the compiler wrappers have been simplified.
This commit is contained in:
parent
b3dd95bd62
commit
1ec0d4feb3
16
lib/spack/env/cc
vendored
16
lib/spack/env/cc
vendored
@ -385,26 +385,24 @@ esac
|
|||||||
# Prepend include directories
|
# Prepend include directories
|
||||||
IFS=':' read -ra include_dirs <<< "$SPACK_INCLUDE_DIRS"
|
IFS=':' read -ra include_dirs <<< "$SPACK_INCLUDE_DIRS"
|
||||||
if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then
|
if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then
|
||||||
for include_dir in "${include_dirs[@]}"; do
|
includes=("${includes[@]}" "${include_dirs[@]}")
|
||||||
includes=("${includes[@]}" "$include_dir")
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS=':' read -ra rpath_dirs <<< "$SPACK_RPATH_DIRS"
|
IFS=':' read -ra rpath_dirs <<< "$SPACK_RPATH_DIRS"
|
||||||
if [[ $mode == ccld || $mode == ld ]]; then
|
if [[ $mode == ccld || $mode == ld ]]; then
|
||||||
for rpath_dir in "${rpath_dirs[@]}"; do
|
|
||||||
|
if [[ "$add_rpaths" != "false" ]] ; then
|
||||||
# Append RPATH directories. Note that in the case of the
|
# Append RPATH directories. Note that in the case of the
|
||||||
# top-level package these directories may not exist yet. For dependencies
|
# top-level package these directories may not exist yet. For dependencies
|
||||||
# it is assumed that paths have already been confirmed.
|
# it is assumed that paths have already been confirmed.
|
||||||
$add_rpaths && rpaths=("${rpaths[@]}" "$rpath_dir")
|
rpaths=("${rpaths[@]}" "${rpath_dirs[@]}")
|
||||||
done
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS=':' read -ra link_dirs <<< "$SPACK_LINK_DIRS"
|
IFS=':' read -ra link_dirs <<< "$SPACK_LINK_DIRS"
|
||||||
if [[ $mode == ccld || $mode == ld ]]; then
|
if [[ $mode == ccld || $mode == ld ]]; then
|
||||||
for link_dir in "${link_dirs[@]}"; do
|
libdirs=("${libdirs[@]}" "${link_dirs[@]}")
|
||||||
libdirs=("${libdirs[@]}" "$link_dir")
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add RPATHs if we're in in any linking mode
|
# add RPATHs if we're in in any linking mode
|
||||||
|
@ -287,10 +287,11 @@ def set_build_environment_variables(pkg, env, dirty):
|
|||||||
except spack.spec.NoLibrariesError:
|
except spack.spec.NoLibrariesError:
|
||||||
tty.debug("No libraries found for {0}".format(dep.name))
|
tty.debug("No libraries found for {0}".format(dep.name))
|
||||||
|
|
||||||
try:
|
# TODO: fix the line below, currently the logic is broken for
|
||||||
include_dirs.extend(query.headers.directories)
|
# TODO: packages that uses directories as namespaces e.g.
|
||||||
except spack.spec.NoHeadersError:
|
# TODO: #include <boost/xxx.hpp>
|
||||||
tty.debug("No headers found for {0}".format(dep.name))
|
# include_dirs.extend(query.headers.directories)
|
||||||
|
|
||||||
if os.path.isdir(dep.prefix.include):
|
if os.path.isdir(dep.prefix.include):
|
||||||
include_dirs.append(dep.prefix.include)
|
include_dirs.append(dep.prefix.include)
|
||||||
|
|
||||||
|
@ -243,7 +243,6 @@ def test_set_build_environment_variables(
|
|||||||
dep2_pkg = root['dt-diamond-right'].package
|
dep2_pkg = root['dt-diamond-right'].package
|
||||||
dep2_pkg.spec.prefix = str(dep2_prefix)
|
dep2_pkg.spec.prefix = str(dep2_prefix)
|
||||||
dep2_inc_paths = ['/test2/path/to/ex1.h', '/test2/path/to/subdir/ex2.h']
|
dep2_inc_paths = ['/test2/path/to/ex1.h', '/test2/path/to/subdir/ex2.h']
|
||||||
dep2_inc_dirs = ['/test2/path/to', '/test2/path/to/subdir']
|
|
||||||
dep2_includes = HeaderList(dep2_inc_paths)
|
dep2_includes = HeaderList(dep2_inc_paths)
|
||||||
|
|
||||||
setattr(dep_pkg, 'libs', dep_libs)
|
setattr(dep_pkg, 'libs', dep_libs)
|
||||||
@ -276,7 +275,7 @@ def normpaths(paths):
|
|||||||
# (regardless of whether it contains any header files)
|
# (regardless of whether it contains any header files)
|
||||||
assert (
|
assert (
|
||||||
normpaths(header_dir_var.split(':')) ==
|
normpaths(header_dir_var.split(':')) ==
|
||||||
normpaths(dep2_inc_dirs + [str(dep2_include)]))
|
normpaths([str(dep2_include)]))
|
||||||
finally:
|
finally:
|
||||||
delattr(dep_pkg, 'libs')
|
delattr(dep_pkg, 'libs')
|
||||||
delattr(dep2_pkg, 'headers')
|
delattr(dep2_pkg, 'headers')
|
||||||
|
Loading…
Reference in New Issue
Block a user