Open WildbeestSingh opened 8 months ago
If you build against the libbpf library in lib/, libxdp will be statically linked against that library version, and you won't have to copy it anywhere.
I would recommend linking against the system libbpf version instead of messing around with hacking the Makefile to copy the libbpf library.
So you are suggesting me to build my program against the libbpf from the system and libxdp library from the xdp-tools/lib/libxdp?.
Jsingh @.***> writes:
So you are suggesting me to build my program against the libbpf from the system and libxdp library from the xdp-tools/lib/libxdp?.
Yes, as long as you are also linking libxdp against the system libbpf (which the configure file should do by default), this will work just fine.
Alright, btw, do you have any references for the samples/bpf/Makefile to use libbpf from xdp-tools/ instead from (kernel-sources)/tools/lib/bpf/ ?.
Jsingh @.***> writes:
Alright, btw, do you have any references for the samples/bpf/Makefile to use libbpf from xdp-tools/ instead from (kernel-sources)/tools/lib/bpf/ ?.
I don't know if that is possible, but in general samples/bpf in the kernel tree is unmaintained and slowly bitrotting. So I would not suggest using it, really. What utility from there are you trying to use?
Basically, I want to use the libbpf and libxdp libraries from the xdp-tools/ in the samples/bpf/Makefile file.
Jsingh @.***> writes:
Basically, I want to use the libbpf and libxdp libraries from the xdp-tools/ in the samples/bpf/Makefile file.
Yes, but why? Which files from samples/bpf do you want to make use of?
Sorry for the late reply. I'm not using any files from samples/bpf/ in my xdp application(under samples/bpf/). As my xdp application requires the libbpf and libxdp libraries and I want to utilize the existing Makefile(samples/bpf/). But now as I'm using the above two libraries from the xdp-tools/ thus no longer dependent on system/kernel tree libraries. Therefore, now I can move my application to any other path.
Problem statement: The xdp-tools/Makefile does not install libbpf libraries into local machine.
However, it does install the libxdp libraries into the local machine.
Steps: cd ../../../samples/bpf/xdp-tools/ $ FORCE_SUBDIR_LIBBPF=1 ./configure $ make $ sudo make install
I modified the Makefile in ..samples/bpf/ to incorporate the libbpf library from xdp-tools/lib/libbpf/src.
While I successfully built my program using the libbpf library generated under xdp-tools/lib/libbpf/src, I encountered runtime failures due to the program's dependence on the same library during runtime.
Consequently, I manually transferred all the libbpf libraries from the xdp-tools/lib/libbpf/src directory to the local machine, enabling my program to locate them at runtime.