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

Michael Santana msantana at redhat.com
Fri Nov 12 16:43:57 UTC 2021



On 11/10/21 5:07 AM, Sunil Pai G wrote:
> 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
Let's add more details.

checking whether linking with dpdk works... no
+Printing the error that caused the linking failure:
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
+End of log. In the case that this script could not find DPDK in the 
+default search path, update PKG_CONFIG_PATH for pkg-config to find the 
+.pc file in non-standard location. Otherwise check the error logs for 
+more details in the log file config.log

What do you think?
> 
> 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"
> 



More information about the dev mailing list