libsodium: Fix build on ppc64le (#21256)

On ppc64le and aarch64, Spack tries to execute any "config.guess" and
"config.sub" scripts it finds in the source package.

However, in the libsodium tarball, these files are present but not
executable.  This causes the following error when trying to install
libsodium with spack:

    Error: RuntimeError: Failed to find suitable substitutes for config.sub, config.guess

Fix this by chmod-ing the scripts in the patch() function of libsodium.
This commit is contained in:
Baptiste Jonglez 2021-01-27 09:40:10 +01:00 committed by GitHub
parent aa8e026242
commit 3626ab2697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import llnl.util.tty as tty
import os
class Libsodium(AutotoolsPackage):
@ -31,3 +33,14 @@ def url_for_version(self, version):
elif version < Version('1.0.17'):
url += 'old/'
return url + 'libsodium-{0}.tar.gz'.format(version)
def patch(self):
# Necessary on ppc64le / aarch64, because Spack tries to execute these scripts
# to check if they work (see lib/spack/spack/build_systems/autotools.py).
try:
os.chmod("build-aux/config.guess", 0o755)
os.chmod("build-aux/config.sub", 0o755)
except OSError:
# Old versions of libsodium don't have these files.
tty.debug("Couldn't chmod config.guess or config.sub: file not found")
pass