[ovs-dev] [PATCH v1] acinclude: Provide error info when linking fails with DPDK.

Sunil Pai G sunil.pai.g at intel.com
Wed Nov 10 10:07:44 UTC 2021


Currently the configure script provides no infomation but to update
the pkg-config path on failure to link with DPDK.
Fix this to provide more information to the user on failure.

Before:
checking whether linking with dpdk works... no
configure: error: Could not find DPDK library in default search path,
update PKG_CONFIG_PATH for pkg-config to find the .pc file in
non-standard location

After:
checking whether linking with dpdk works... no
configure: error: configure:27158: gcc -o conftest -include rte_config.h ...
-Wl,--whole-archive -l:librte_bus_pci.a -l:my_lib.a ... -lunwind >&5
/usr/bin/ld: cannot find -l:my_lib.a

Signed-off-by: Sunil Pai G <sunil.pai.g at intel.com>
---
 acinclude.m4 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index dba365ea1..1af277447 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -475,7 +475,8 @@ AC_DEFUN([OVS_CHECK_DPDK], [
     # DPDK uses dlopen to load plugins.
     OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl])
 
-    AC_MSG_CHECKING([whether linking with dpdk works])
+    DPDK_STRING="whether linking with dpdk works"
+    AC_MSG_CHECKING([$DPDK_STRING])
     LIBS="$DPDK_LIB $LIBS"
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([#include <rte_config.h>
@@ -485,10 +486,10 @@ AC_DEFUN([OVS_CHECK_DPDK], [
       [AC_MSG_RESULT([yes])
        DPDKLIB_FOUND=true],
       [AC_MSG_RESULT([no])
+       # Fetch the cause of failure from config.log
+       DPDK_LINK_ERROR=$(grep "$DPDK_STRING" -A2 config.log | tail -n2)
        AC_MSG_ERROR(m4_normalize([
-          Could not find DPDK library in default search path, update
-          PKG_CONFIG_PATH for pkg-config to find the .pc file in
-          non-standard location]))
+          $DPDK_LINK_ERROR]))
       ])
 
     CFLAGS="$ovs_save_CFLAGS"
-- 
2.25.1



More information about the dev mailing list