Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

How to include ebpf_xdp.h #129

Open
MarcusWichelmann opened this issue Feb 22, 2021 · 3 comments
Open

How to include ebpf_xdp.h #129

MarcusWichelmann opened this issue Feb 22, 2021 · 3 comments
Labels

Comments

@MarcusWichelmann
Copy link

MarcusWichelmann commented Feb 22, 2021

When compiling a .p4 file as described in the readme, clang cannot find the ebpf_xdp.h header:

/tmp/xdp1.h:6:10: fatal error: 'ebpf_xdp.h' file not found

The header file is included in this repository and says

This file contains all functions and definitions necessary for the xdp target C code to compile. It must be included with any file generated by the p4c-xdp compiler.

But how am I supposed to include it? Of course, I could hack this together somehow, but I'm wondering what is the correct way you intended for this. 😄 Maybe the Readme needs an update?

@mihaibudiu
Copy link
Contributor

The C compiler can be given a -I flag to indicate a path where headers are expected to be found.
So probably adding clang -I tests .... would work (assuming you are invoking clang in the root directory of the p4c-xdp project, since the ebpf_xdp.h file is there.) If this works for you we can update the README.

@MarcusWichelmann
Copy link
Author

Thank you for your quick response.

Yes, that's what I meant with hack this together. 😄 I managed to build it now by including these directories:

-I ../p4c/backends/ebpf/runtime/ \
-I ../p4c/extensions/p4c-xdp/tests/ \
-I ../p4c/backends/ebpf/runtime/contrib/libbpf/src/ \

Is it really necessary to include them manually or is there something wrong with my install (debian 10, built from sources) annd normally the headers get installed into the system?

Anyway, adding a hint to the Readme would probably be helpful for others.

@mihaibudiu
Copy link
Contributor

This package does not install anything on your system, so you will need to specify the path to the headers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2 participants