hsa-rocr-dev, llvm-amdgpu: change dependency libelf to elf (#29408)

* hsa-rocr-dev, llvm-amdgpu: change dependency libelf to elf

Change the libelf dependency to the virtual elf for two rocm packages.
This allows other packages (hpctoolkit) to combine rocm and dyninst
(with elfutils) while still being able to build rocm with libelf when
needed, eg darwin.

* add comment describing include path for libelf vs elfutils
This commit is contained in:
Mark W. Krentel 2022-03-14 05:30:55 -05:00 committed by GitHub
parent a4f9d4fa4a
commit 4635c813e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import * from spack import *
@ -43,7 +45,7 @@ class HsaRocrDev(CMakePackage):
# Note, technically only necessary when='@3.7: +image', but added to all # Note, technically only necessary when='@3.7: +image', but added to all
# to work around https://github.com/spack/spack/issues/23951 # to work around https://github.com/spack/spack/issues/23951
depends_on('xxd', when='+image', type='build') depends_on('xxd', when='+image', type='build')
depends_on('libelf@0.8:', type='link') depends_on('elf', type='link')
for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0',
'4.2.0', '4.3.0', '4.3.1', '4.5.0', '4.5.2', 'master']: '4.2.0', '4.3.0', '4.3.1', '4.5.0', '4.5.2', 'master']:
@ -61,7 +63,11 @@ class HsaRocrDev(CMakePackage):
def cmake_args(self): def cmake_args(self):
spec = self.spec spec = self.spec
libelf_include = spec['libelf'].prefix.include.libelf # hsa-rocr-dev wants the directory containing the header files, but
# libelf adds an extra path (include/libelf) compared to elfutils
libelf_include = os.path.dirname(
find_headers('libelf', spec['elf'].prefix.include, recursive=True)[0])
args = [ args = [
self.define('LIBELF_INCLUDE_DIRS', libelf_include), self.define('LIBELF_INCLUDE_DIRS', libelf_include),
self.define_from_variant('BUILD_SHARED_LIBS', 'shared') self.define_from_variant('BUILD_SHARED_LIBS', 'shared')

View File

@ -63,7 +63,7 @@ class LlvmAmdgpu(CMakePackage):
# openmp dependencies # openmp dependencies
depends_on("perl-data-dumper", type=("build"), when='+openmp') depends_on("perl-data-dumper", type=("build"), when='+openmp')
depends_on("hwloc", when='+openmp') depends_on("hwloc", when='+openmp')
depends_on('libelf', type='link', when='+openmp') depends_on('elf', type='link', when='+openmp')
# Will likely only be fixed in LLVM 12 upstream # Will likely only be fixed in LLVM 12 upstream
patch('fix-system-zlib-ncurses.patch', when='@3.5.0:3.8.0') patch('fix-system-zlib-ncurses.patch', when='@3.5.0:3.8.0')