CUDA: remove preexisting log file before install (#17018)

cuda: 10.1 and onward, installers will crash if /tmp/cuda-installer.log
exists

Try to help if user owns the file, otherwise try to provide useful
info. Clean up the file post-install to try to avoid the whole issue.
This commit is contained in:
Andrew W Elble 2020-06-16 01:57:00 -04:00 committed by GitHub
parent d4f0a8f70b
commit 7e322b3184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@
from llnl.util.filesystem import LibraryList
import os
import platform
import llnl.util.tty as tty
# FIXME Remove hack for polymorphic versions
# This package uses a ugly hack to be able to dispatch, given the same
@ -85,6 +86,14 @@ def setup_run_environment(self, env):
env.set('CUDA_HOME', self.prefix)
def install(self, spec, prefix):
if os.path.exists('/tmp/cuda-installer.log'):
try:
os.remove('/tmp/cuda-installer.log')
except OSError:
if spec.satisfies('@10.1:'):
tty.die("The cuda installer will segfault due to the "
"presence of /tmp/cuda-installer.log "
"please remove the file and try again ")
runfile = glob(join_path(self.stage.source_path, 'cuda*_linux*'))[0]
chmod = which('chmod')
chmod('+x', runfile)
@ -110,6 +119,10 @@ def install(self, spec, prefix):
arguments.append('--toolkitpath=%s' % prefix) # Where to install
runfile(*arguments)
try:
os.remove('/tmp/cuda-installer.log')
except OSError:
pass
@property
def libs(self):