Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 754759 - dev-util/bpftrace-0.11.3-r1: emerge failed: /usr/include/bpf/btf.h:116:14: error: use of enum ‘btf_func_linkage’ without previous declaration
Summary: dev-util/bpftrace-0.11.3-r1: emerge failed: /usr/include/bpf/btf.h:116:14: er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-15 18:45 UTC by WGH
Modified: 2020-12-04 03:10 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,46.11 KB, text/x-log)
2020-11-15 23:58 UTC, WGH
Details

Note You need to log in before you can comment on or make changes to this bug.
Description WGH 2020-11-15 18:45:42 UTC
bpftrace fails to emerge, presumably because there's something wrong with libbpf headers regarding C++ compatibility.

Reproducible: Always

Steps to Reproduce:
1. emerge bpftrace
Actual Results:  
FAILED: src/CMakeFiles/bpftrace.dir/btf.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DBPFTRACE_VERSION=\"v0.11.3\" -DHAVE_BCC_CREATE_MAP -DHAVE_BCC_ELF_FOREACH_SYM -DHAVE_BCC_KFUNC -DHAVE_BCC_PROG_LOAD -DHAVE_BCC_USDT_ADDSEM -DHAVE_BFD_DISASM -DHAVE_LIBBPF -DHAVE_LIBBPF_BTF_DUMP -DHAVE_LIBBPF_BTF_DUMP_EMIT_TYPE_DECL -DHAVE_NAME_TO_HANDLE_AT=1 -DLIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE -DLIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE -DLIBBFD_DISASM_FOUR_ARGS_SIGNATURE -I/var/tmp/portage/dev-util/bpftrace-0.11.3-r1/work/bpftrace-0.11.3/src -I/var/tmp/portage/dev-util/bpftrace-0.11.3-r1/work/bpftrace-0.11.3/src/ast -I. -I/var/tmp/portage/dev-util/bpftrace-0.11.3-r1/work/bpftrace-0.11.3/resources/../src -isystem /usr/lib/llvm/10/include  -march=native -O2 -pipe   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wwrite-strings -Wcast-qual -Wswitch-default -Wunreachable-code -Wdisabled-optimization -std=c++17 -MD -MT src/CMakeFiles/bpftrace.dir/btf.cpp.o -MF src/CMakeFiles/bpftrace.dir/btf.cpp.o.d -o src/CMakeFiles/bpftrace.dir/btf.cpp.o -c /var/tmp/portage/dev-util/bpftrace-0.11.3-r1/work/bpftrace-0.11.3/src/btf.cpp
In file included from /var/tmp/portage/dev-util/bpftrace-0.11.3-r1/work/bpftrace-0.11.3/src/btf.cpp:20:
/usr/include/bpf/btf.h:116:14: error: use of enum ‘btf_func_linkage’ without previous declaration
  116 |         enum btf_func_linkage linkage, int proto_type_id);
      |              ^~~~~~~~~~~~~~~~
[19/43] /usr/bin/x86_64-pc-linux-gnu-g++ -DBPFTRACE_VERSION=\"v0.1


Possibly relevant package versions:
* dev-util/bpftrace-0.11.3
* dev-libs/libbpf-0.2
* sys-devel/gcc-9.3.0-r1

Interestingly, a simple "#include <bpf/btf.h>" compiles fine with gcc, but not with g++.

$ emerge --info '=dev-util/bpftrace-0.11.3-r1::gentoo'
Portage 3.0.8 (python 3.7.9-final-0, default/linux/amd64/17.1/systemd, gcc-9.3.0, glibc-2.32-r2, 5.9.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.9.6-gentoo-x86_64-AMD_Ryzen_9_3900XT_12-Core_Processor-with-gentoo-2.7
KiB Mem:   131846516 total, 105633136 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 15 Nov 2020 17:15:01 +0000
Head commit of repository gentoo: 85dfa96ef07e60773ddecfc687e1e5772b00aee0
Timestamp of repository steam-overlay: Fri, 06 Nov 2020 22:05:28 +0000
Head commit of repository steam-overlay: 3dd4279a04e2ef34a3ab498e174535ac637c45ff

sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.7.9::gentoo, 3.8.5::gentoo, 3.9.0::gentoo
dev-util/cmake:           3.17.4-r1::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync2.ru.gentoo.org/gentoo-portage/
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j24"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bindist bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl systemd tcpd udev unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jonas Stein gentoo-dev 2020-11-15 23:00:38 UTC
Thank you for the report. We need to have all information at hand before ticket assignment. That is why I ask you to 
* attach the logs  
as described on https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket
Please reopen this ticket (Status:UNCONFIRMED) afterwards.
Comment 2 WGH 2020-11-15 23:58:43 UTC
Created attachment 671575 [details]
build.log
Comment 3 WGH 2020-11-16 00:01:27 UTC
Sorry about that.
Comment 4 gentoo 2020-11-16 08:10:40 UTC
I get the same error with sys-kernel/linux-headers-5.4-r1

It compiles with sys-kernel/linux-headers-5.9

linux-5.6 is the earliest version that declares enum btf_func_linkage in uapi/linux/btf.h

dev-libs/libbpf-0.2's bpf/uapi/linux/btf.h declares enum btf_func_linkage too, but maybe the linux-headers version is found first?
Comment 5 WGH 2020-11-16 14:07:32 UTC
emerging sys-kernel/linux-headers-5.9 fixed that for me, too.
Comment 6 Patrick McLean gentoo-dev 2020-12-04 03:10:36 UTC
This should be fixed with dev-util/bpftrace-0.11.4, reopen if it's still present.