Skip to content

Elf provider - constraining to elfutils for oneapi builds. #1957

@eap

Description

@eap

TLDR: elfutils@0.181 fails to build with OneAPI. Bumping to elfutils@0.191 fixes the build, but Spack will silently swap in libelf instead unless you also set libelf: buildable: false. Maybe we should add this to the common config for oneapi?

Observed issue with OneAPI and elfutils 0.181

During the site install for aws-ubuntu2404 I encountered a build failure building elfutils@0.181 on the Intel OneAPI stack.

[+] /opt/spack-stack/envs/unified-oneapi/install/intel-oneapi-compilers/2025.3.0/krb5-1.21.3-fwcegu4
==> No binary for elfutils-0.181-tlo4o26l5qnuhkm4qpw7rqipbfs2ar7h found: installing from source
==> Using cached archive: /tmp/spack-stack/cache/source_cache/_source-cache/archive/29/29a6ad7421ec2acfee489bb4a699908281ead2cb63a20a027ce8804a165f0eb3.tar.bz2
==> Ran patch() for elfutils
==> elfutils: Executing phase: 'autoreconf'
==> elfutils: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 1:
    '/tmp/spack-stack/cache/build_stage/root/spack-stage-elfutils-0.181-tlo4o26l5qnuhkm4qpw7rqipbfs2ar7h/spack-src/configure' '--prefix=/opt/spack-stack/envs/unified-oneapi/install/intel-oneapi-compilers/2025.3.0/elfutils-0.181-tlo4o26' '--with-bzlib=/opt/spack-stack/envs/unified-oneapi/install/intel-oneapi-compilers/2025.3.0/bzip2-1.0.8-kzjhj43' '--with-lzma=/opt/spack-stack/envs/unified-oneapi/install/intel-oneapi-compilers/2025.3.0/xz-5.6.3-nsynaxq' '--with-zlib=/opt/spack-stack/envs/unified-oneapi/install/intel-oneapi-compilers/2025.3.0/zlib-1.3.1-2tv6tj4' '--program-prefix='"'"'eu-'"'"'' '--disable-debuginfod' '--disable-libdebuginfod'

1 error found in build log:
     38    checking whether yytext is a pointer... yes
     39    checking for ar... ar
     40    checking the archiver (ar) interface... ar
     41    checking for readelf... readelf
     42    checking for nm... nm
     43    checking for gcc with GNU99 support... no
  >> 44    configure: error: gcc with GNU99 support required

See build log for details:

Debugging attempts - libelf is often substituted

Quickly searching the spack-stack repo I observed that both acorn and wcoss2 specify @0.191 in their oneapi site config. So I attempted the same and observed the following change.

Elfutils spec dependents with no constraints (extraneous packages omitted)

-   siycf3x      ^ecflow@5.11.4~ipo~pic+ssl~static_boost+ui build_system=cmake build_type=Release generator=ninja patches:=1bd51d9,2e6d6d0 platform=linux os=ubuntu24.04 target=icelake %c,cxx,fortran=oneapi@2025.3.0
 -   ggt7mvy          ^qt@5.6.3~dbus~debug~doc~examples~framework~gtk+gui~location~opengl~phonon+shared+sql~ssl+tools~webkit build_system=generic patches:=0aaad63,7f34d48 platform=linux os=ubuntu24.04 target=icelake %c,cxx=gcc@13.3.0
 -   3i2se7x              ^glib@2.72.4~libmount~strip build_system=meson buildtype=release default_library:=shared patches:=b3fd450 tracing:=none platform=linux os=ubuntu24.04 target=icelake %c,cxx=oneapi@2025.3.0
 -   tlo4o26                  ^elfutils@0.181~debuginfod+exeprefix+nls build_system=autotools platform=linux os=ubuntu24.04 target=icelake %c,cxx=oneapi@2025.3.0

Elfutils spec dependents with no 0.191 constraint (extraneous packages omitted)

 -   bhri3gy      ^ecflow@5.11.4~ipo~pic+ssl~static_boost+ui build_system=cmake build_type=Release generator=ninja patches:=1bd51d9,2e6d6d0 platform=linux os=ubuntu24.04 target=icelake %c,cxx,fortran=oneapi@2025.3.0
 -   4w37bkl          ^qt@5.6.3~dbus~debug~doc~examples~framework~gtk+gui~location~opengl~phonon+shared+sql~ssl+tools~webkit build_system=generic patches:=0aaad63,7f34d48 platform=linux os=ubuntu24.04 target=icelake %c,cxx=gcc@13.3.0
 -   eawaa2x              ^glib@2.72.4~libmount~strip build_system=meson buildtype=release default_library:=shared patches:=b3fd450 tracing:=none platform=linux os=ubuntu24.04 target=icelake %c,cxx=oneapi@2025.3.0
 -   eszht2e                  ^libelf@0.8.13 build_system=autotools platform=linux os=ubuntu24.04 target=icelake %c=oneapi@2025.3.0

Comparing the options here it appears that elfutils is more modern and more actively maintained whereas libelf is older and only has one version available, but both provide spack's elf virtual package. Constraining elfutils to 0.191 seems to have the effect of making spack prefer libelf.

How to use elfutils@0.191 for oneapi?

The obvious solution (using provider: [elfutils]) does not work in this case and continues to result in a spec with libelf. I found that the following constraints gave the intended result with elfutils of the intended version.

Works

    elfutils:
      require:
      - '@0.191'
    libelf:
      buildable: false

Does not work

    all:
      providers:
        elf: [elfutils]
    elfutils:
      require:
      - '@0.191'

Building elfutils 0.191 with intel OneAPI 2025.3.0 does successfully build.

Open Questions

  • Should we use elfutils? (I suspect yes)

  • Should we update the default oneapi config to constrain elfutils?

Metadata

Metadata

Assignees

Labels

INFRAJEDI InfrastructurebugSomething is not working

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions