|
36 | 36 | import os
|
37 | 37 | import fileinput
|
38 | 38 | import re
|
| 39 | +import shutil |
39 | 40 | import stat
|
40 | 41 | import sys
|
| 42 | +import tempfile |
41 | 43 | import platform
|
42 | 44 |
|
43 | 45 | from easybuild.tools import LooseVersion
|
|
68 | 70 | append LDLIBARGS=-L/usr/lib/x86_64-linux-gnu;
|
69 | 71 | """
|
70 | 72 |
|
| 73 | +# contents for minimal example compiled in sanity check, used to catch issue |
| 74 | +# seen in: https://github.com/easybuilders/easybuild-easyblocks/pull/3240 |
| 75 | +NVHPC_MINIMAL_EXAMPLE = """ |
| 76 | +#include <ranges> |
| 77 | +
|
| 78 | +int main(){ return 0; } |
| 79 | +""" |
| 80 | + |
71 | 81 |
|
72 | 82 | class EB_NVHPC(PackedBinary):
|
73 | 83 | """
|
@@ -206,6 +216,19 @@ def sanity_check_step(self):
|
206 | 216 | custom_commands = ["%s -v" % compiler for compiler in compiler_names]
|
207 | 217 | super(EB_NVHPC, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)
|
208 | 218 |
|
| 219 | + # compile minimal example using -std=c++20 to catch issue where it picks up the wrong GCC |
| 220 | + # (as long as system gcc is < 9.0) |
| 221 | + # see: https://github.com/easybuilders/easybuild-easyblocks/pull/3240 |
| 222 | + tmpdir = tempfile.mkdtemp() |
| 223 | + write_file(os.path.join(tmpdir, 'minimal.cpp'), NVHPC_MINIMAL_EXAMPLE) |
| 224 | + os.chdir(tmpdir) |
| 225 | + cmd = "nvc++ -std=c++20 minimal.cpp -o minimal" |
| 226 | + run_cmd(cmd, log_all=True, simple=True) |
| 227 | + try: |
| 228 | + shutil.rmtree(tmpdir) |
| 229 | + except OSError as err: |
| 230 | + raise EasyBuildError("Failed to remove temporary sanity check directory %s: %s", tmpdir, err) |
| 231 | + |
209 | 232 | def _nvhpc_extended_components(self, dirs, basepath, env_vars_dirs):
|
210 | 233 | """
|
211 | 234 | Extends `dirs` dict of key:environment_variables, value:list_of_directories with additional vars and dirs.
|
|
0 commit comments