Re: [PATCHv4 iproute2-next 1/5] configure: add check_libbpf() for later libbpf support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 13, 2020 at 08:26:51PM -0700, David Ahern wrote:
> > +# Influential LIBBPF environment variables:
> > +#   LIBBPF_FORCE={on,off}   on: require link against libbpf;
> > +#                           off: disable libbpf probing
> > +#   LIBBPF_LIBDIR           Path to libbpf to use
> > +

...
> > +check_libbpf()
> > +{
> > +    # if set LIBBPF_FORCE=off, disable libbpf entirely
> > +    if [ "$LIBBPF_FORCE" = off ]; then
> > +        echo "no"
> > +        return
> > +    fi
> > +
> > +    if ! ${PKG_CONFIG} libbpf --exists && [ -z "$LIBBPF_DIR" ] ; then
> > +        echo "no"
> > +        check_force_libbpf_on
> > +        return
> > +    fi

...

> 
> Something is off with the version detection.
> 
> # LIBBPF_LIBDIR=/tmp/libbpf ./configure

My copy-past error. It should take LIBBPF_DIR, but I wrote LIBBPF_LIBDIR in
the description... Also the folder should be libbpf dest dir, not libbpf
dir directly. To be consistent with the libbpf document. I will change
LIBBPF_DIR to LIBBPF_DESTDIR(Please tell me if you think the name is not
suitable). The fix diff will looks like

diff --git a/configure b/configure
index 3081a2ac..5ca10337 100755
--- a/configure
+++ b/configure
@@ -5,7 +5,7 @@
 # Influential LIBBPF environment variables:
 #   LIBBPF_FORCE={on,off}   on: require link against libbpf;
 #                           off: disable libbpf probing
-#   LIBBPF_LIBDIR           Path to libbpf to use
+#   LIBBPF_DESTDIR          Path to libbpf dest dir to use
 
 INCLUDE=${1:-"$PWD/include"}
 
@@ -301,20 +301,20 @@ check_libbpf()
         return
     fi
 
-    if ! ${PKG_CONFIG} libbpf --exists && [ -z "$LIBBPF_DIR" ] ; then
+    if ! ${PKG_CONFIG} libbpf --exists && [ -z "$LIBBPF_DESTDIR" ] ; then
         echo "no"
         check_force_libbpf_on
         return
     fi
 
     if [ $(uname -m) = x86_64 ]; then
-        local LIBBPF_LIBDIR="${LIBBPF_DIR}/lib64"
+        local LIBBPF_LIBDIR="${LIBBPF_DESTDIR}/usr/lib64"
     else
-        local LIBBPF_LIBDIR="${LIBBPF_DIR}/lib"
+        local LIBBPF_LIBDIR="${LIBBPF_DESTDIR}/usr/lib"
     fi
 
-    if [ -n "$LIBBPF_DIR" ]; then
-        LIBBPF_CFLAGS="-I${LIBBPF_DIR}/include"
+    if [ -n "$LIBBPF_DESTDIR" ]; then
+        LIBBPF_CFLAGS="-I${LIBBPF_DESTDIR}/usr/include"
         LIBBPF_LDLIBS="${LIBBPF_LIBDIR}/libbpf.a -lz -lelf"
         LIBBPF_VERSION=$(PKG_CONFIG_LIBDIR=${LIBBPF_LIBDIR}/pkgconfig ${PKG_CONFIG} libbpf --modversion)
     else

When you compile libbpf, it should like

$ mkdir /tmp/libbpf_destdir
$ cd libbpf/src/
$ make
...
  CC       libbpf.so.0.2.0
$ DESTDIR=/tmp/libbpf_destdir make install

Then in iproute2, configure it with

$ LIBBPF_DIR=/tmp/libbpf_destdir ./configure
TC schedulers
 ATM    no

libc has setns: yes
SELinux support: no
libbpf support: yes
        libbpf version 0.2.0
ELF support: yes
libmnl support: yes
Berkeley DB: no
need for strlcpy: yes
libcap support: yes

Thanks
Hangbin




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux