Skip to contentSkip to conversation

build: add combined libs

PATCH In review Ruslan Babayev 2 participants 4 messages Feb 19, 2020 – Feb 20, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: add combined libs

Add combined libdpdk.a and libdpdk.so libs for Meson similar to how it's done for Make builds

---
 buildtools/group-libs.sh |  2 ++
 buildtools/meson.build   |  1 +
 meson.build              | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100755 buildtools/group-libs.sh
buildtools/group-libs.sh new file +2 -0
new file mode 100755
index 000000000..b6e4c1c35
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'GROUP (' $(echo $* | xargs -n1 basename | sort | xargs) ')'
buildtools/meson.build +1 -0
index 9812917e5..eac8bc4ff 100644
@@ -6,6 +6,7 @@ subdir('pmdinfogen')
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
+group_libs = find_program('group-libs.sh')
 check_experimental_syms = find_program('check-experimental-syms.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
 
meson.build +17 -0
index b7ae9c8d9..eb6974d35 100644
@@ -61,6 +61,23 @@ configure_file(output: build_cfg,
 		install_dir: join_paths(get_option('includedir'),
 				get_option('include_subdir_arch')))
 
+
+custom_target('group_shared_libs',
+		input: dpdk_libraries,
+		output: 'libdpdk.so',
+		capture: true,
+		install: true,
+		install_dir: get_option('libdir'),
+		command: [group_libs, '@INPUT@'])
+
+custom_target('group_static_libs',
+		input: dpdk_static_libraries + dpdk_drivers,
+		output: 'libdpdk.a',
+		capture: true,
+		install: true,
+		install_dir: get_option('libdir'),
+		command: [group_libs, '@INPUT@'])
+
 # for static builds, include the drivers as libs and we need to "whole-archive"
 # them.
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
Signature · 1 line
2.17.1
#1 lore raw
Quoted 60 lines · Ruslan Babayev

Add combined libdpdk.a and libdpdk.so libs for Meson similar to how it's done for Make builds

Signed-off-by: Ruslan Babayev <
[email protected]

Quoted 1 line
---
 buildtools/group-libs.sh |  2 ++
 buildtools/meson.build   |  1 +
 meson.build              | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100755 buildtools/group-libs.sh
buildtools/group-libs.sh new file +2 -0
new file mode 100755
index 000000000..b6e4c1c35
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'GROUP (' $(echo $* | xargs -n1 basename | sort | xargs) ')'
buildtools/meson.build +1 -0
index 9812917e5..eac8bc4ff 100644
@@ -6,6 +6,7 @@ subdir('pmdinfogen')
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
+group_libs = find_program('group-libs.sh')
 check_experimental_syms = find_program('check-experimental-syms.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
 
meson.build +17 -0
index b7ae9c8d9..eb6974d35 100644
@@ -61,6 +61,23 @@ configure_file(output: build_cfg,
 		install_dir: join_paths(get_option('includedir'),
 				get_option('include_subdir_arch')))
 
+
+custom_target('group_shared_libs',
+		input: dpdk_libraries,
+		output: 'libdpdk.so',
+		capture: true,
+		install: true,
+		install_dir: get_option('libdir'),
+		command: [group_libs, '@INPUT@'])
+
+custom_target('group_static_libs',
+		input: dpdk_static_libraries + dpdk_drivers,
+		output: 'libdpdk.a',
+		capture: true,
+		install: true,
+		install_dir: get_option('libdir'),
+		command: [group_libs, '@INPUT@'])
+
 # for static builds, include the drivers as libs and we need to

"whole-archive"

Quoted 3 lines
 # them.
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-
whole-archive']

Hi,

As far as I'm aware all usage of the old hacky linker script can be replaced with pkg-config, and that's why it was left behind. Same for the static archive.

Is there any use case that pkg-config doesn't cover?

Signature · 2 lines
Kind regards,
Luca Boccassi
#2 lore raw

Hi Luca,

PkgConfig doesn't cover the case of static linking. See below:

$ pkg-config --libs libdpdk
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_fib -lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rib -lrte_rcu -lrte_rawdev -lrte_pdump -lrte_power
-lrte_member -lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats
-lrte_ip_frag -lrte_gso -lrte_gro -lrte_eventdev -lrte_efd
-lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile
-lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash
-lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter -lrte_net
-lrte_mbuf -lrte_mempool -lrte_ring -lrte_eal -lrte_kvargs

And here's the combined libdpdk.a

GROUP ( librte_acl.a librte_bbdev.a librte_bitratestats.a librte_bpf.a librte_bus_dpaa.a librte_bus_fslmc.a librte_bus_ifpga.a librte_bus_pci.a librte_bus_vdev.a librte_bus_vmbus.a librte_cfgfile.a librte_cmdline.a librte_common_cpt.a librte_common_dpaax.a librte_common_iavf.a librte_common_octeontx2.a librte_common_octeontx.a librte_compressdev.a librte_cryptodev.a librte_distributor.a librte_eal.a librte_efd.a librte_ethdev.a librte_eventdev.a librte_fib.a librte_flow_classify.a librte_gro.a librte_gso.a librte_hash.a librte_ip_frag.a librte_ipsec.a librte_jobstats.a librte_kni.a librte_kvargs.a librte_latencystats.a librte_lpm.a librte_mbuf.a librte_member.a librte_mempool.a librte_mempool_bucket.a librte_mempool_dpaa2.a librte_mempool_dpaa.a librte_mempool_octeontx2.a librte_mempool_octeontx.a librte_mempool_ring.a librte_mempool_stack.a librte_meter.a librte_metrics.a librte_net.a librte_pci.a librte_pdump.a librte_pipeline.a librte_pmd_aesni_gcm.a librte_pmd_aesni_mb.a librte_pmd_af_packet.a librte_pmd_ark.a librte_pmd_atlantic.a librte_pmd_avp.a librte_pmd_axgbe.a librte_pmd_bbdev_fpga_lte_fec.a librte_pmd_bbdev_null.a librte_pmd_bbdev_turbo_sw.a librte_pmd_bnxt.a librte_pmd_bond.a librte_pmd_caam_jr.a librte_pmd_ccp.a librte_pmd_crypto_scheduler.a librte_pmd_cxgbe.a librte_pmd_dpaa2.a librte_pmd_dpaa2_event.a librte_pmd_dpaa2_sec.a librte_pmd_dpaa.a librte_pmd_dpaa_event.a librte_pmd_dpaa_sec.a librte_pmd_dsw_event.a librte_pmd_e1000.a librte_pmd_ena.a librte_pmd_enetc.a librte_pmd_enic.a librte_pmd_failsafe.a librte_pmd_fm10k.a librte_pmd_hinic.a librte_pmd_hns3.a librte_pmd_i40e.a librte_pmd_iavf.a librte_pmd_ice.a librte_pmd_ifc.a librte_pmd_ixgbe.a librte_pmd_kasumi.a librte_pmd_kni.a librte_pmd_liquidio.a librte_pmd_memif.a librte_pmd_netvsc.a librte_pmd_nfp.a librte_pmd_nitrox.a librte_pmd_null.a librte_pmd_null_crypto.a librte_pmd_octeontx2.a librte_pmd_octeontx2_crypto.a librte_pmd_octeontx2_event.a librte_pmd_octeontx.a librte_pmd_octeontx_compress.a librte_pmd_octeontx_crypto.a librte_pmd_octeontx_event.a librte_pmd_opdl_event.a librte_pmd_openssl.a librte_pmd_pfe.a librte_pmd_qat.a librte_pmd_qede.a librte_pmd_ring.a librte_pmd_sfc.a librte_pmd_skeleton_event.a librte_pmd_snow3g.a librte_pmd_softnic.a librte_pmd_sw_event.a librte_pmd_tap.a librte_pmd_thunderx.a librte_pmd_vdev_netvsc.a librte_pmd_vhost.a librte_pmd_virtio.a librte_pmd_virtio_crypto.a librte_pmd_vmxnet3.a librte_pmd_zuc.a librte_port.a librte_power.a librte_rawdev.a librte_rawdev_dpaa2_cmdif.a librte_rawdev_dpaa2_qdma.a librte_rawdev_ioat.a librte_rawdev_ntb.a librte_rawdev_octeontx2_dma.a librte_rawdev_octeontx2_ep.a librte_rawdev_skeleton.a librte_rcu.a librte_reorder.a librte_rib.a librte_ring.a librte_sched.a librte_security.a librte_stack.a librte_table.a librte_timer.a librte_vhost.a )

Combining the libs into a single libdpdk.a (including the PMDs) makes it much simpler to statically link against.
How does pkg-config solve this?

Regards,
Ruslan

Quoted 77 lines · Luca Boccassi
Quoted 60 lines · Ruslan Babayev

Add combined libdpdk.a and libdpdk.so libs for Meson similar to how it's done for Make builds

Signed-off-by: Ruslan Babayev <
[email protected]

Quoted 1 line
---
 buildtools/group-libs.sh |  2 ++
 buildtools/meson.build   |  1 +
 meson.build              | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100755 buildtools/group-libs.sh
buildtools/group-libs.sh new file +2 -0
new file mode 100755
index 000000000..b6e4c1c35
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'GROUP (' $(echo $* | xargs -n1 basename | sort | xargs) ')'
buildtools/meson.build +1 -0
index 9812917e5..eac8bc4ff 100644
@@ -6,6 +6,7 @@ subdir('pmdinfogen')
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
+group_libs = find_program('group-libs.sh')
 check_experimental_syms = find_program('check-experimental-syms.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
 
meson.build +17 -0
index b7ae9c8d9..eb6974d35 100644
@@ -61,6 +61,23 @@ configure_file(output: build_cfg,
              install_dir: join_paths(get_option('includedir'),
                              get_option('include_subdir_arch')))
 
+
+custom_target('group_shared_libs',
+             input: dpdk_libraries,
+             output: 'libdpdk.so',
+             capture: true,
+             install: true,
+             install_dir: get_option('libdir'),
+             command: [group_libs, '@INPUT@'])
+
+custom_target('group_static_libs',
+             input: dpdk_static_libraries + dpdk_drivers,
+             output: 'libdpdk.a',
+             capture: true,
+             install: true,
+             install_dir: get_option('libdir'),
+             command: [group_libs, '@INPUT@'])
+
 # for static builds, include the drivers as libs and we need to

"whole-archive"

Quoted 3 lines
 # them.
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-
whole-archive']

Hi,

As far as I'm aware all usage of the old hacky linker script can be replaced with pkg-config, and that's why it was left behind. Same for the static archive.

Is there any use case that pkg-config doesn't cover?

--
Kind regards,
Luca Boccassi

#3 lore raw
Quoted 66 lines · Ruslan Babayev

Hi Luca,

PkgConfig doesn't cover the case of static linking. See below:

$ pkg-config --libs libdpdk
(quoted diff) +0 -10
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_fib -lrte_ipsec -lrte_vhost -lrte_stack -lrte_security
-lrte_sched -lrte_reorder -lrte_rib -lrte_rcu -lrte_rawdev
-lrte_pdump -lrte_power -lrte_member -lrte_lpm -lrte_latencystats
-lrte_kni -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro
-lrte_eventdev -lrte_efd -lrte_distributor -lrte_cryptodev
-lrte_compressdev -lrte_cfgfile -lrte_bitratestats -lrte_bbdev
-lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_cmdline
-lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool
-lrte_ring -lrte_eal -lrte_kvargs

And here's the combined libdpdk.a

GROUP ( librte_acl.a librte_bbdev.a librte_bitratestats.a librte_bpf.a librte_bus_dpaa.a librte_bus_fslmc.a librte_bus_ifpga.a librte_bus_pci.a librte_bus_vdev.a librte_bus_vmbus.a librte_cfgfile.a librte_cmdline.a librte_common_cpt.a librte_common_dpaax.a librte_common_iavf.a librte_common_octeontx2.a librte_common_octeontx.a librte_compressdev.a librte_cryptodev.a librte_distributor.a librte_eal.a librte_efd.a librte_ethdev.a librte_eventdev.a librte_fib.a librte_flow_classify.a librte_gro.a librte_gso.a librte_hash.a librte_ip_frag.a librte_ipsec.a librte_jobstats.a librte_kni.a librte_kvargs.a librte_latencystats.a librte_lpm.a librte_mbuf.a librte_member.a librte_mempool.a librte_mempool_bucket.a librte_mempool_dpaa2.a librte_mempool_dpaa.a librte_mempool_octeontx2.a librte_mempool_octeontx.a librte_mempool_ring.a librte_mempool_stack.a librte_meter.a librte_metrics.a librte_net.a librte_pci.a librte_pdump.a librte_pipeline.a librte_pmd_aesni_gcm.a librte_pmd_aesni_mb.a librte_pmd_af_packet.a librte_pmd_ark.a librte_pmd_atlantic.a librte_pmd_avp.a librte_pmd_axgbe.a librte_pmd_bbdev_fpga_lte_fec.a librte_pmd_bbdev_null.a librte_pmd_bbdev_turbo_sw.a librte_pmd_bnxt.a librte_pmd_bond.a librte_pmd_caam_jr.a librte_pmd_ccp.a librte_pmd_crypto_scheduler.a librte_pmd_cxgbe.a librte_pmd_dpaa2.a librte_pmd_dpaa2_event.a librte_pmd_dpaa2_sec.a librte_pmd_dpaa.a librte_pmd_dpaa_event.a librte_pmd_dpaa_sec.a librte_pmd_dsw_event.a librte_pmd_e1000.a librte_pmd_ena.a librte_pmd_enetc.a librte_pmd_enic.a librte_pmd_failsafe.a librte_pmd_fm10k.a librte_pmd_hinic.a librte_pmd_hns3.a librte_pmd_i40e.a librte_pmd_iavf.a librte_pmd_ice.a librte_pmd_ifc.a librte_pmd_ixgbe.a librte_pmd_kasumi.a librte_pmd_kni.a librte_pmd_liquidio.a librte_pmd_memif.a librte_pmd_netvsc.a librte_pmd_nfp.a librte_pmd_nitrox.a librte_pmd_null.a librte_pmd_null_crypto.a librte_pmd_octeontx2.a librte_pmd_octeontx2_crypto.a librte_pmd_octeontx2_event.a librte_pmd_octeontx.a librte_pmd_octeontx_compress.a librte_pmd_octeontx_crypto.a librte_pmd_octeontx_event.a librte_pmd_opdl_event.a librte_pmd_openssl.a librte_pmd_pfe.a librte_pmd_qat.a librte_pmd_qede.a librte_pmd_ring.a librte_pmd_sfc.a librte_pmd_skeleton_event.a librte_pmd_snow3g.a librte_pmd_softnic.a librte_pmd_sw_event.a librte_pmd_tap.a librte_pmd_thunderx.a librte_pmd_vdev_netvsc.a librte_pmd_vhost.a librte_pmd_virtio.a librte_pmd_virtio_crypto.a librte_pmd_vmxnet3.a librte_pmd_zuc.a librte_port.a librte_power.a librte_rawdev.a librte_rawdev_dpaa2_cmdif.a librte_rawdev_dpaa2_qdma.a librte_rawdev_ioat.a librte_rawdev_ntb.a librte_rawdev_octeontx2_dma.a librte_rawdev_octeontx2_ep.a librte_rawdev_skeleton.a librte_rcu.a librte_reorder.a librte_rib.a librte_ring.a librte_sched.a librte_security.a librte_stack.a librte_table.a librte_timer.a librte_vhost.a )

Quoted 6 lines

Combining the libs into a single libdpdk.a (including the PMDs) makes it much simpler to statically link against.
How does pkg-config solve this?

Regards,
Ruslan

pkg-config does cover static linking, and much better as the linker script is missing all the reverse dependencies and the CFLAGS, which are necessary when doing static linking.

pkg-config --static --libs --cflags libdpdk

Quoted 83 lines
Quoted 79 lines · Luca Boccassi
Quoted 1 line · Ruslan Babayev

Add combined libdpdk.a and libdpdk.so libs for Meson similar to

how

Quoted 18 lines

it's done for Make builds

Signed-off-by: Ruslan Babayev <
[email protected]

Quoted 1 line
---
 buildtools/group-libs.sh |  2 ++
 buildtools/meson.build   |  1 +
 meson.build              | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100755 buildtools/group-libs.sh
buildtools/group-libs.sh new file +0 -0
new file mode 100755
index 000000000..b6e4c1c35

buildtools/group-libs.sh line 2

Quoted 2 lines
buildtools/group-libs.sh new file +2 -0
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'GROUP (' $(echo $* | xargs -n1 basename | sort | xargs)

')'

buildtools/meson.build subdir('pmdinfogen') · line 10

Quoted 10 lines
buildtools/meson.build +1 -0
index 9812917e5..eac8bc4ff 100644
@@ -6,6 +6,7 @@ subdir('pmdinfogen')
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
+group_libs = find_program('group-libs.sh')
 check_experimental_syms = find_program('check-experimental-

syms.sh')

buildtools/meson.build subdir('pmdinfogen') · line 11

Quoted 1 line
buildtools/meson.build +0 -0
 ldflags_ibverbs_static = find_program('options-ibverbs-

static.sh')

Quoted 28 lines
meson.build +17 -0
index b7ae9c8d9..eb6974d35 100644
@@ -61,6 +61,23 @@ configure_file(output: build_cfg,
              install_dir: join_paths(get_option('includedir'),
                              get_option('include_subdir_arch')))
 
+
+custom_target('group_shared_libs',
+             input: dpdk_libraries,
+             output: 'libdpdk.so',
+             capture: true,
+             install: true,
+             install_dir: get_option('libdir'),
+             command: [group_libs, '@INPUT@'])
+
+custom_target('group_static_libs',
+             input: dpdk_static_libraries + dpdk_drivers,
+             output: 'libdpdk.a',
+             capture: true,
+             install: true,
+             install_dir: get_option('libdir'),
+             command: [group_libs, '@INPUT@'])
+
 # for static builds, include the drivers as libs and we need to

"whole-archive"

Quoted 2 lines
 # them.
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,

--no-

Quoted 1 line

whole-archive']

Hi,

As far as I'm aware all usage of the old hacky linker script can be replaced with pkg-config, and that's why it was left behind. Same for
the static archive.

Is there any use case that pkg-config doesn't cover?

Signature · 2 lines
Kind regards,
Luca Boccassi