Fix meson build on FreeBSD
cover Fix meson build on FreeBSD
There are a few issues with building DPDK for FreeBSD using the meson build system, specifically:
* the kernel modules aren't compiling due to an incorrect VPATH
* a number of unit tests depend on libraries not supported on BSD
* applications and examples need to be linked with execinfo library.
Bruce Richardson (6):
eal/bsdapp: fix building kernel modules
build: add dependency on execinfo for BSD meson builds test/test: mark tests as skipped when required lib not available test/test: fix dependency on power lib for BSD meson build test/test: fix dependency on KNI lib for BSD meson build
examples: fix meson build on FreeBSD
app/test-eventdev/meson.build | 1 + app/test-pmd/meson.build | 1 + examples/meson.build | 3 ++- lib/librte_eal/bsdapp/BSDmakefile.meson | 1 + lib/librte_eal/meson.build | 1 - test/test/meson.build | 8 +++++++- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 10 files changed, 59 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/6 eal/bsdapp: fix building kernel modules
The kernel module source file directory passed via VPATH was wrong, which caused the source files to be not found via make. Rather than explicitly passing VPATH, make use of the fact that the full path to the source files is passed by meson, so split that into directory part - to be used as VPATH - and file part - to be used as the source filename.
--- lib/librte_eal/bsdapp/BSDmakefile.meson | 1 + lib/librte_eal/meson.build | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/bsdapp/BSDmakefile.meson +1 -0
@@ -36,6 +36,7 @@ # source file is passed via KMOD_SRC as full path, we only use final # component of it, as VPATH is used to find actual file, so as to # have the .o files placed in the build, not source directory +VPATH = ${KMOD_SRC:H} SRCS = ${KMOD_SRC:T} device_if.h bus_if.h pci_if.h CFLAGS += $(KMOD_CFLAGS)
lib/librte_eal/meson.build +0 -1
@@ -36,7 +36,6 @@ elif host_machine.system() == 'freebsd' command: ['make', '-f', '@INPUT0@', 'KMOD_SRC=@INPUT1@', 'KMOD=' + k, - 'VPATH=' + join_paths(meson.current_source_dir(), k), 'KMOD_CFLAGS=' + ' '.join(kmod_cflags)], build_by_default: get_option('enable_kmods')) endforeach
Signature · 1 line
2.14.1
PATCH 2/6 build: add dependency on execinfo for BSD meson builds
In reply to Bruce RichardsonThe binaries and apps in DPDK all need to be linked against the execinfo library on FreeBSD so add this as a dependency in cases where it is found. It's available by default on BSD, but not at all on Linux
--- app/test-eventdev/meson.build | 1 + app/test-pmd/meson.build | 1 + test/test/meson.build | 1 + 3 files changed, 3 insertions(+)
app/test-eventdev/meson.build +1 -0
@@ -13,6 +13,7 @@ sources = files('evt_main.c', 'test_perf_queue.c') dep_objs = [get_variable(get_option('default_library') + '_rte_eventdev')] +dep_objs += cc.find_library('execinfo', required: false) # BSD only link_libs = [] if get_option('default_library') == 'static'
app/test-pmd/meson.build +1 -0
@@ -37,6 +37,7 @@ dep_objs = [] foreach d:deps dep_objs += get_variable(get_option('default_library') + '_rte_' + d) endforeach +dep_objs += cc.find_library('execinfo', required: false) # for BSD only link_libs = [] if get_option('default_library') == 'static'
test/test/meson.build +1 -0
@@ -234,6 +234,7 @@ foreach d:test_deps def_lib = get_option('default_library') test_dep_objs += get_variable(def_lib + '_rte_' + d) endforeach +test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] if get_option('default_library') == 'static'
Signature · 1 line
2.14.1
PATCH 3/6 test/test: mark tests as skipped when required lib not available
In reply to Bruce RichardsonThe power management and KNI libraries are not compiled on a FreeBSD platform, which means that the tests can't run. Add in stub code for these cases, allowing the tests to still be compiled, but to report as skipped in those cases.
--- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 4 files changed, 47 insertions(+)
test/test/test_kni.c +13 -0
@@ -10,6 +10,17 @@#include "test.h" +#ifndef RTE_LIBRTE_KNI + +static int +test_kni (void ) +{ +printf ("KNI not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else +#include <rte_string_fns.h> #include <rte_mempool.h> #include <rte_ethdev.h>
@@ -605,4 +616,6 @@ test_kni(void) return ret; } +#endif +REGISTER_TEST_COMMAND (kni_autotest, test_kni);
test/test/test_power.c +12 -0
@@ -10,6 +10,17 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else +#include <rte_power.h> static int
@@ -74,5 +85,6 @@ test_power(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_autotest, test_power);
test/test/test_power_acpi_cpufreq.c +11 -0
@@ -10,6 +10,16 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_acpi_cpufreq (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else #include <rte_power.h> #define TEST_POWER_LCORE_ID 2U
@@ -507,5 +517,6 @@ test_power_acpi_cpufreq(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_acpi_cpufreq_autotest, test_power_acpi_cpufreq);
test/test/test_power_kvm_vm.c +11 -0
@@ -10,6 +10,16 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_kvm_vm (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else #include <rte_power.h> #define TEST_POWER_VM_LCORE_ID 0U
@@ -270,5 +280,6 @@ test_power_kvm_vm(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_kvm_vm_autotest, test_power_kvm_vm);
Signature · 1 line
2.14.1
Re: [PATCH 3/6] test/test: mark tests as skipped when required lib not available
Hi Bruce,
Quoted 8 lines · Bruce Richardson
The power management and KNI libraries are not compiled on a FreeBSD platform, which means that the tests can't run. Add in stub code for these cases, allowing the tests to still be compiled, but to report as skipped in those cases.
Signed-off-by Bruce Richardson <[email protected]>CC Ferruh Yigit <[email protected]>CC David Hunt <[email protected]>
Quoted 6 lines
--- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 4 files changed, 47 insertions(+)
--snip--
Acked-by David Hunt <[email protected]>
PATCH 4/6 test/test: fix dependency on power lib for BSD meson build
In reply to Bruce RichardsonThe power library is not built on FreeBSD, so it needs to be an optional rather than a mandatory dependency for building the autotest binary.
--- test/test/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
test/test/meson.build +3 -1
@@ -111,7 +111,6 @@ test_deps = ['acl', 'member', 'pipeline', 'port', - 'power', 'reorder', 'ring', 'timer'
@@ -228,6 +227,9 @@ endif if dpdk_conf.has('RTE_LIBRTE_RING_PMD') test_deps += 'pmd_ring' endif +if dpdk_conf.has('RTE_LIBRTE_POWER') + test_deps += 'power' +endif test_dep_objs = [] foreach d:test_deps
Signature · 1 line
2.14.1
PATCH 5/6 test/test: fix dependency on KNI lib for BSD meson build
In reply to Bruce RichardsonThe KNI library is not built on FreeBSD, so it needs to be an optional rather than a mandatory dependency for building the autotest binary.
--- test/test/meson.build | 3 +++ 1 file changed, 3 insertions(+)
test/test/meson.build +3 -0
@@ -230,6 +230,9 @@ endif if dpdk_conf.has('RTE_LIBRTE_POWER') test_deps += 'power' endif +if dpdk_conf.has('RTE_LIBRTE_KNI') + test_deps += 'kni' +endif test_dep_objs = [] foreach d:test_deps
Signature · 1 line
2.14.1
PATCH 6/6 examples: fix meson build on FreeBSD
In reply to Bruce Richardson--- examples/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
examples/meson.build +2 -1
@@ -6,12 +6,13 @@ if get_option('default_library') == 'static' driver_libs = dpdk_drivers endif +execinfo = cc.find_library('execinfo', required: false) foreach example: get_option('examples').split(',') name = example sources = [] allow_experimental_apis = false cflags = machine_args - ext_deps = [] + ext_deps = [execinfo] includes = [include_directories(example)] deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] subdir(example)
Signature · 1 line
2.14.1
v2 cover Fix meson build on FreeBSD
In reply to Bruce RichardsonThere are a few issues with building DPDK for FreeBSD using the meson build system, specifically:
* the kernel modules aren't compiling due to an incorrect VPATH
* a number of unit tests depend on libraries not supported on BSD
* applications and examples need to be linked with execinfo library.
----
V2: merged patch 6 in with patch 2, since it's the same fix for main apps
and for the examples.
Bruce Richardson (5):
eal/bsdapp: fix building kernel modules
build: fix dependency on execinfo for BSD meson builds test/test: mark tests as skipped when required lib not available test/test: fix dependency on power lib for BSD meson build test/test: fix dependency on KNI lib for BSD meson build
app/test-eventdev/meson.build | 1 + app/test-pmd/meson.build | 1 + examples/meson.build | 3 ++- lib/librte_eal/bsdapp/BSDmakefile.meson | 1 + lib/librte_eal/meson.build | 1 - test/test/meson.build | 8 +++++++- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 10 files changed, 59 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.1
PATCH v2 1/5 eal/bsdapp: fix building kernel modules
The kernel module source file directory passed via VPATH was wrong, which caused the source files to be not found via make. Rather than explicitly passing VPATH, make use of the fact that the full path to the source files is passed by meson, so split that into directory part - to be used as VPATH - and file part - to be used as the source filename.
--- lib/librte_eal/bsdapp/BSDmakefile.meson | 1 + lib/librte_eal/meson.build | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/bsdapp/BSDmakefile.meson +1 -0
@@ -36,6 +36,7 @@ # source file is passed via KMOD_SRC as full path, we only use final # component of it, as VPATH is used to find actual file, so as to # have the .o files placed in the build, not source directory +VPATH = ${KMOD_SRC:H} SRCS = ${KMOD_SRC:T} device_if.h bus_if.h pci_if.h CFLAGS += $(KMOD_CFLAGS)
lib/librte_eal/meson.build +0 -1
@@ -36,7 +36,6 @@ elif host_machine.system() == 'freebsd' command: ['make', '-f', '@INPUT0@', 'KMOD_SRC=@INPUT1@', 'KMOD=' + k, - 'VPATH=' + join_paths(meson.current_source_dir(), k), 'KMOD_CFLAGS=' + ' '.join(kmod_cflags)], build_by_default: get_option('enable_kmods')) endforeach
Signature · 1 line
2.14.1
PATCH v2 2/5 build: fix dependency on execinfo for BSD meson builds
In reply to Bruce RichardsonThe binaries and apps in DPDK all need to be linked against the execinfo library on FreeBSD so add this as a dependency in cases where it is found. It's available by default on BSD, but not at all on Linux
--- app/test-eventdev/meson.build | 1 + app/test-pmd/meson.build | 1 + examples/meson.build | 3 ++- test/test/meson.build | 1 + 4 files changed, 5 insertions(+), 1 deletion(-)
app/test-eventdev/meson.build +1 -0
@@ -13,6 +13,7 @@ sources = files('evt_main.c', 'test_perf_queue.c') dep_objs = [get_variable(get_option('default_library') + '_rte_eventdev')] +dep_objs += cc.find_library('execinfo', required: false) # BSD only link_libs = [] if get_option('default_library') == 'static'
app/test-pmd/meson.build +1 -0
@@ -37,6 +37,7 @@ dep_objs = [] foreach d:deps dep_objs += get_variable(get_option('default_library') + '_rte_' + d) endforeach +dep_objs += cc.find_library('execinfo', required: false) # for BSD only link_libs = [] if get_option('default_library') == 'static'
examples/meson.build +2 -1
@@ -6,12 +6,13 @@ if get_option('default_library') == 'static' driver_libs = dpdk_drivers endif +execinfo = cc.find_library('execinfo', required: false) foreach example: get_option('examples').split(',') name = example sources = [] allow_experimental_apis = false cflags = machine_args - ext_deps = [] + ext_deps = [execinfo] includes = [include_directories(example)] deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] subdir(example)
test/test/meson.build +1 -0
@@ -234,6 +234,7 @@ foreach d:test_deps def_lib = get_option('default_library') test_dep_objs += get_variable(def_lib + '_rte_' + d) endforeach +test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] if get_option('default_library') == 'static'
Signature · 1 line
2.14.1
PATCH v2 3/5 test/test: mark tests as skipped when required lib not available
In reply to Bruce RichardsonThe power management and KNI libraries are not compiled on a FreeBSD platform, which means that the tests can't run. Add in stub code for these cases, allowing the tests to still be compiled, but to report as skipped in those cases.
--- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 4 files changed, 47 insertions(+)
test/test/test_kni.c +13 -0
@@ -10,6 +10,17 @@#include "test.h" +#ifndef RTE_LIBRTE_KNI + +static int +test_kni (void ) +{ +printf ("KNI not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else +#include <rte_string_fns.h> #include <rte_mempool.h> #include <rte_ethdev.h>
@@ -609,4 +620,6 @@ test_kni(void) return ret; } +#endif +REGISTER_TEST_COMMAND (kni_autotest, test_kni);
test/test/test_power.c +12 -0
@@ -10,6 +10,17 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else +#include <rte_power.h> static int
@@ -74,5 +85,6 @@ test_power(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_autotest, test_power);
test/test/test_power_acpi_cpufreq.c +11 -0
@@ -10,6 +10,16 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_acpi_cpufreq (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else #include <rte_power.h> #define TEST_POWER_LCORE_ID 2U
@@ -507,5 +517,6 @@ test_power_acpi_cpufreq(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_acpi_cpufreq_autotest, test_power_acpi_cpufreq);
test/test/test_power_kvm_vm.c +11 -0
@@ -10,6 +10,16 @@#include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_kvm_vm (void ) +{ +printf ("Power management library not supported, skipping test\n" ); +return TEST_SKIPPED ; +} + +#else #include <rte_power.h> #define TEST_POWER_VM_LCORE_ID 0U
@@ -270,5 +280,6 @@ test_power_kvm_vm(void)rte_power_unset_env (); return -1; } +#endif REGISTER_TEST_COMMAND (power_kvm_vm_autotest, test_power_kvm_vm);
Signature · 1 line
2.14.1
PATCH v2 4/5 test/test: fix dependency on power lib for BSD meson build
In reply to Bruce RichardsonThe power library is not built on FreeBSD, so it needs to be an optional rather than a mandatory dependency for building the autotest binary.
--- test/test/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
test/test/meson.build +3 -1
@@ -111,7 +111,6 @@ test_deps = ['acl', 'member', 'pipeline', 'port', - 'power', 'reorder', 'ring', 'timer'
@@ -228,6 +227,9 @@ endif if dpdk_conf.has('RTE_LIBRTE_RING_PMD') test_deps += 'pmd_ring' endif +if dpdk_conf.has('RTE_LIBRTE_POWER') + test_deps += 'power' +endif test_dep_objs = [] foreach d:test_deps
Signature · 1 line
2.14.1
PATCH v2 5/5 test/test: fix dependency on KNI lib for BSD meson build
In reply to Bruce RichardsonThe KNI library is not built on FreeBSD, so it needs to be an optional rather than a mandatory dependency for building the autotest binary.
--- test/test/meson.build | 3 +++ 1 file changed, 3 insertions(+)
test/test/meson.build +3 -0
@@ -230,6 +230,9 @@ endif if dpdk_conf.has('RTE_LIBRTE_POWER') test_deps += 'power' endif +if dpdk_conf.has('RTE_LIBRTE_KNI') + test_deps += 'kni' +endif test_dep_objs = [] foreach d:test_deps
Signature · 1 line
2.14.1
Quoted 17 lines · Bruce Richardson
There are a few issues with building DPDK for FreeBSD using the meson build system, specifically:
* the kernel modules aren't compiling due to an incorrect VPATH
* a number of unit tests depend on libraries not supported on BSD
* applications and examples need to be linked with execinfo library.----
V2: merged patch 6 in with patch 2, since it's the same fix for main apps
and for the examples.Bruce Richardson (5):
eal/bsdapp: fix building kernel modules
build: fix dependency on execinfo for BSD meson builds test/test: mark tests as skipped when required lib not available test/test: fix dependency on power lib for BSD meson build test/test: fix dependency on KNI lib for BSD meson build
Quoted 13 lines
app/test-eventdev/meson.build | 1 + app/test-pmd/meson.build | 1 + examples/meson.build | 3 ++- lib/librte_eal/bsdapp/BSDmakefile.meson | 1 + lib/librte_eal/meson.build | 1 - test/test/meson.build | 8 +++++++- test/test/test_kni.c | 13 +++++++++++++ test/test/test_power.c | 12 ++++++++++++ test/test/test_power_acpi_cpufreq.c | 11 +++++++++++ test/test/test_power_kvm_vm.c | 11 +++++++++++ 10 files changed, 59 insertions(+), 3 deletions(-)
Applied to dpdk-next-build
/Bruce