[ovs-dev,v2,1/3] acinclude: Also use LIBS from dpkg pkg-config
diff mbox series

Message ID 20190130100832.12164-2-christian.ehrhardt@canonical.com
State Changes Requested
Delegated to: Ian Stokes
Headers show
Series
  • fix build with DPDK 18.11 without -ldpdk
Related show

Commit Message

Christian Ehrhardt Jan. 30, 2019, 10:08 a.m. UTC
DPDK 18.11 builds using the more modern meson build system no more
provide the -ldpdk linker script. Instead it is expected to use
pkgconfig for linker options as well.

This change will set DPDK_LIB from pkg-config (if pkg-config was
available) and since that already carries the whole-archive flags around
the PMDs skips the further wrapping in more whole-archive if that is
already part of DPDK_LIB.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 acinclude.m4 | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Ian Stokes Feb. 4, 2019, 7:57 p.m. UTC | #1
> DPDK 18.11 builds using the more modern meson build system no more provide
> the -ldpdk linker script. Instead it is expected to use pkgconfig for
> linker options as well.
> 
> This change will set DPDK_LIB from pkg-config (if pkg-config was
> available) and since that already carries the whole-archive flags around
> the PMDs skips the further wrapping in more whole-archive if that is
> already part of DPDK_LIB.
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---

Hi Christian,

Thanks for this, this patch will cause the travis build to fail, I'd suggest it be rolled into patch 2 of the series as its expected for all patches to pass the build individually rather than being corrected by a later patch in the series.

https://travis-ci.org/istokes/ovs/builds/488462598

Just a query for the RHEL folks, I remember there being some concern as the DPDK userspace conference with regards to dependencies required for the meson build of DPDK not being supported in RHEL distros, is this still the case?

Ian
Aaron Conole Feb. 6, 2019, 9:15 p.m. UTC | #2
"Stokes, Ian" <ian.stokes@intel.com> writes:

>> DPDK 18.11 builds using the more modern meson build system no more provide
>> the -ldpdk linker script. Instead it is expected to use pkgconfig for
>> linker options as well.
>> 
>> This change will set DPDK_LIB from pkg-config (if pkg-config was
>> available) and since that already carries the whole-archive flags around
>> the PMDs skips the further wrapping in more whole-archive if that is
>> already part of DPDK_LIB.
>> 
>> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
>> ---
>
> Hi Christian,
>
> Thanks for this, this patch will cause the travis build to fail, I'd
> suggest it be rolled into patch 2 of the series as its expected for
> all patches to pass the build individually rather than being corrected
> by a later patch in the series.
>
> https://travis-ci.org/istokes/ovs/builds/488462598
>
> Just a query for the RHEL folks, I remember there being some concern
> as the DPDK userspace conference with regards to dependencies required
> for the meson build of DPDK not being supported in RHEL distros, is
> this still the case?

I think this change is independent of the meson build.  It merely takes
the meson build into account, from what I can tell.

> Ian

Patch
diff mbox series

diff --git a/acinclude.m4 b/acinclude.m4
index f038fd457..a45411860 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -223,9 +223,9 @@  AC_DEFUN([OVS_CHECK_DPDK], [
     case "$with_dpdk" in
       yes)
         DPDK_AUTO_DISCOVER="true"
-        PKG_CHECK_MODULES([DPDK], [libdpdk],
-                          [DPDK_INCLUDE="$DPDK_CFLAGS"],
-                          [DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"])
+        PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk],
+                                 [DPDK_INCLUDE="$DPDK_CFLAGS", DPDK_LIB="$DPDK_LIBS"],
+                                 [DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk", DPDK_LIB="-ldpdk"])
         ;;
       *)
         DPDK_AUTO_DISCOVER="false"
@@ -238,10 +238,10 @@  AC_DEFUN([OVS_CHECK_DPDK], [
            DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk"
         fi
         DPDK_LIB_DIR="$with_dpdk/lib"
+        DPDK_LIB="-ldpdk"
         ;;
     esac
 
-    DPDK_LIB="-ldpdk"
     DPDK_EXTRA_LIB=""
 
     ovs_save_CFLAGS="$CFLAGS"
@@ -346,7 +346,14 @@  AC_DEFUN([OVS_CHECK_DPDK], [
     #
     # These options are specified inside a single -Wl directive to prevent
     # autotools from reordering them.
-    DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
+    #
+    # OTOH newer versions of dpdk pkg-config (generated with Meson)
+    # will already have flagged just the right set of libs with
+    # --whole-archive - in those cases do not wrap it once more.
+    case "$DPDK_LIB" in
+      *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;;
+      *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
+    esac
     AC_SUBST([DPDK_vswitchd_LDFLAGS])
     AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
   fi