summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/cuda/package.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py
index 72afffaa9a..8e378ad5f7 100644
--- a/var/spack/repos/builtin/packages/cuda/package.py
+++ b/var/spack/repos/builtin/packages/cuda/package.py
@@ -133,6 +133,11 @@ class Cuda(Package):
return match.group(1) if match else None
def setup_build_environment(self, env):
+ if self.spec.satisfies('@:8.0.61'):
+ # Perl 5.26 removed current directory from module search path,
+ # CUDA 9 has a fix for this, but CUDA 8 and lower don't.
+ env.append_path('PERL5LIB', self.stage.source_path)
+
if self.spec.satisfies('@10.1.243:'):
libxml2_home = self.spec['libxml2'].prefix
env.set('LIBXML2HOME', libxml2_home)
@@ -171,6 +176,18 @@ class Cuda(Package):
os.makedirs(os.path.join(prefix, "src"))
os.symlink(includedir, os.path.join(prefix, "include"))
+ install_shell = which('sh')
+
+ if self.spec.satisfies('@:8.0.61'):
+ # Perl 5.26 removed current directory from module search path.
+ # We are addressing this by exporting `PERL5LIB` earlier, but for some
+ # reason, it is not enough. One more file needs to be extracted before
+ # running the actual installer. This solution is one of the commonly
+ # found on the Internet, when people try to install CUDA <= 8 manually.
+ # For example: https://askubuntu.com/a/1087842
+ arguments = [runfile, '--tar', 'mxvf', './InstallUtils.pm']
+ install_shell(*arguments)
+
# CUDA 10.1+ has different cmdline options for the installer
arguments = [
runfile, # the install script
@@ -178,13 +195,15 @@ class Cuda(Package):
'--override', # override compiler version checks
'--toolkit', # install CUDA Toolkit
]
+
if spec.satisfies('@10.1:'):
arguments.append('--installpath=%s' % prefix) # Where to install
else:
arguments.append('--verbose') # Verbose log file
arguments.append('--toolkitpath=%s' % prefix) # Where to install
- install_shell = which('sh')
+
install_shell(*arguments)
+
try:
os.remove('/tmp/cuda-installer.log')
except OSError: