Re: [vpp-dev] linking error in VPP af_xdp_plugin using system libbpf

2021-09-09 Thread Nick Brown
On Thu, 9 Sept 2021 at 10:26, Nicholas Brown  wrote:

>
>
> On Thu, 9 Sept 2021 at 08:48, Benoit Ganne (bganne) 
> wrote:
>
>> Hi Nick,
>>
>> > When attempting to build vpp against system libraries (dpdk, libbpf,
>> etc)
>> > on Debian Bullseye I get the following error when building the
>> > af_xdp_plugin.so
>> > Is the af_xdp plugin doing something unusual with libbpf?
>>
>> Af_xdp_plugin.so is a dynamically loadable object (as all VPP plugins),
>> hence libbpf.a must be compiled as PIC which is not the case here.
>> When you use VPP default build system, we compile libbpf.a as PIC and
>> link against that.
>>
>
> Hi Ben,
>
> Thanks for the tips.
>
> yes, I'd misread the debian build log for libbpf:
> https://buildd.debian.org/status/fetch.php?pkg=libbpf=amd64=0.3-2=1610313206=0
> Only the shared objects are build with PIC, the static library is not.
>
>
>> What is the reason to use the system libbpf instead of the one we
>> compile? Apart from PIC, libbpf itself is not stable yet so you could
>> encounter more subtile incompatibilities down the road.
>>
>>
> For the system I'm building I need the build to be reproducible and
> buildable in isolate. The layered vpp build system depends on downloading
> things from the internet during the build. The system will also be
> maintained for some time, so getting security updates for the likes of
> dpdk, libbpf, etc from the Debian system packages would also be important.
>
> The following change allows me to build:
>
> diff --git a/src/plugins/af_xdp/CMakeLists.txt
> b/src/plugins/af_xdp/CMakeLists.txt
> index cbe96aa59..ee1743bbe 100644
> --- a/src/plugins/af_xdp/CMakeLists.txt
> +++ b/src/plugins/af_xdp/CMakeLists.txt
> @@ -18,7 +18,7 @@ if (NOT BPF_INCLUDE_DIR)
>  endif()
>
>  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
> -vpp_plugin_find_library(af_xdp BPF_LIB libbpf.a)
> +vpp_plugin_find_library(af_xdp BPF_LIB libbpf)
>  vpp_plugin_find_library(af_xdp BPF_ELF_LIB elf)
>  vpp_plugin_find_library(af_xdp BPF_Z_LIB z)
>  if (NOT BPF_LIB OR NOT BPF_ELF_LIB OR NOT BPF_Z_LIB)
>
> but something that supports both a local or system library build would be
> preferable.
>

Actually I spoke too soon. :-) With this change it actually doesn't find
the library and thus simply doesn't build the plugin.

-- -- libbpf library not found - af_xdp plugin disabled

Thanks,
Nick

Separately, does the VPP cmake definitions allow me to configure which
> plugins are built (perhaps with some -D option), so I disable certain ones?
>
> Thanks,
> Nick
>
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20106): https://lists.fd.io/g/vpp-dev/message/20106
Mute This Topic: https://lists.fd.io/mt/85468297/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] linking error in VPP af_xdp_plugin using system libbpf

2021-09-09 Thread Nick Brown
On Thu, 9 Sept 2021 at 08:48, Benoit Ganne (bganne) 
wrote:

> Hi Nick,
>
> > When attempting to build vpp against system libraries (dpdk, libbpf, etc)
> > on Debian Bullseye I get the following error when building the
> > af_xdp_plugin.so
> > Is the af_xdp plugin doing something unusual with libbpf?
>
> Af_xdp_plugin.so is a dynamically loadable object (as all VPP plugins),
> hence libbpf.a must be compiled as PIC which is not the case here.
> When you use VPP default build system, we compile libbpf.a as PIC and link
> against that.
>

Hi Ben,

Thanks for the tips.

yes, I'd misread the debian build log for libbpf:
https://buildd.debian.org/status/fetch.php?pkg=libbpf=amd64=0.3-2=1610313206=0
Only the shared objects are build with PIC, the static library is not.


> What is the reason to use the system libbpf instead of the one we compile?
> Apart from PIC, libbpf itself is not stable yet so you could encounter more
> subtile incompatibilities down the road.
>
>
For the system I'm building I need the build to be reproducible and
buildable in isolate. The layered vpp build system depends on downloading
things from the internet during the build. The system will also be
maintained for some time, so getting security updates for the likes of
dpdk, libbpf, etc from the Debian system packages would also be important.

The following change allows me to build:

diff --git a/src/plugins/af_xdp/CMakeLists.txt
b/src/plugins/af_xdp/CMakeLists.txt
index cbe96aa59..ee1743bbe 100644
--- a/src/plugins/af_xdp/CMakeLists.txt
+++ b/src/plugins/af_xdp/CMakeLists.txt
@@ -18,7 +18,7 @@ if (NOT BPF_INCLUDE_DIR)
 endif()

 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
-vpp_plugin_find_library(af_xdp BPF_LIB libbpf.a)
+vpp_plugin_find_library(af_xdp BPF_LIB libbpf)
 vpp_plugin_find_library(af_xdp BPF_ELF_LIB elf)
 vpp_plugin_find_library(af_xdp BPF_Z_LIB z)
 if (NOT BPF_LIB OR NOT BPF_ELF_LIB OR NOT BPF_Z_LIB)

but something that supports both a local or system library build would be
preferable.

Separately, does the VPP cmake definitions allow me to configure which
plugins are built (perhaps with some -D option), so I disable certain ones?

Thanks,
Nick

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20105): https://lists.fd.io/g/vpp-dev/message/20105
Mute This Topic: https://lists.fd.io/mt/85468297/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-