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

Compilation error: error: ‘struct bpf_map_skeleton’ has no member named ‘link’ when linking against system libbpf on Fedora 41 #1151

Open
anh0516 opened this issue Jan 2, 2025 · 3 comments
Labels
build Build related issues fedora

Comments

@anh0516
Copy link
Contributor

anh0516 commented Jan 2, 2025

Fedora 41 just got Linux 6.12, so I decided to try scx schedulers. The C schedulers fail to build against the system libbpf, whether with static or dynamic linking. The cloned libbpf works fine.

[1/46] Generating libbpf with a custom command

[2/46] Generating bpftool_target with a custom command

[11/27] Compiling C object scheds/c/scx_central.p/scx_central.c.o
FAILED: scheds/c/scx_central.p/scx_central.c.o 
cc -Ischeds/c/scx_central.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_central.p/scx_central.c.o -MF scheds/c/scx_central.p/scx_central.c.o.d -o scheds/c/scx_central.p/scx_central.c.o -c ../scheds/c/scx_central.c
In file included from ../scheds/c/scx_central.c:16:
scheds/c/scx_central.p/scx_central.bpf.skel.h: In function ‘scx_central__create_skeleton’:
scheds/c/scx_central.p/scx_central.bpf.skel.h:354:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  354 |         map->link = &obj->links.central_ops;
      |            ^~
[12/27] Compiling C object scheds/c/scx_nest.p/scx_nest.c.o
FAILED: scheds/c/scx_nest.p/scx_nest.c.o 
cc -Ischeds/c/scx_nest.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_nest.p/scx_nest.c.o -MF scheds/c/scx_nest.p/scx_nest.c.o.d -o scheds/c/scx_nest.p/scx_nest.c.o -c ../scheds/c/scx_nest.c
In file included from ../scheds/c/scx_nest.c:15:
scheds/c/scx_nest.p/scx_nest.bpf.skel.h: In function ‘scx_nest__create_skeleton’:
scheds/c/scx_nest.p/scx_nest.bpf.skel.h:353:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  353 |         map->link = &obj->links.nest_ops;
      |            ^~
[13/27] Compiling C object scheds/c/scx_qmap.p/scx_qmap.c.o
FAILED: scheds/c/scx_qmap.p/scx_qmap.c.o 
cc -Ischeds/c/scx_qmap.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_qmap.p/scx_qmap.c.o -MF scheds/c/scx_qmap.p/scx_qmap.c.o.d -o scheds/c/scx_qmap.p/scx_qmap.c.o -c ../scheds/c/scx_qmap.c
In file included from ../scheds/c/scx_qmap.c:15:
scheds/c/scx_qmap.p/scx_qmap.bpf.skel.h: In function ‘scx_qmap__create_skeleton’:
scheds/c/scx_qmap.p/scx_qmap.bpf.skel.h:399:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  399 |         map->link = &obj->links.qmap_ops;
      |            ^~
[14/27] Compiling C object scheds/c/scx_simple.p/scx_simple.c.o
FAILED: scheds/c/scx_simple.p/scx_simple.c.o 
cc -Ischeds/c/scx_simple.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_simple.p/scx_simple.c.o -MF scheds/c/scx_simple.p/scx_simple.c.o.d -o scheds/c/scx_simple.p/scx_simple.c.o -c ../scheds/c/scx_simple.c
In file included from ../scheds/c/scx_simple.c:13:
scheds/c/scx_simple.p/scx_simple.bpf.skel.h: In function ‘scx_simple__create_skeleton’:
scheds/c/scx_simple.p/scx_simple.bpf.skel.h:318:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  318 |         map->link = &obj->links.simple_ops;
      |            ^~
[15/27] Compiling C object scheds/c/scx_userland.p/scx_userland.c.o
FAILED: scheds/c/scx_userland.p/scx_userland.c.o 
cc -Ischeds/c/scx_userland.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_userland.p/scx_userland.c.o -MF scheds/c/scx_userland.p/scx_userland.c.o.d -o scheds/c/scx_userland.p/scx_userland.c.o -c ../scheds/c/scx_userland.c
In file included from ../scheds/c/scx_userland.c:32:
scheds/c/scx_userland.p/scx_userland.bpf.skel.h: In function ‘scx_userland__create_skeleton’:
scheds/c/scx_userland.p/scx_userland.bpf.skel.h:333:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  333 |         map->link = &obj->links.userland_ops;
      |            ^~
[16/27] Compiling C object scheds/c/scx_flatcg.p/scx_flatcg.c.o
FAILED: scheds/c/scx_flatcg.p/scx_flatcg.c.o 
cc -Ischeds/c/scx_flatcg.p -Ischeds/c -I../scheds/c -I../scheds/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -pthread -DWITH_GZFILEOP -MD -MQ scheds/c/scx_flatcg.p/scx_flatcg.c.o -MF scheds/c/scx_flatcg.p/scx_flatcg.c.o.d -o scheds/c/scx_flatcg.p/scx_flatcg.c.o -c ../scheds/c/scx_flatcg.c
In file included from ../scheds/c/scx_flatcg.c:18:
scheds/c/scx_flatcg.p/scx_flatcg.bpf.skel.h: In function ‘scx_flatcg__create_skeleton’:
scheds/c/scx_flatcg.p/scx_flatcg.bpf.skel.h:360:12: error: ‘struct bpf_map_skeleton’ has no member named ‘link’
  360 |         map->link = &obj->links.flatcg_ops;
      |            ^~
ninja: build stopped: subcommand failed.
@luigidematteis
Copy link
Contributor

Hi @anh0516,
What version of bpftool are you using?
There seems to be a mismatch between the version of libbpf bundled with bpftool and the one installed on your system.

@anh0516
Copy link
Contributor Author

anh0516 commented Jan 3, 2025

Both the system bpftool 7.5 and the cloned bpftool fail when using system libbpf. They both work when using the cloned libbpf.

@hhoffstaette
Copy link

hhoffstaette commented Jan 8, 2025

Both the system bpftool 7.5 and the cloned bpftool fail when using system libbpf. They both work when using the cloned libbpf.

This is a well-known problem when building skeletons created with a bpftool that has a newer libbpf built-in than the libbpf used for compiling. bpftool-7.5.0 uses a built-in libbpf-1.5.0, whereas this says your system libbpf is still 1.4.x. We've had the same issue in Gentoo - I know since I'm the maintainer 🥲
Fedora needs to ship matching versions. Alternatively you can try to install libbpf from Rawhide (no guarantees).

@hodgesds hodgesds added build Build related issues fedora labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build related issues fedora
Projects
None yet
Development

No branches or pull requests

4 participants