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

advanced03-AF_XDP does not compile missing header file xsk.h #72

Closed
netoptimizer opened this issue Sep 6, 2019 · 9 comments
Closed
Assignees

Comments

@netoptimizer
Copy link
Member

The advanced03-AF_XDP example/assignment does not compile on my system. It is missing a header include file named: bpf/xsk.h.

Output is:

advanced03-AF_XDP]$ make
cc -Wall -I../libbpf/src//root/usr/include/ -g -I/usr/include/x86_64-linux-gnu -I../headers/ -L../libbpf/src/ -o af_xdp_user ../common//common_params.o ../common//common_user_bpf_xdp.o \
 af_xdp_user.c -l:libbpf.a -lelf  -lpthread
af_xdp_user.c:19:10: fatal error: bpf/xsk.h: No such file or directory
 #include <bpf/xsk.h>
          ^~~~~~~~~~~
compilation terminated.
make: *** [../common//common.mk:105: af_xdp_user] Error 1

The header file xsk.h is provided by libbpf, but not under subdir bpf/. In my git tree the file is located in: libbpf/src/xsk.h and XDP-tutorial does have this (../libbpf/src/) as object search/link dir in above compile command.

I guess libbpf should have "installed" this header file in: ../libbpf/src//root/usr/include/ but it only contains:

$ ls -1 libbpf/src//root/usr/include/bpf/
bpf.h
btf.h
libbpf.h
@netoptimizer
Copy link
Member Author

I do have the latest libbpf version:

$ git submodule status 
 476e158b07ea5f36f4475735330c1152ffe15acc libbpf (v0.0.4-46-g476e158b07ea)

This is (currently) the latest commit for libbpf.

netoptimizer added a commit that referenced this issue Sep 6, 2019
Until issue #72 is resolved remove advanced03-AF_XDP from
the main/global Makefile.

Signed-off-by: Jesper Dangaard Brouer <[email protected]>
@netoptimizer
Copy link
Member Author

Hmm... this was weird, after above mentioned commit dbd66f1 and compiling all assignments successfully, somehow libbpf were also "re-installed", and now my local libbpf/src//root/usr/include/bpf/ dir contains:

$ ls -1 libbpf/src//root/usr/include/bpf/
bpf.h
btf.h
libbpf.h
libbpf_util.h
xsk.h

And now, the advanced03-AF_XDP example compiles.

netoptimizer added a commit that referenced this issue Sep 6, 2019
The libbpf headers got installed into ../libbpf/src/root via
invoking make install_headers with DESTDIR=root.

This patch change the clean target to also cleanup this DESTDIR,
but LIBBPF_DIR is supplied by Makefile that include common.mk,
and rm command could be expanded to /root, if Makefile didn't
define this, which is too high risk. Thus, change the DESTDIR
name to "build" before, changing clean target.

I don't think this solves the issue #72, but it helps avoid
stale files in this DESTDIR.

Signed-off-by: Jesper Dangaard Brouer <[email protected]>
@chaudron
Copy link
Contributor

Is this still a problem based on #73 comment? I tried it using the vagrant method from this pull request and do not get the errors #70

@chaudron
Copy link
Contributor

Any update on the above @netoptimizer? As it works fine in my setup

@netoptimizer
Copy link
Member Author

Notice that in commit 064365f I renamed libbpf install path from root to build

From: libbpf/src/root/usr/include/bpf/
To:   libbpf/src/build/usr/include/bpf/

@netoptimizer
Copy link
Member Author

I'm going to close this, because this was a case of stalled files from other libbpf submodule checkouts.

In commit 064365f have tried to fix this by having make clean also removing the build version of libbpf. If people hit this again, we first as them to run make clean and try again.

I didn't find a way to create a Makefile dependency that can detect that libbpf submodule was changed, and force a rebuild of the libbpf build dir.

@tohojo
Copy link
Member

tohojo commented Dec 6, 2019 via email

@netoptimizer
Copy link
Member Author

No, please don't.

This is a tutorial that needs to be easy to get started with, I don't want people/users to depend on installing a git subcommand like subtrac before getting started...

@tohojo
Copy link
Member

tohojo commented Dec 6, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants