[PATCH 21.11] build: detect backtrace availability

Kevin Traynor ktraynor at redhat.com
Tue Apr 18 11:03:23 CEST 2023


From: Thomas Monjalon <thomas at monjalon.net>

[ upstream commit bc1db4f45af35c87e7d97db7a24d479674aa8a43 ]

Backtrace dump is available:
	- always on Windows
	- on Linux/BSD if execinfo.h is available (not anymore on Alpine)

The flag RTE_BACKTRACE was set unconditionally in rte_config.h.
It is now set only if the feature is available.

Note: Alpine Linux has decided to remove libexecinfo support,
so this change will allow to compile DPDK on recent Alpine Linux.

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
This is need to fix Alpine Linux compile failure in 21.11 UNH CI [0]
Tested on 21.11-staging branch [1]

Thomas, any objection to backporting this patch?

[0] https://dpdkdashboard.iol.unh.edu/results/dashboard/tarballs/24280/#env-45

Project version: 21.11.4-rc1
C compiler for the host machine: ccache cc
(gcc 12.2.1 "cc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924")
...
[2604/2949] Compiling C object 'lib/76b5a35@@rte_eal at sta/eal_linux_eal_debug.c.o'.
../lib/eal/linux/eal_debug.c:6:10: fatal error: execinfo.h: No such file or directory
    6 | #include <execinfo.h>
      |          ^~~~~~~~~~~~
compilation terminated.

[1] https://dpdkdashboard.iol.unh.edu/results/dashboard/tarballs/24284/#env-45
---
 config/meson.build                | 3 ++-
 config/rte_config.h               | 1 -
 doc/guides/linux_gsg/sys_reqs.rst | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index cf3b68a5ce..a79a3ed39c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -199,8 +199,9 @@ endif
 
 libexecinfo = cc.find_library('execinfo', required: false)
-if libexecinfo.found() and cc.has_header('execinfo.h')
+if libexecinfo.found()
     add_project_link_arguments('-lexecinfo', language: 'c')
     dpdk_extra_ldflags += '-lexecinfo'
 endif
+dpdk_conf.set('RTE_BACKTRACE', cc.has_header('execinfo.h') or is_windows)
 
 libarchive = dependency('libarchive', required: false, method: 'pkg-config')
diff --git a/config/rte_config.h b/config/rte_config.h
index cab4390a97..2f1a3ffb21 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -38,5 +38,4 @@
 #define RTE_MAX_TAILQ 32
 #define RTE_LOG_DP_LEVEL RTE_LOG_INFO
-#define RTE_BACKTRACE 1
 #define RTE_MAX_VFIO_CONTAINERS 64
 
diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_reqs.rst
index cfaa2db301..63990cee86 100644
--- a/doc/guides/linux_gsg/sys_reqs.rst
+++ b/doc/guides/linux_gsg/sys_reqs.rst
@@ -44,5 +44,5 @@ Compilation of the DPDK
     * For RHEL/Fedora systems these can be installed using ``dnf groupinstall "Development Tools"``
     * For Ubuntu/Debian systems these can be installed using ``apt install build-essential``
-    * For Alpine Linux, ``apk add gcc libc-dev bsd-compat-headers libexecinfo-dev``
+    * For Alpine Linux, ``apk add gcc libc-dev bsd-compat-headers``
 
 *   Python 3.5 or later.
-- 
2.39.2



More information about the stable mailing list