spack: llvm +cuda build fails: openmp/libomptarget/plugins/amdgpu/impl/sys tem.cpp:8:10: libelf.h file not found

Steps to reproduce the issue

llvm@13.0.0 +cuda cuda_arch=80 +omp_as_runtime build fails because it can’t find libelf header, despite libelf being declared an explicit dependency in llvm’s package.py. There is no problem if I build ~cuda +omp_as_runtime. It looks like this issue has come up before:

Using:

  • spack@develop (f6802b733a8889e73edeaa6c80d2077ee86bc490 from Mon Dec 13 11:45:31 2021 +0100)
  • Ubuntu 20.04, GCC 11.1.0
  • CUDA 11.5.1

Concrete spec: llvm.spec.json.txt

Concretization

llvm@13.0.0%gcc@11.1.0~all_targets+clang~code_signing+compiler-rt+cuda~flang+gold+internal_unwind~ipo+libcxx~link_llvm_dylib+lld+lldb~llvm_dylib~mlir+omp_as_runtime~omp_debug~omp_tsan+polly~python~shared_libs~split_dwarf~z3 build_type=Release cuda_arch=80 version_suffix=none arch=linux-ubuntu20.04-x86_64
    ^binutils@2.36.1%gcc@11.1.0~gas+gold+headers~interwork+ld+libiberty~lto~nls+plugins libs=shared,static patches=a51b7bf4607645235be01683a3e2deb3a87d767cc124ea4ef6febf9f32abf4a7 arch=linux-ubuntu20.04-x86_64
        ^diffutils@3.8%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
            ^libiconv@1.16%gcc@11.1.0 libs=shared,static arch=linux-ubuntu20.04-x86_64
        ^zlib@1.2.11%gcc@11.1.0+optimize+pic+shared arch=linux-ubuntu20.04-x86_64
    ^cmake@3.21.4%gcc@11.1.0~doc+ncurses+openssl+ownlibs~qt build_type=Release arch=linux-ubuntu20.04-x86_64
        ^ncurses@6.2%gcc@11.1.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-x86_64
            ^pkgconf@1.8.0%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
        ^openssl@1.1.1l%gcc@11.1.0~docs certs=system arch=linux-ubuntu20.04-x86_64
            ^perl@5.34.0%gcc@11.1.0+cpanm+shared+threads arch=linux-ubuntu20.04-x86_64
                ^berkeley-db@18.1.40%gcc@11.1.0+cxx~docs+stl patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-ubuntu20.04-x86_64
                ^bzip2@1.0.8%gcc@11.1.0~debug~pic+shared arch=linux-ubuntu20.04-x86_64
                ^gdbm@1.19%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
                    ^readline@8.1%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^cuda@11.5.1%gcc@11.1.0~dev arch=linux-ubuntu20.04-x86_64
        ^libxml2@2.9.12%gcc@11.1.0~python arch=linux-ubuntu20.04-x86_64
            ^xz@5.2.5%gcc@11.1.0+pic libs=shared,static arch=linux-ubuntu20.04-x86_64
    ^hwloc@2.6.0%gcc@11.1.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~opencl+pci~rocm+shared arch=linux-ubuntu20.04-x86_64
        ^libpciaccess@0.16%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
            ^libtool@2.4.6%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
                ^m4@1.4.19%gcc@11.1.0+sigsegv patches=9dc5fbd0d5cb1037ab1e6d0ecc74a30df218d0a94bdd5a02759a97f62daca573,bfdffa7c2eb01021d5849b36972c069693654ad826c1a20b53534009a4ec7a89 arch=linux-ubuntu20.04-x86_64
                    ^libsigsegv@2.13%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
            ^util-macros@1.19.3%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^libedit@3.1-20210216%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^libelf@0.8.13%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^libffi@3.3%gcc@11.1.0 patches=26f26c6f29a7ce9bf370ad3ab2610f99365b4bdd7b82e7c31df41a3370d685c0 arch=linux-ubuntu20.04-x86_64
    ^ninja@1.10.2%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
        ^python@3.8.12%gcc@11.1.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87,4c2457325f2b608b1b6a2c63087df8c26e07db3e3d493caf36a56f0ecf6fb768,f2fd060afc4b4618fe8104c4c5d771f36dc55b1db5a4623785a4ea707ec72fb4 arch=linux-ubuntu20.04-x86_64
            ^expat@2.4.1%gcc@11.1.0+libbsd arch=linux-ubuntu20.04-x86_64
                ^libbsd@0.11.3%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
                    ^libmd@1.0.3%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
            ^gettext@0.21%gcc@11.1.0+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-ubuntu20.04-x86_64
                ^tar@1.34%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
            ^sqlite@3.36.0%gcc@11.1.0+column_metadata+fts~functions~rtree arch=linux-ubuntu20.04-x86_64
            ^util-linux-uuid@2.36.2%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^perl-data-dumper@2.173%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
    ^swig@4.0.2%gcc@11.1.0 arch=linux-ubuntu20.04-x86_64
        ^pcre@8.44%gcc@11.1.0~jit+multibyte+utf arch=linux-ubuntu20.04-x86_64

Installation

$> spack install -f ./llvm.spec.json
...
==> Installing llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d
==> No binary for llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/a1/a1131358f1f9f819df73fa6bff505f2c49d176e9eef0a3aedd1fdbce3b4630e8.tar.gz
==> No patches needed for llvm
==> llvm: Executing phase: 'cmake'
==> llvm: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 1:
    'ninja' '-j16' '-v'

5 errors found in build log:
     30643    }
     30644    ^
     30645    2 warnings generated.
     30646    [157/239] Generating linkout.cuda.gfx700.bc
     30647    [158/239] Generating linkout.cuda.gfx803.bc
     30648    [159/239] Building CXX object openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/system.cpp.o
  >> 30649    FAILED: openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/system.cpp.o
     30650    /tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-build-2rff2x2/./bin/clang++ --target=x86_64-unk
              nown-linux-gnu -DTARGET_NAME=AMDGPU -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Domptarget_rtl_amdgpu_EXP
              ORTS -I/tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/include -I/tmp/r
              oot/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/plugins/amdgpu/impl -I/tmp/ro
              ot/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-src/llvm/include -I/tmp/root/spack-stage/spack-stage-l
              lvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-build-2rff2x2/include -I/tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql7
              3denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/plugins/amdgpu/dynamic_hsa -I/tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x
              22aql73denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/plugins/common/elf_common -isystem /spack/opt/spack/linux-ubuntu20.04-x86_6
              4/gcc-11.1.0/zlib-1.2.11-civxkiagoyviqxb77hb2zhuzea3jhxsg/include -std=c++11 -fPIC -fno-semantic-interposition -fvisibility-inlines-
              hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissin
              g-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
               -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-section
              s -Wall -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -std=c++14 -O3 -DNDEBUG -fPIC -
              MD -MT openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/system.cpp.o -MF openmp/libomptarget/plugins/amdg
              pu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/system.cpp.o.d -o openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir
              /impl/system.cpp.o -c /tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/p
              lugins/amdgpu/impl/system.cpp
  >> 30651    /tmp/root/spack-stage/spack-stage-llvm-13.0.0-2rff2x22aql73denonwehj5omq6jyd4d/spack-src/openmp/libomptarget/plugins/amdgpu/impl/sys
              tem.cpp:8:10: fatal error: 'libelf.h' file not found
     30652    #include <libelf.h>
     30653             ^~~~~~~~~~
     30654    1 error generated.
     30655    [160/239] Generating loop.gfx902.bc
     30656    [161/239] Generating linkout.cuda.gfx900.bc
     30657    [162/239] Building CXX object openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/atmi.cpp.o

     ...

     30661    [166/239] Building CXX object openmp/libomptarget/tools/deviceinfo/CMakeFiles/llvm-omp-device-info.dir/llvm-omp-device-info.cpp.o
     30662    [167/239] Generating libomptarget-amdgcn-gfx700.bc
     30663    [168/239] Generating libomptarget-amdgcn-gfx701.bc
     30664    [169/239] Building LLVM bitcode Workshare.cpp-sm_80.bc
     30665    [170/239] Generating libomptarget-amdgcn-gfx803.bc
     30666    [171/239] Building CXX object openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/src/rtl.cpp.o
  >> 30667    FAILED: openmp/libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/src/rtl.cpp.o
...

Information on your system

  • Spack: 0.17.0-477-98c3cbda9c
  • Python: 3.8.10
  • Platform: linux-ubuntu20.04-cascadelake
  • Concretizer: clingo

Additional information

spack-build-env.txt spack-build-out.txt spack-build-01-cmake-out.txt

@sethrj @haampie @trws @vlkale

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have run spack maintainers <name-of-the-package> and @mentioned any maintainers
  • I have uploaded the build log and environment files
  • I have searched the issues of this repo and believe this is not a duplicate

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

crtrott@DESKTOP-RC317H9:~$ spack --version
0.20.0.dev0 (0a7b0c68cffb172bb446c79b7c0dbdd4ed8d1fee)