Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm+gold with external binutils build failure because of missing plugin-api.h header #29350

Closed
3 tasks done
rchoudhary opened this issue Mar 4, 2022 · 9 comments · Fixed by #40214 · May be fixed by #30954
Closed
3 tasks done

llvm+gold with external binutils build failure because of missing plugin-api.h header #29350

rchoudhary opened this issue Mar 4, 2022 · 9 comments · Fixed by #40214 · May be fixed by #30954

Comments

@rchoudhary
Copy link

Steps to reproduce

git clone -c feature.manyFiles=true https://github.com/spack/spack.git
spack install llvm@13.0.1

Error message

==> Installing llvm-13.0.1-uz4giobhbnsvrlmkq6siezxk6hxedpuw
==> No binary for llvm-13.0.1-uz4giobhbnsvrlmkq6siezxk6hxedpuw found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/09/09c50d558bd975c41157364421820228df66632802a4a6a7c9c17f86a7340802.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'

2 errors found in build log:
...
  >> 4592    FAILED: tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o
     4593    /home/rutvikc2/spack/lib/spack/env/gcc/g++  -D_GNU_SOURCE -D__STDC_CONSTANT_MACRO
             S -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/gold -I/tmp/rutvikc2/spack
             -stage/spack-stage-llvm-13.0.1-uz4giobhbnsvrlmkq6siezxk6hxedpuw/spack-src/llvm/to
             ols/gold -Iinclude -I/tmp/rutvikc2/spack-stage/spack-stage-llvm-13.0.1-uz4giobhbn
             svrlmkq6siezxk6hxedpuw/spack-src/llvm/include -isystem /home/rutvikc2/spack/opt/s
             pack/linux-ubuntu20.04-skylake_avx512/gcc-9.3.0/zlib-1.2.11-ulsjxh4r33cuzn6puqa37
             zmpj4n54yyb/include -std=c++11 -fPIC -fno-semantic-interposition -fvisibility-inl
             ines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
              -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-
             fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wn
             o-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-overrid
             e -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -
             fdata-sections -O3 -DNDEBUG -fPIC     -std=c++14 -MD -MT tools/gold/CMakeFiles/LL
             VMgold.dir/gold-plugin.cpp.o -MF tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.c
             pp.o.d -o tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o -c /tmp/rutvikc2/s
             pack-stage/spack-stage-llvm-13.0.1-uz4giobhbnsvrlmkq6siezxk6hxedpuw/spack-src/llv
             m/tools/gold/gold-plugin.cpp
  >> 4594    /tmp/rutvikc2/spack-stage/spack-stage-llvm-13.0.1-uz4giobhbnsvrlmkq6siezxk6hxedpu
             w/spack-src/llvm/tools/gold/gold-plugin.cpp:38:10: fatal error: plugin-api.h: No 
             such file or directory
     4595       38 | #include <plugin-api.h>
     4596          |          ^~~~~~~~~~~~~~
     4597    compilation terminated.

Information on your system

  • Spack: 0.17.1-1457-4081597731
  • Python: 3.8.10
  • Platform: linux-ubuntu20.04-skylake_avx512
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output
@rchoudhary rchoudhary added bug Something isn't working triage The issue needs to be prioritized labels Mar 4, 2022
@rchoudhary
Copy link
Author

Note, I can build when using the command spack install llvm @13.0.1 ~gold, i.e. by disabling the gold plugin.

@rchoudhary rchoudhary changed the title LLVM 13.0.1 fails to bootstrap, something to do with LLVMgold LLVM 13.0.1 with Gold plugin fails to bootstrap Mar 8, 2022
@wyphan
Copy link
Contributor

wyphan commented Apr 1, 2022

I can confirm the same issue also happens with llvm@14.0.0.

@wyphan
Copy link
Contributor

wyphan commented Apr 6, 2022

Summoning @scheibelp

@ewokhias
Copy link

I got here after googling a different problem. I got the same error "plugin-api.h: No such file or directory" while building llvm tests (make check-all). The solution to my problem was installing the missing binutils-dev. Maybe this helps here too?

@wyphan
Copy link
Contributor

wyphan commented May 31, 2022

Thanks @ewokhias, that solved the problem! On my machine it detects binutils as external so it relies on the system-installed binutils, but for systems that don't have binutils. Spack should build it with +headers variant turned on. PR incoming.

Edit: PR draft here #30954

@giordano
Copy link
Member

For what is worth, I got the same error when building llvm 8.0.0, so this isn't specific to 13+

@haampie
Copy link
Member

haampie commented Nov 22, 2022

I don't think we're gonna fix this in Spack. It's an issue in LLVM, they should check for the header s.t. it's an error caught during cmake/configure.

It happens when binutils is external and only runtime components are installed (e.g. binutils-dev is missing). If you're using externals you're telling Spack that it's a drop-in replacement for the Spack package.

@haampie haampie changed the title LLVM 13.0.1 with Gold plugin fails to bootstrap llvm+gold with external binutils build failure because of missing plugin-api.h header Nov 22, 2022
@giordano
Copy link
Member

It happens when binutils is external and only runtime components are installed (e.g. binutils-dev is missing). If you're using externals you're telling Spack that it's a drop-in replacement for the Spack package.

That's indeed my case, but perhaps there should be a spack variant of binutils with only the runtime, to match what distro do?

@alalazo alalazo added build-error and removed bug Something isn't working triage The issue needs to be prioritized labels Apr 7, 2023
@BenWibking
Copy link
Contributor

I don't think we're gonna fix this in Spack. It's an issue in LLVM, they should check for the header s.t. it's an error caught during cmake/configure.

It happens when binutils is external and only runtime components are installed (e.g. binutils-dev is missing). If you're using externals you're telling Spack that it's a drop-in replacement for the Spack package.

This issue happens for me when Spack detects binutils as an external package itself (with spack external find). This is a bug in Spack -- it adds binutils as an external package that is clearly not a drop-in replacement for the Spack package.

Thomas-Ulrich added a commit to Thomas-Ulrich/spack that referenced this issue Apr 27, 2023
@trws trws closed this as completed in c59eb8c Apr 27, 2023
joequant pushed a commit to joequant/spack that referenced this issue May 2, 2023
bernhardkaindl added a commit to bernhardkaindl/spack that referenced this issue Sep 26, 2023
llvm needs +headers for plugin-api.h which most distros don't install.
Fixes spack#29350. Also check for installed gold linker and set +gold/~gold
bernhardkaindl added a commit to bernhardkaindl/spack that referenced this issue Sep 26, 2023
- llvm needs binutils+headers for plugin-api.h which most distros don't install
  and therefore make spack external find binutils detect binutils~headers.

  This forces spack to build binutils even when binutils have been imported
  from the system. This fixes the build of llvm in spack#29350.

- Also check for installed gold linker and set +gold/~gold
bernhardkaindl added a commit to bernhardkaindl/spack that referenced this issue Sep 26, 2023
Fixes spack#29350:

- binutils: Make spack external find binutils set ~headers to fix build of llvm

Changes:

Add initial def determine_variants():

- llvm needs binutils+headers for plugin-api.h which most distros don't install
  and therefore make spack external find binutils detect binutils~headers.

  This forces spack to build binutils for llvm when binutils have been
  imported from the system. This fixes the build of llvm in spack#29350.

- Also check for installed gold linker and set +gold/~gold
therault added a commit to therault/parsec that referenced this issue Nov 7, 2023
therault added a commit to therault/parsec that referenced this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants