Связь DPDK дает неопределенный символ: rte_cpu_get_flag_enabled - PullRequest
0 голосов
/ 13 июля 2020

Я пытаюсь создать динамическую c библиотеку libdpdk.so из моих собственных функций, связанных со сторонними библиотеками DPDK. Затем я бы связал libdpdk.so со своей собственной тестовой программой main. cpp. У меня проблема в том, что libdpdk.so строится без ошибок, но когда я связываю его с main. cpp, я вижу неопределенные символы. Фактически, если я запускаю 'nm -u' на 'libdpdk.so', я вижу довольно много неопределенных символов.

Вот команда компоновщика для сборки 'libdpdk.so' (я удалил абсолютный dpdk paths для ясности):

[14/15] : && /opt/rh/devtoolset-7/root/usr/bin/g++ -fPIC -march=native -g -O3 -DNDEBUG   -shared -Wl,-soname,libdpdk.so -o dpdk/libdpdk.so dpdk/CMakeFiles/dpdk.dir/ThreadDpdk.cpp.o dpdk/CMakeFiles/dpdk.dir/DpdkSock.cpp.o dpdk/CMakeFiles/dpdk.dir/Log.c.o dpdk/CMakeFiles/dpdk.dir/cfg.cpp.o dpdk/CMakeFiles/dpdk.dir/wrap_eth.cpp.o dpdk/CMakeFiles/dpdk.dir/wrap_ip.cpp.o dpdk/CMakeFiles/dpdk.dir/SocketClass.cpp.o dpdk/CMakeFiles/dpdk.dir/RingClass.cpp.o  -Wl,-rpath,/opt/dpdk/dpdk-stable-18.11.8/x86_64-native-linuxapp-gcc/lib  /usr/lib64/libdl.so  /usr/lib64/libutil.so  /usr/lib64/libm.so  -Xlinker  -export-dynamic  -Wl,--whole-archive  librte_flow_classify.so  librte_pipeline.so  librte_table.so  librte_port.so  librte_pdump.so  librte_distributor.so  librte_ip_frag.so  librte_meter.so  librte_lpm.so  librte_acl.so  librte_jobstats.so  librte_metrics.so  librte_bitratestats.so  librte_latencystats.so  librte_power.so  librte_efd.so  librte_bpf.so  librte_cfgfile.so  librte_gro.so  librte_gso.so  librte_hash.so  librte_member.so  librte_vhost.so  librte_kvargs.so  librte_mbuf.so  librte_net.so  librte_ethdev.so  librte_bbdev.so  librte_cryptodev.so  librte_security.so  librte_compressdev.so  librte_eventdev.so  librte_rawdev.so  librte_timer.so  librte_mempool.so  librte_mempool_ring.so  librte_ring.so  librte_pci.so  librte_eal.so  librte_cmdline.so  librte_reorder.so  librte_sched.so  librte_kni.so  librte_common_cpt.so  librte_common_octeontx.so  librte_common_dpaax.so  librte_bus_pci.so  librte_bus_vdev.so  librte_bus_dpaa.so  librte_bus_fslmc.so  librte_mempool_bucket.so  librte_mempool_stack.so  librte_mempool_dpaa.so  librte_mempool_dpaa2.so  librte_pmd_af_packet.so  librte_pmd_ark.so  librte_pmd_avf.so  librte_pmd_avp.so  librte_pmd_axgbe.so  librte_pmd_bnxt.so  librte_pmd_bond.so  librte_pmd_cxgbe.so  librte_pmd_dpaa.so  librte_pmd_dpaa2.so  librte_pmd_e1000.so  librte_pmd_ena.so  librte_pmd_enic.so  librte_pmd_fm10k.so  librte_pmd_failsafe.so  librte_pmd_i40e.so  librte_pmd_ixgbe.so  librte_pmd_kni.so  librte_pmd_lio.so  librte_pmd_nfp.so  librte_pmd_null.so  librte_pmd_qede.so  librte_pmd_ring.so  librte_pmd_softnic.so  librte_pmd_sfc_efx.so  librte_pmd_tap.so  librte_pmd_thunderx_nicvf.so  librte_pmd_vdev_netvsc.so  librte_pmd_virtio.so  librte_pmd_vhost.so  librte_pmd_ifc.so  librte_pmd_vmxnet3_uio.so  librte_bus_vmbus.so  librte_pmd_netvsc.so  librte_pmd_bbdev_null.so  librte_pmd_null_crypto.so  librte_pmd_crypto_scheduler.so  librte_pmd_dpaa2_sec.so  librte_pmd_dpaa_sec.so  librte_pmd_virtio_crypto.so  librte_pmd_octeontx_zip.so  librte_pmd_qat.so  librte_pmd_skeleton_event.so  librte_pmd_sw_event.so  librte_pmd_dpaa_event.so  librte_pmd_dpaa2_event.so  librte_mempool_octeontx.so  librte_pmd_octeontx.so  librte_pmd_opdl_event.so  librte_pmd_skeleton_rawdev.so  librte_pmd_dpaa2_cmdif.so  librte_pmd_dpaa2_qdma.so  librte_bus_ifpga.so  librte_pmd_ifpga_rawdev.so  -Wl,--no-whole-archive  -lrt  -lm  -lnuma  -ldl  /usr/lib64/libconfig.so  -Wl,-export  -Dynamic  -L/opt/dpdk/dpdk-stable-18.11.8/x86_64-native-linuxapp-gcc/lib  -Wl,--as-needed  -Wl,-Map=dpdk_test.map  -Wl,--cref  -pthread && :

Вот неопределенные символы в libdpdk.so:

$ nm -u dpdk/libdpdk.so
                 U access@@GLIBC_2.2.5
                 U bzero@@GLIBC_2.2.5
                 U calloc@@GLIBC_2.2.5
                 U config_destroy
                 U config_init
                 U config_lookup
                 U config_read_file
                 U config_setting_get_elem
                 U config_setting_length
                 U config_setting_lookup_int
                 U config_setting_lookup_string
                 U __cxa_atexit@@GLIBC_2.2.5
                 U __cxa_begin_catch@@CXXABI_1.3
                 U __cxa_end_catch@@CXXABI_1.3
                 w __cxa_finalize@@GLIBC_2.2.5
                 U exit@@GLIBC_2.2.5
                 U fclose@@GLIBC_2.2.5
                 U fflush@@GLIBC_2.2.5
                 U fopen@@GLIBC_2.2.5
                 U fprintf@@GLIBC_2.2.5
                 U fputs@@GLIBC_2.2.5
                 U free@@GLIBC_2.2.5
                 U fwrite@@GLIBC_2.2.5
                 U gettimeofday@@GLIBC_2.2.5
                 w __gmon_start__
                 U gp_threadDpdk
                 U g_shutdownNow
                 U g_shutdownNowMutex
                 U g_threadsMayRunCondVar
                 U g_threadsMayRunFlag
                 U g_threadsMayRunMutex
                 U __gxx_personality_v0@@CXXABI_1.3
                 U inet_addr@@GLIBC_2.2.5
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U lcore_config@@DPDK_2.0
                 U localtime@@GLIBC_2.2.5
                 U memcpy@@GLIBC_2.14
                 U memset@@GLIBC_2.2.5
                 U per_lcore__lcore_id@@DPDK_2.0
                 U printf@@GLIBC_2.2.5
                 w __pthread_key_create@@GLIBC_2.2.5
                 w pthread_mutex_lock@@GLIBC_2.2.5
                 w pthread_mutex_unlock@@GLIBC_2.2.5
                 U pthread_self@@GLIBC_2.2.5
                 U pthread_spin_init@@GLIBC_2.2.5
                 U pthread_spin_lock@@GLIBC_2.2.5
                 U pthread_spin_unlock@@GLIBC_2.2.5
                 U putchar@@GLIBC_2.2.5
                 U puts@@GLIBC_2.2.5
                 U rte_cpu_get_flag_enabled@@DPDK_2.0
                 U rte_cycles_vmware_tsc_map@@DPDK_2.0
                 U rte_delay_us@@DPDK_2.0
                 U rte_eal_get_configuration@@DPDK_2.0
                 U rte_eal_init@@DPDK_2.0
                 U rte_eth_dev_configure@@DPDK_2.2
                 U rte_eth_dev_count_avail@@DPDK_18.05
                 U rte_eth_devices@@DPDK_2.2
                 U rte_eth_dev_info_get@@DPDK_2.2
                 U rte_eth_dev_is_valid_port@@DPDK_2.2
                 U rte_eth_dev_start@@DPDK_2.2
                 U rte_eth_link_get_nowait@@DPDK_2.2
                 U rte_eth_macaddr_get@@DPDK_2.2
                 U rte_eth_promiscuous_enable@@DPDK_2.2
                 U rte_eth_rx_queue_setup@@DPDK_2.2
                 U rte_eth_tx_queue_setup@@DPDK_2.2
                 U rte_get_tsc_hz@@DPDK_2.0
                 U rte_hash_add_key@@DPDK_2.0
                 U rte_hash_create@@DPDK_2.0
                 U rte_hash_iterate@@DPDK_2.1
                 U rte_hash_lookup@@DPDK_2.0
                 U rte_ip_frag_free_death_row@@DPDK_2.0
                 U rte_ip_frag_table_create@@DPDK_2.0
                 U rte_ipv4_fragment_packet@@DPDK_2.0
                 U rte_ipv4_frag_reassemble_packet@@DPDK_2.0
                 U rte_ipv6_frag_reassemble_packet@@DPDK_2.0
                 U rte_lpm6_create@@DPDK_2.0
                 U rte_lpm_add@@DPDK_16.04
                 U rte_lpm_create@@DPDK_16.04
                 U rte_mempool_create@@DPDK_2.0
                 U rte_mempool_lookup@@DPDK_2.0
                 U rte_mempool_ops_table@@DPDK_16.07
                 U __rte_panic@@DPDK_2.0
                 U rte_pktmbuf_dump@@DPDK_2.0
                 U rte_pktmbuf_init@@DPDK_2.0
                 U rte_pktmbuf_pool_create@@DPDK_2.1
                 U rte_pktmbuf_pool_init@@DPDK_2.0
                 U rte_ring_create@@DPDK_2.0
                 U rte_socket_id@@DPDK_2.0
                 U rte_zmalloc_socket@@DPDK_2.0
                 U sched_getcpu@@GLIBC_2.6
                 U setbuf@@GLIBC_2.2.5
                 U snprintf@@GLIBC_2.2.5
                 U sprintf@@GLIBC_2.2.5
                 U sscanf@@GLIBC_2.2.5
                 U stderr@@GLIBC_2.2.5
                 U stdout@@GLIBC_2.2.5
                 U __strdup@@GLIBC_2.2.5
                 U strerror@@GLIBC_2.2.5
                 U strftime@@GLIBC_2.2.5
                 U __tls_get_addr@@GLIBC_2.3
                 U _Unwind_Resume@@GCC_3.0
                 U vsnprintf@@GLIBC_2.2.5
                 U __xpg_basename@@GLIBC_2.2.5
                 U _Z14get_sched_attrmRSs
                 U _Z5fatalRKSs
                 U _ZdlPv@@GLIBCXX_3.4
                 U _ZNKSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strEv@@GLIBCXX_3.4
                 U _ZNSo9_M_insertImEERSoT_@@GLIBCXX_3.4.9
                 U _ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4
                 U _ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4
                 U _ZNSs4_Rep9_S_createEmmRKSaIcE@@GLIBCXX_3.4
                 U _ZNSs4swapERSs@@GLIBCXX_3.4
                 U _ZNSs6assignERKSs@@GLIBCXX_3.4
                 U _ZNSsC1EPKcRKSaIcE@@GLIBCXX_3.4
                 U _ZNSsC1ERKSs@@GLIBCXX_3.4
                 U _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode@@GLIBCXX_3.4
                 U _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@@GLIBCXX_3.4
                 U _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE@@GLIBCXX_3.4.11
                 U _ZNSt6localeC1Ev@@GLIBCXX_3.4
                 U _ZNSt6localeD1Ev@@GLIBCXX_3.4
                 U _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4
                 U _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
                 U _ZNSt8ios_baseC2Ev@@GLIBCXX_3.4
                 U _ZNSt8ios_baseD2Ev@@GLIBCXX_3.4
                 U _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E@@GLIBCXX_3.4
                 U _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@@GLIBCXX_3.4.9
                 U _ZSt19__throw_logic_errorPKc@@GLIBCXX_3.4
                 U _ZSt20__throw_system_errori@@GLIBCXX_3.4.11
                 U _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@@GLIBCXX_3.4
                 U _ZTISt9exception@@GLIBCXX_3.4
                 U _ZTTSt18basic_stringstreamIcSt11char_traitsIcESaIcEE@@GLIBCXX_3.4
                 U _ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3
                 U _ZTVSt15basic_streambufIcSt11char_traitsIcEE@@GLIBCXX_3.4
                 U _ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE@@GLIBCXX_3.4
                 U _ZTVSt18basic_stringstreamIcSt11char_traitsIcESaIcEE@@GLIBCXX_3.4
                 U _ZTVSt9basic_iosIcSt11char_traitsIcEE@@GLIBCXX_3.4

Моя тестовая программа не может связать с ошибкой:

[1/1] : && /opt/rh/devtoolset-7/root/usr/bin/g++  -march=native -g -O3 -DNDEBUG   CMakeFiles/dpdk_test.dir/main.cpp.o CMakeFiles/dpdk_test.dir/Threads.cpp.o CMakeFiles/dpdk_test.dir/ThreadMon.cpp.o CMakeFiles/dpdk_test.dir/ThreadMSG.cpp.o CMakeFiles/dpdk_test.dir/_kbhit.cpp.o  -o dpdk_test  -Wl,-rpath,/data/daldrich/src/dpdk_test_library/build/dpdk  dpdk/libdpdk.so  -pthread && :
FAILED: dpdk_test 
: && /opt/rh/devtoolset-7/root/usr/bin/g++  -march=native -g -O3 -DNDEBUG   CMakeFiles/dpdk_test.dir/main.cpp.o CMakeFiles/dpdk_test.dir/Threads.cpp.o CMakeFiles/dpdk_test.dir/ThreadMon.cpp.o CMakeFiles/dpdk_test.dir/ThreadMSG.cpp.o CMakeFiles/dpdk_test.dir/_kbhit.cpp.o  -o dpdk_test  -Wl,-rpath,/data/daldrich/src/dpdk_test_library/build/dpdk  dpdk/libdpdk.so  -pthread && :
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: CMakeFiles/dpdk_test.dir/main.cpp.o: undefined reference to symbol 'rte_cpu_get_flag_enabled@@DPDK_2.0'
//opt/dpdk/dpdk-stable-18.11.8/x86_64-native-linuxapp-gcc/lib/librte_eal.so.9.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Есть идеи, почему символ 'rte_cpu_get_flag_enabled @@ DPDK_2.0' не определен?

...