Skip to content

Build error on NixOS #3

@TACIXAT

Description

@TACIXAT

I recognize this isn't a problem with the package, so feel free to close. However, any idea what would cause the following during the generate step?

Error: can't write /home/demo/bpf_with_go/app/src/gen_execve_bpfel.go: can't load BPF from ELF: load BTF maps: missing BTF

I've tried not stripping the binary, but get the same error.

Occurs here from bpf2go.

The .o file has a .maps section (Section 6). Seems to be missing a btf spec, but I don't know what that is.

$ eu-readelf -S src/gen_execve_bpfel.o
There are 21 section headers, starting at offset 0x10d8:

Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES Flags Lk Inf Al
[ 0]                      NULL         0000000000000000 00000000 00000000  0        0   0  0
[ 1] .strtab              STRTAB       0000000000000000 00000fdb 000000f7  0        0   0  1
[ 2] .text                PROGBITS     0000000000000000 00000040 00000000  0 AX     0   0  4
[ 3] tracepoint/syscalls/sys_enter_execve PROGBITS     0000000000000000 00000040 000000ac  0 AX     0   0 16
[ 4] .relatracepoint/syscalls/sys_enter_execve RELA         0000000000000000 000009f0 00000018 24       20   3  8
[ 5] .bss                 NOBITS       0000000000000000 000000ec 00000044  0 WA     0   0  4
[ 6] .maps                PROGBITS     0000000000000000 000000f0 00000018  0 WA     0   0  8
[ 7] .rodata.str1.1       PROGBITS     0000000000000000 00000108 0000000e  1 AMS    0   0  1
[ 8] license              PROGBITS     0000000000000000 00000116 00000004  0 WA     0   0  1
[ 9] .debug_str           PROGBITS     0000000000000000 0000011a 000001d7  1 MS     0   0  1
[10] .debug_loc           PROGBITS     0000000000000000 000002f1 00000059  0        0   0  1
[11] .debug_abbrev        PROGBITS     0000000000000000 0000034a 00000141  0        0   0  1
[12] .debug_info          PROGBITS     0000000000000000 0000048b 00000338  0        0   0  1
[13] .rela.debug_info     RELA         0000000000000000 00000a08 000005a0 24       20  12  8
[14] .note.GNU-stack      PROGBITS     0000000000000000 000007c3 00000000  0        0   0  1
[15] .eh_frame            X86_64_UNWIND 0000000000000000 000007c8 00000040  0 A      0   0  8
[16] .rela.eh_frame       RELA         0000000000000000 00000fa8 00000018 24       20  15  8
[17] .debug_line          PROGBITS     0000000000000000 00000808 000000dd  0        0   0  1
[18] .rela.debug_line     RELA         0000000000000000 00000fc0 00000018 24       20  17  8
[19] .llvm_addrsig        SHT_LOOS+fff4c03 0000000000000000 00000fd8 00000003  0 E     20   0  1
[20] .symtab              SYMTAB       0000000000000000 000008e8 00000108 24        1   7  8

The vmlinux.h generation worked.

Relevant packages I have installed -

   go_1_17
   clang_10
   bpftools
   libbpf
   gnumake

I feel like something is performing differently on NixOS but I'm not sure what.

Thanks for the work on this and the YT video!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions