Commit Graph

19 Commits

Author SHA1 Message Date
Toke Høiland-Jørgensen
c673cf628f configure: Make sure libxdp is before libbpf in linker arguments
When libxdp is linked against the submodule libbpf, the order of linker
arguments is important because libxdp.a needs symbols from libbpf.a. Fix up
configure so it ensures this.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-04-27 00:43:02 +02:00
Toke Høiland-Jørgensen
c2eb81ec70 Fix xdp-tools submodule to work with libbpf submodule
Update the version of xdp-tools to pull in some configure changes that
makes interoperating between a libbpf submodule and an xdp-tools submodule
work better, and set the LIBBPF_UNBUILT variable in the top-level configure
to enables this support.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-04-26 22:03:08 +02:00
Toke Høiland-Jørgensen
4ac5a33a40 lib: simplify installation of libbpf and libxdp submodule libraries
Instead of having the someone redundantly named 'lib/lib-install' folder,
let's rename it to just 'lib/install', and drop the 'usr/' prefix of the
files installed into that directory. Also, to simplify the configure
script, check in the directory to git so it's always present, and always
include it in the include and linker paths. On clean we just clear out the
contents.

Also, copy over libbpf.a to lib/install/lib alongside libxdp.a instead of
putting libbpf/src in the linker path.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-04-20 13:12:45 +02:00
Toke Høiland-Jørgensen
ff3e4272ff Integrate libxdp as a submodule
This adds libxdp as a submodule and link target alongside libbpf. This
should make it just as easy for examples to use libxdp as it currently is
for libbpf. Some hoops need to be jumped through to make libxdp link
against the same version of libbpf as the one we use in this repository.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-04-20 13:12:45 +02:00
Hengqi Chen
8301679918 configure: Fix mixed indentions
Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2022-03-06 21:52:48 +08:00
Toke Høiland-Jørgensen
8e9fc89bec libbpf: Update submodule version
Update the libbpf submodule to the latest version, and update the configure
script so we check for the newer bpf_object__next_program() helper (to fix
deprecation warnings).

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-01-17 13:11:27 +01:00
Toke Høiland-Jørgensen
3321c338d5 Merge pull request #25 from xdp-project/nat64
Add nat64 example
2021-10-12 20:24:17 +02:00
Toke Høiland-Jørgensen
81f127ce42 configure: avoid bashisms
The variable substitution used to parse the clang version was a bashism, so
it broke on Debian/Ubuntu. So let's just use sed instead.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-11 17:21:32 +02:00
Toke Høiland-Jørgensen
a5765295ac configure: Support parsing weird clang versions
Seems some distributions will change the clang version output to be
something like 'Ubuntu clang version
12.0.1-++20210918042554+fed41342a82f-1~exp1~20210918143322.141'. Fix the
version parsing in configure to not barf on such weird version strings.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-11 14:23:52 +02:00
Toke Høiland-Jørgensen
457a9c99bf configure: check clang version
Check clang version on configure and bail if it's too old.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-04 13:43:29 +02:00
Toke Høiland-Jørgensen
c7e3acf5d0 common.mk: support generating skeletons for BPF object files
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-29 01:44:49 +02:00
Toke Høiland-Jørgensen
3bc8e68636 configure: check for bpf_tc_attach() in libbpf
We want to be able to use the new bpf_tc_attach() function for attaching TC
programs, so check for it in configure.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-06-01 17:03:18 +02:00
Toke Høiland-Jørgensen
7e0f0b0338 Merge pull request #19 from vincentbernat/fix/debian-glibc-install
configure: tell which package to install on Debian for header files
2021-05-31 17:24:43 +02:00
Vincent Bernat
eb8e77fbe9 configure: tell which package to install on Debian for header files
Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-05-31 12:23:29 +02:00
Vincent Bernat
321293e3f5 configure: remove requirements on M4 and Emacs
They are not used.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-05-31 12:22:14 +02:00
Jesper Dangaard Brouer
fb01b49ec0 configure: add detection for missing header files for errno.h
It is fairly natural to include <errno.h> in BPF programs as some
helpers and hooks use these errno defines (like lsm-nobpf/).  Again we
discover that when compiling with clang option[1] "-target bpf" the OS
distros header files gets confused as __x86_64__ isn't define by clang
which in this case (on Fedora) cause include <gnu/stubs-32.h>.

The error looks like this:

$ make
    CLANG    lsm-nobpf-kern.o
In file included from lsm-nobpf-kern.c:6:
In file included from /usr/include/errno.h:25:
In file included from /usr/include/features.h:474:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
# include <gnu/stubs-32.h>
          ^~~~~~~~~~~~~~~~

This patch adds a compile test to configure script to help people
realize why compiling is failing on their systems.

[1] https://www.kernel.org/doc/html/latest/bpf/bpf_devel_QA.html#q-clang-flag-for-target-bpf

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 16:28:45 +01:00
Jesper Dangaard Brouer
74e549520a Change libbpf install location to fix "dirty" submodule
When installing libbpf headers into 'lib/libbpf/src/root/' then the git
submodule for libbpf is marked dirty. This result in stgit complains under
different operations.

This patch fix the issue by installing libbpf outside submodule directory.
Choose directory 'lib/libbpf-install/' to emphasize relation to 'lib/libbpf/'.

V2: Don't install the library only the header files as before. Also
installing the should be a separate commit.  Patch still statically
link with libbpf/src/libbpf.a.

Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
2021-01-13 18:31:45 +01:00
Toke Høiland-Jørgensen
175fb4ad6c configure: Add variable to force submodule
Also don't call removed check for perf_buffer__consume() when using system
libbpf.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-01-12 21:45:29 +01:00
Toke Høiland-Jørgensen
4513664ca3 Initial import with encap-forward example
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2020-10-06 15:53:55 +02:00