Nixpkgs: Help wanted: implicit declaration of function

Created on 26 Jun 2020  路  2Comments  路  Source: NixOS/nixpkgs

Issue description

I am by no means a C/C++ programmer and am running into an issue with the testing kernels.

The build reports this:

  CC       /build/linux-5.8-rc2/build/tools/objtool/builtin-check.o
  CC       /build/linux-5.8-rc2/build/tools/objtool/builtin-orc.o
  CC       /build/linux-5.8-rc2/build/tools/objtool/elf.o
elf.c: In function 'read_symbols':
elf.c:378:8: error: implicit declaration of function 'gelf_getsymshndx'; did you mean 'gelf_getsym'? [-Werror=implicit-function-declaration]
  378 |   if (!gelf_getsymshndx(symtab->data, shndx_data, i, &sym->sym,
      |        ^~~~~~~~~~~~~~~~
      |        gelf_getsym
elf.c:378:8: error: nested extern declaration of 'gelf_getsymshndx' [-Werror=nested-externs]
cc1: all warnings being treated as errors
mv: cannot stat '/build/linux-5.8-rc2/build/tools/objtool/.elf.o.tmp': No such file or directory
make[4]: *** [/build/linux-5.8-rc2/tools/build/Makefile.build:97: /build/linux-5.8-rc2/build/tools/objtool/elf.o] Error 1
make[3]: *** [Makefile:64: /build/linux-5.8-rc2/build/tools/objtool/objtool-in.o] Error 2
make[2]: *** [Makefile:68: objtool] Error 2
make[1]: *** [/build/linux-5.8-rc2/Makefile:1858: tools/objtool] Error 2
make[1]: Leaving directory '/build/linux-5.8-rc2/build'
make: *** [Makefile:185: __sub-make] Error 2
builder for '/nix/store/qw3rplkabxd3l329p2a4fayfmsqc3f3a-linux-5.8-rc2.drv' failed with exit code 2
error: build of '/nix/store/qw3rplkabxd3l329p2a4fayfmsqc3f3a-linux-5.8-rc2.drv' failed

Here is the code it refers to:
https://github.com/torvalds/linux/blob/4e909124f8ed54b13e07e42273c3452b7deb5a0b/tools/objtool/elf.c#L378

I can't figure out which header is needed to get this function imported...
elf.h and gelf.h are already in scope. Searching the web has not been particularly successful :(
I don't think we would want to turn off -Werror=implicit-function-declaration, would we?

Steps to reproduce

nix-build -A linux_testing on master

Technical details

位 nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.3.0-61-generic, Ubuntu, 18.04.4 LTS (Bionic Beaver)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.6`
 - channels(tsteinbach): `"nixpkgs-20.09pre228333.1ae28ebfdb7"`
 - nixpkgs: `/home/tsteinbach/.nix-defexpr/channels/nixpkgs`
question kernel community feedback

Most helpful comment

https://logs.nix.samueldr.com/nixos-dev/2020-06-16#3608905

It looks like libelf is no longer sufficient for new versions of the kernel; 5.8 introduces https://github.com/torvalds/linux/commit/28fe1d7bf89f8ed5be70b98a33932dbaf99345dd which needs gelf_getsymshndx, but that only exists with elfutils, not libelf.

All 2 comments

https://logs.nix.samueldr.com/nixos-dev/2020-06-16#3608905

It looks like libelf is no longer sufficient for new versions of the kernel; 5.8 introduces https://github.com/torvalds/linux/commit/28fe1d7bf89f8ed5be70b98a33932dbaf99345dd which needs gelf_getsymshndx, but that only exists with elfutils, not libelf.

Oh, that makes a lot of sense. I had looked at that commit and it wasn't really giving me enough detail. I'll see that 5.8+ build with elfutils.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

copumpkin picture copumpkin  路  3Comments

lverns picture lverns  路  3Comments

yawnt picture yawnt  路  3Comments

grahamc picture grahamc  路  3Comments

ob7 picture ob7  路  3Comments