add support of musl
cover add support of musl
musl is an alternative LIBC to GLIBC.
It is an implementation of the userspace portion of the standard library functionality described in the ISO C and POSIX standards, plus common extensions.
Some DPDK customers fail to build DPDK with musl. But so far execinfo.h is not supported by musl. In order to build DPDK with musl, there is a need to remove references to execinfo.h.
Currently only backtrace() and backtrace_symbols( ) from execinfo.h are used in rte_dump_stack( ) in lib/librte_eal/linuxapp/eal/eal_debug.c .
This rte_dump_stack( ) is only used to get the name of fucntions in call stack for debugging.
Wei Dai (3):
examples/performance-thread: remove reference to execinfo.h
config: add support of musl
eal: remove references to execinfo.h for musl
config/common_linuxapp | 1 + examples/performance-thread/common/lthread_tls.c | 1 - lib/librte_eal/linuxapp/eal/eal_debug.c | 7 ++++++- 3 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 examples/performance-thread: remove reference to execinfo.h
There is no function to refer any part of it, so remove the reference to it. And there is no this file in musl. So need to remove it to support musl.
The musl is an alternative LIBC to GLIBC and provides the standard C/POSIX library and extensions.
The musl can be got from http://www.musl-libc.org
--- examples/performance-thread/common/lthread_tls.c | 1 - 1 file changed, 1 deletion(-)
examples/performance-thread/common/lthread_tls.c +0 -1
@@ -42,7 +42,6 @@#include <fcntl.h> #include <sys/time.h> #include <sys/mman.h> -#include <execinfo.h> #include <sched.h> #include <rte_malloc.h>
Signature · 1 line
2.7.4
PATCH 2/3 config: add support of musl
In reply to Wei DaiWhen building DPDK with musl, there is need to generate the MACRO named RTE_LIBC_MUSL in rte_config.h to remove some references to execinfo.h which is not supported by musl now.
Got more details about musl from http://www.musl-libc.org .
--- config/common_linuxapp | 1 + 1 file changed, 1 insertion(+)
config/common_linuxapp +1 -0
@@ -46,3 +46,4 @@ CONFIG_RTE_LIBRTE_PMD_TAP=y CONFIG_RTE_LIBRTE_NFP_PMD=y CONFIG_RTE_LIBRTE_POWER=y CONFIG_RTE_VIRTIO_USER=y +CONFIG_RTE_LIBC_MUSL=n
Signature · 1 line
2.7.4
PATCH 3/3 eal: remove references to execinfo.h for musl
In reply to Wei Daiexecinfo.h is not supported by musl now. need to remove references to execinfo.h to build DPDK with musl.
musl is an implementation of the userspace portion of the standard library functionality described in the ISO C and POSIX standards, plus common extensions.
Get more details about musl from
http://www.musl-libc.org
--- lib/librte_eal/linuxapp/eal/eal_debug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_debug.c +6 -1
@@ -31,7 +31,10 @@* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <execinfo.h> +#ifndef RTE_LIBC_MUSL +#include <execinfo.h> +#endif +#include <stdarg.h> #include <signal.h> #include <stdlib.h>
@@ -47,6 +50,7 @@/* dump the stack of the calling core */ void rte_dump_stack (void ) { +#ifndef RTE_LIBC_MUSL void *func[BACKTRACE_SIZE ];char **symb =NULL ;int size;
@@ -64,6 +68,7 @@ void rte_dump_stack(void) }free (symb); +#endif }/* not implemented in this environment */
Signature · 1 line
2.7.4
Re: [PATCH 3/3] eal: remove references to execinfo.h for musl
2017-03-10 19:58, Wei Dai:
Quoted 9 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0@@ -47,6 +50,7 @@/* dump the stack of the calling core */ void rte_dump_stack (void ) { +#ifndef RTE_LIBC_MUSL void *func[BACKTRACE_SIZE ];char **symb =NULL ;int size;
lib/librte_eal/linuxapp/eal/eal_debug.c void rte_dump_stack(void) · line 72
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0@@ -64,6 +68,7 @@ void rte_dump_stack(void) }free (symb); +#endif }
There are probably other libc implementations not supporting this feature. Instead of calling it "RTE_LIBC_MUSL", it should something like "ENABLE_BACKTRACE".
Then you can add a musl section in the Linux quick start guide.
Re: [PATCH 3/3] eal: remove references to execinfo.h for musl
Quoted 12 lines · Thomas Monjalon
2017-03-10 19:58, Wei Dai:
Quoted 11 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0@@ -47,6 +50,7 @@/* dump the stack of the calling core */ void rte_dump_stack (void ) { +#ifndef RTE_LIBC_MUSL void *func[BACKTRACE_SIZE ];char **symb =NULL ;int size;@@ -64,6 +68,7 @@ void rte_dump_stack(void) }
Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal_debug.c void rte_dump_stack(void) · line 72
Quoted 3 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0free (symb); +#endif }There are probably other libc implementations not supporting this feature. Instead of calling it "
RTE_LIBC_MUSL", it should something like "ENABLE_BACKTRACE".
Then you can add a musl section in the Linux quick start guide.
Also I would improve the code readability by removing the preprocessor junk from it by moving the rte_dump_stack() function into eal_backtrace.c and make that conditionally compile based on CONFIG_ENABLE_BACKTRACE.
Re: [PATCH 3/3] eal: remove references to execinfo.h for musl
Quoted 31 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Blunck
Sent: Friday, March 10, 2017 10:50 PM
To: Thomas Monjalon <[email protected]>
Cc: Dai, Wei <[email protected]>; dev <[email protected]>; Mcnamara, John <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 3/3] eal: remove references toexecinfo.hfor muslQuoted 11 lines · Thomas Monjalon
2017-03-10 19:58, Wei Dai:
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0@@ -47,6 +50,7 @@/* dump the stack of the calling core */ void rte_dump_stack (void ) { +#ifndef RTE_LIBC_MUSL void *func[BACKTRACE_SIZE ];char **symb =NULL ;int size;@@ -64,6 +68,7 @@ void rte_dump_stack(void) }Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal_debug.c void rte_dump_stack(void) · line 72
Quoted 3 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +1
-0free (symb); +#endif }There are probably other libc implementations not supporting this feature. Instead of calling it "
RTE_LIBC_MUSL", it should something like "ENABLE_BACKTRACE".
Then you can add a musl section in the Linux quick start guide.
Quoted 3 lines
Also I would improve the code readability by removing the preprocessor junk from it by moving the
rte_dump_stack()function intoeal_backtrace.cand make that conditionally compile based onCONFIG_ENABLE_BACKTRACE.
I'd like to change CONFIG_RTE_LIBC_MUSL to CONFIG_RTE_EAL_ENABLE_BACKTRACE and Will send a v2 patch soon.
Anyway, you also still can move rte_dump_stack() to another file when my change is accepted.
Re: [PATCH 3/3] eal: remove references to execinfo.h for musl
Quoted 31 lines · Wei
Quoted 31 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Blunck
Sent: Friday, March 10, 2017 10:50 PM
To: Thomas Monjalon <[email protected]>
Cc: Dai, Wei <[email protected]>; dev <[email protected]>; Mcnamara, John <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 3/3] eal: remove references toexecinfo.hfor muslQuoted 19 lines · Thomas Monjalon
2017-03-10 19:58, Wei Dai:
lib/librte_eal/linuxapp/eal/eal_debug.c void rte_dump_stack(void) · line 72
Quoted 13 lines
lib/librte_eal/linuxapp/eal/eal_debug.c +2
-0@@ -47,6 +50,7 @@/* dump the stack of the calling core */ void rte_dump_stack (void ) { +#ifndef RTE_LIBC_MUSL void *func[BACKTRACE_SIZE ];char **symb =NULL ;int size;@@ -64,6 +68,7 @@ void rte_dump_stack(void) }free (symb); +#endif }There are probably other libc implementations not supporting this feature. Instead of calling it "
RTE_LIBC_MUSL", it should something like "ENABLE_BACKTRACE".
Then you can add a musl section in the Linux quick start guide.
Quoted 8 lines
Quoted 3 lines
Also I would improve the code readability by removing the preprocessor junk from it by moving the
rte_dump_stack()function intoeal_backtrace.cand make that conditionally compile based onCONFIG_ENABLE_BACKTRACE.I'd like to change
CONFIG_RTE_LIBC_MUSLtoCONFIG_RTE_EAL_ENABLE_BACKTRACEand Will send a v2 patch soon.
Anyway, you also still can moverte_dump_stack()to another file when my change is accepted.
Thanks for working on it! Please also merge the introduction of the configuration and its usage into one patch.