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:
parent
2b6f896ca7
commit
0007ed72c3
2 changed files with 15 additions and 15 deletions
6
lib/spack/env/cc
vendored
6
lib/spack/env/cc
vendored
|
@ -497,19 +497,19 @@ args+=("${flags[@]}")
|
||||||
# Insert include directories just prior to any system include directories
|
# Insert include directories just prior to any system include directories
|
||||||
|
|
||||||
for dir in "${includes[@]}"; do args+=("-I$dir"); done
|
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"
|
IFS=':' read -ra spack_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
|
||||||
if [[ "$isystem_was_used" == "true" ]] ; 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
|
else
|
||||||
for dir in "${spack_include_dirs[@]}"; do args+=("-I$dir"); done
|
for dir in "${spack_include_dirs[@]}"; do args+=("-I$dir"); done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dir in "${system_includes[@]}"; do args+=("-I$dir"); done
|
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
|
# Library search paths
|
||||||
for dir in "${libdirs[@]}"; do args+=("-L$dir"); done
|
for dir in "${libdirs[@]}"; do args+=("-L$dir"); done
|
||||||
|
|
|
@ -350,15 +350,15 @@ def test_ccld_deps_isystem():
|
||||||
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
|
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
|
||||||
SPACK_RPATH_DIRS='xlib:ylib:zlib',
|
SPACK_RPATH_DIRS='xlib:ylib:zlib',
|
||||||
SPACK_LINK_DIRS='xlib:ylib:zlib'):
|
SPACK_LINK_DIRS='xlib:ylib:zlib'):
|
||||||
mytest_args = test_args + ['-isystemfooinc']
|
mytest_args = test_args + ['-isystem', 'fooinc']
|
||||||
check_args(
|
check_args(
|
||||||
cc, mytest_args,
|
cc, mytest_args,
|
||||||
[real_cc] +
|
[real_cc] +
|
||||||
test_include_paths +
|
test_include_paths +
|
||||||
['-isystemfooinc',
|
['-isystem', 'fooinc',
|
||||||
'-isystemxinc',
|
'-isystem', 'xinc',
|
||||||
'-isystemyinc',
|
'-isystem', 'yinc',
|
||||||
'-isystemzinc'] +
|
'-isystem', 'zinc'] +
|
||||||
test_library_paths +
|
test_library_paths +
|
||||||
['-Lxlib',
|
['-Lxlib',
|
||||||
'-Lylib',
|
'-Lylib',
|
||||||
|
@ -432,20 +432,20 @@ def test_ccld_with_system_dirs_isystem():
|
||||||
SPACK_RPATH_DIRS='xlib:ylib:zlib',
|
SPACK_RPATH_DIRS='xlib:ylib:zlib',
|
||||||
SPACK_LINK_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',
|
'-L/usr/local/lib',
|
||||||
'-Wl,-rpath,/usr/lib64',
|
'-Wl,-rpath,/usr/lib64',
|
||||||
'-isystem/usr/local/include',
|
'-isystem', '/usr/local/include',
|
||||||
'-L/lib64/']
|
'-L/lib64/']
|
||||||
check_args(
|
check_args(
|
||||||
cc, sys_path_args + test_args,
|
cc, sys_path_args + test_args,
|
||||||
[real_cc] +
|
[real_cc] +
|
||||||
test_include_paths +
|
test_include_paths +
|
||||||
['-isystemxinc',
|
['-isystem', 'xinc',
|
||||||
'-isystemyinc',
|
'-isystem', 'yinc',
|
||||||
'-isystemzinc'] +
|
'-isystem', 'zinc'] +
|
||||||
['-isystem/usr/include',
|
['-isystem', '/usr/include',
|
||||||
'-isystem/usr/local/include'] +
|
'-isystem', '/usr/local/include'] +
|
||||||
test_library_paths +
|
test_library_paths +
|
||||||
['-Lxlib',
|
['-Lxlib',
|
||||||
'-Lylib',
|
'-Lylib',
|
||||||
|
|
Loading…
Reference in a new issue