Fix: Add a space between -isystem and the directory (#21599)

Some compilers, such as the NV compilers, do not recognize -isystem
dir when specified without a space.

Works: -isystem ../include
Does not work: -isystem../include

This PR updates the compiler wrapper to include the space with -isystem.
This commit is contained in:
Scott McMillan 2021-02-10 17:56:42 -06:00 committed by GitHub
parent 2b6f896ca7
commit 0007ed72c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

6
lib/spack/env/cc vendored
View file

@ -497,19 +497,19 @@ args+=("${flags[@]}")
# Insert include directories just prior to any system include directories
for dir in "${includes[@]}"; do args+=("-I$dir"); done
for dir in "${isystem_includes[@]}"; do args+=("-isystem$dir"); done
for dir in "${isystem_includes[@]}"; do args+=("-isystem" "$dir"); done
IFS=':' read -ra spack_include_dirs <<< "$SPACK_INCLUDE_DIRS"
if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then
if [[ "$isystem_was_used" == "true" ]] ; then
for dir in "${spack_include_dirs[@]}"; do args+=("-isystem$dir"); done
for dir in "${spack_include_dirs[@]}"; do args+=("-isystem" "$dir"); done
else
for dir in "${spack_include_dirs[@]}"; do args+=("-I$dir"); done
fi
fi
for dir in "${system_includes[@]}"; do args+=("-I$dir"); done
for dir in "${isystem_system_includes[@]}"; do args+=("-isystem$dir"); done
for dir in "${isystem_system_includes[@]}"; do args+=("-isystem" "$dir"); done
# Library search paths
for dir in "${libdirs[@]}"; do args+=("-L$dir"); done

View file

@ -350,15 +350,15 @@ def test_ccld_deps_isystem():
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
SPACK_RPATH_DIRS='xlib:ylib:zlib',
SPACK_LINK_DIRS='xlib:ylib:zlib'):
mytest_args = test_args + ['-isystemfooinc']
mytest_args = test_args + ['-isystem', 'fooinc']
check_args(
cc, mytest_args,
[real_cc] +
test_include_paths +
['-isystemfooinc',
'-isystemxinc',
'-isystemyinc',
'-isystemzinc'] +
['-isystem', 'fooinc',
'-isystem', 'xinc',
'-isystem', 'yinc',
'-isystem', 'zinc'] +
test_library_paths +
['-Lxlib',
'-Lylib',
@ -432,20 +432,20 @@ def test_ccld_with_system_dirs_isystem():
SPACK_RPATH_DIRS='xlib:ylib:zlib',
SPACK_LINK_DIRS='xlib:ylib:zlib'):
sys_path_args = ['-isystem/usr/include',
sys_path_args = ['-isystem', '/usr/include',
'-L/usr/local/lib',
'-Wl,-rpath,/usr/lib64',
'-isystem/usr/local/include',
'-isystem', '/usr/local/include',
'-L/lib64/']
check_args(
cc, sys_path_args + test_args,
[real_cc] +
test_include_paths +
['-isystemxinc',
'-isystemyinc',
'-isystemzinc'] +
['-isystem/usr/include',
'-isystem/usr/local/include'] +
['-isystem', 'xinc',
'-isystem', 'yinc',
'-isystem', 'zinc'] +
['-isystem', '/usr/include',
'-isystem', '/usr/local/include'] +
test_library_paths +
['-Lxlib',
'-Lylib',