[Pkg-dpdk-devel] Bug#917984: Bug#917984: Can not link ODP with newer DPDK

Luca Boccassi bluca at debian.org
Wed Jan 2 23:08:13 GMT 2019


On Wed, 2019-01-02 at 14:55 +0300, Dmitry Eremin-Solenikov wrote:
> Hello,
> 
> ср, 2 янв. 2019 г. в 14:49, Luca Boccassi <bluca at debian.org>:
> > 
> > On Wed, 2019-01-02 at 01:43 +0300, Dmitry Eremin-Solenikov wrote:
> > Strange that libtool is messing things up, I've used the same
> > pkgconfig
> > file in a few different projects that use autoconf/automake and I
> > haven't seen this issue.
> 
> libtool rearranges/squashes linking flags in an attempt to find
> 'better'
> linking flags. Unfortunately this fail for DPDK. We have worked
> around
> this by squashing all PMDs into a single gcc argument:
> -Wl,--whole-archive,-lrte_pmd_af_packet,-lrte_pmd_ark,........,-
> lrte_pmd_vmxnet3_uio,--no-whole-archive
> -ldpdk
> 
> Thus libtool won't move PMDs from --whole-archive/--no-whole-archive
> brackets.
> 
> > I had a look on github, and it does not seem that odp is currently
> > using pkg-config, but rather doing some manual check - is there a
> > branch in a fork or a patch you could point me to so that I can try
> > to
> > reproduce?
> 
> No, I have not pushed my code to github yet. The easies way to
> reproduce
> is to statically link a sample program with libtool and check that
> generated
> ELF contains all PMDs.

That looks like a very very old libtool bug:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=347650

Have you tried patching config/ltmain.sh as it's suggested on that bug?
Something like:

--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -4716,6 +4716,11 @@ func_mode_link ()
 	arg=$func_stripname_result
 	;;
 
+      -Wl,--as-needed|-Wl,--no-as-needed|-Wl,--whole-archive|-Wl,--no-whole-archive)
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
       -Wl,*)
 	func_stripname '-Wl,' '' "$arg"
 	args=$func_stripname_result
@@ -5067,6 +5072,15 @@ func_mode_link ()
 	lib=
 	found=false
 	case $deplib in
+	-Wl,--as-needed|-Wl,--no-as-needed|-Wl,--whole-archive|-Wl,--no-whole-archive)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	  fi
+	  continue
+	  ;;
 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	  if test prog,link = "$linkmode,$pass"; then

Note that the current version of Meson does not do a good job of
generating the pkg-config file, but it's fixed in the version in
development. I also found a couple of bugs in dpdk. So the following
content for libdpdk.pc is more correct:

prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include/dpdk

Name: DPDK
Description: The Data Plane Development Kit (DPDK)
Version: 18.11.0
Requires.private: libbsd, zlib, libmnl, libmlx4, libibverbs, libmlx5, libcrypto, jansson, libelf
Libs: -L${libdir} -lrte_telemetry -lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port -lrte_vhost -lrte_security -lrte_sched -lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_meter -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_pci -lrte_ethdev -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring -lrte_eal -lrte_kvargs -lrte_cmdline
Libs.private: -Wl,--whole-archive -L${libdir} -lrte_common_cpt -lrte_common_dpaax -lrte_common_octeontx -lrte_bus_dpaa -lrte_bus_fslmc -lrte_bus_ifpga -lrte_bus_pci -lrte_bus_vdev -lrte_bus_vmbus -lrte_mempool_bucket -lrte_mempool_dpaa -lrte_mempool_dpaa2 -lrte_mempool_octeontx -lrte_mempool_ring -lrte_mempool_stack -lrte_pmd_af_packet -lrte_pmd_ark -lrte_pmd_atlantic -lrte_pmd_avf -lrte_pmd_avp -lrte_pmd_axgbe -lrte_pmd_bond -lrte_pmd_bnx2x -lrte_pmd_bnxt -lrte_pmd_cxgbe -lrte_pmd_dpaa -lrte_pmd_dpaa2 -lrte_pmd_e1000 -lrte_pmd_ena -lrte_pmd_enetc -lrte_pmd_enic -lrte_pmd_failsafe -lrte_pmd_fm10k -lrte_pmd_i40e -lrte_pmd_ifc -lrte_pmd_ixgbe -lrte_pmd_kni -lrte_pmd_liquidio -lrte_pmd_mlx4 -lrte_pmd_mlx5 -lrte_pmd_netvsc -lrte_pmd_nfp -lrte_pmd_null -lrte_pmd_octeontx -lrte_pmd_pcap -lrte_pmd_qede -lrte_pmd_ring -lrte_pmd_sfc -lrte_pmd_softnic -lrte_pmd_tap -lrte_pmd_thunderx -lrte_pmd_vdev_netvsc -lrte_pmd_vhost -lrte_pmd_virtio -lrte_pmd_vmxnet3 -lrte_pmd_aesni_gcm -lrte_pmd_aesni_mb -lrte_pmd_caam_jr -lrte_pmd_ccp -lrte_pmd_dpaa_sec -lrte_pmd_dpaa2_sec -lrte_pmd_null_crypto -lrte_pmd_octeontx_crypto -lrte_pmd_openssl -lrte_pmd_crypto_scheduler -lrte_pmd_virtio_crypto -lrte_pmd_octeontx_compress -lrte_pmd_qat -lrte_pmd_zlib -lrte_pmd_dpaa_event -lrte_pmd_dpaa2_event -lrte_pmd_octeontx_event -lrte_pmd_opdl_event -lrte_pmd_skeleton_event -lrte_pmd_sw_event -lrte_pmd_dsw_event -lrte_pmd_bbdev_null -lrte_pmd_skeleton_rawdev -lrte_pmd_dpaa2_cmdif -lrte_pmd_dpaa2_qdma -lrte_pmd_ifpga_rawdev -Wl,--no-whole-archive -lrte_telemetry -lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port -lrte_vhost -lrte_security -lrte_sched -lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_meter -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_pci -lrte_ethdev -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring -lrte_eal -lrte_kvargs -lrte_cmdline -Wl,-Bdynamic -Wl,--no-as-needed -pthread -lm -ldl -lnuma -lz -lIPSec_MB -lIPSec_MB -lpcap
Cflags: -I${includedir}/../x86_64-linux-gnu/dpdk -I${includedir} -include rte_config.h -march=corei7

With that I can manually do a static link (without using libtool).

-- 
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://alioth-lists.debian.net/pipermail/pkg-dpdk-devel/attachments/20190103/d68c31d1/attachment.sig>


More information about the Pkg-dpdk-devel mailing list