DPDK 示例应用程序编译错误缺少库文件

如何解决DPDK 示例应用程序编译错误缺少库文件

我正在尝试使用以下 CMakelist.txt 编译 dpdk 示例应用程序

SELECT * 
FROM target_table 
where (0% = '${wickets}' OR 10% = '${wickets}'  OR 20% = '${wickets}') AND Overs = '${overs}'`

出现编译错误

cmake_minimum_required(VERSION 3.10)
link_directories(/usr/local/lib/aarch64-linux-gnu/)
include_directories(/usr/local/include)
SET(DPDK_LIBS "-Wl,--whole-archive  -l dpdk  -Wl,--no-whole-archive")
add_executable(basicfwd  basicfwd.c )
target_link_libraries(basicfwd LINK_PUBLIC  ${DPDK_LIBS} )

缺失的 .so 文件在以前的 dpdk 版本中可用。我需要使用较新版本的 dpdk。

Scanning dependencies of target basicfwd
[ 50%] Building C object CMakeFiles/basicfwd.dir/basicfwd.c.o
[100%] Linking C executable basicfwd 
/usr/bin/ld: cannot find librte_pmd_bbdev_fpga_lte_fec.so
/usr/bin/ld: cannot find librte_pmd_bbdev_turbo_sw.so 
/usr/bin/ld: cannot find librte_pmd_hinic.so 
/usr/bin/ld: cannot find librte_pmd_hns3.so 
/usr/bin/ld: cannot find librte_pmd_iavf.so
/usr/bin/ld: cannot find librte_pmd_ice.so 
/usr/bin/ld: cannot find librte_pmd_lio.so
/usr/bin/ld: cannot find librte_pmd_memif.so
/usr/bin/ld: cannot find librte_pmd_nitrox.so
/usr/bin/ld: cannot find librte_pmd_octeontx2.so 
/usr/bin/ld: cannot find librte_pmd_octeontx2_crypto.so 
/usr/bin/ld: cannot find librte_pmd_octeontx2_event.so 
 usr/bin/ld: cannot find librte_pmd_octeontx_ssovf.so
/usr/bin/ld: cannot find librte_pmd_octeontx_zip.so 
/usr/bin/ld: cannot find librte_pmd_pfe.so
/usr/bin/ld: cannot find librte_pmd_thunderx_nicvf.so 
/usr/bin/ld: cannot find librte_pmd_vmxnet3_uio.so 
/usr/bin/ld: cannot find librte_rawdev_dpaa2_cmdif.so 
/usr/bin/ld: cannot find librte_rawdev_dpaa2_qdma.so 
/usr/bin/ld: cannot find librte_rawdev_ntb.so 
/usr/bin/ld: cannot find librte_rawdev_octeontx2_dma.so 
/usr/bin/ld: cannot find librte_rawdev_skeleton.so 
collect2: error: ld returned 1 exit status
CMakeFiles/basicfwd.dir/build.make:94: recipe for target 'basicfwd' failed 
make[2]: *** [basicfwd] Error 1 
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/basicfwd.dir/all' failed 
make[1]: *** [CMakeFiles/basicfwd.dir/all] Error 2 
Makefile:83: recipe for target 'all' failed 
make: *** [all] Error 2

我的 system.19.11 和 dpdk-stable-20.11 中有 2 个版本的 dpdk。目前使用 dpdk-stable-20.11 尝试使用示例应用程序附带的默认 Makefile。上面提到的库文件丢失错误没有发生。

带有默认 Makefile 的 Basicfwd

#locate librte_rawdev_ntb.so
/opt/dpdk/lib/librte_rawdev_ntb.so
/opt/dpdk/lib/librte_rawdev_ntb.so.20.0
# locate librte_pmd_ice.so
/opt/dpdk/lib/librte_pmd_ice.so
/opt/dpdk/lib/librte_pmd_ice.so.20.0

我需要在 CMakeLists.txt 中做任何修改吗?请提供解决此问题的建议

编辑: 我已经修改了 CMakeList.txt

cc -O3 -include rte_config.h -mcpu=cortex-a72 -I/usr/local/include -I/usr/include/libnl3 -DALLOW_EXPERIMENTAL_API basicfwd.c -o build/basicfwd-shared  -L/usr/local/lib/aarch64-linux-gnu -Wl,--as-needed -lrte_node -lrte_graph -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_regexdev -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_rcu -lrte_ring -lrte_eal -lrte_telemetry -lrte_kvargs -lbsd
ln -sf basicfwd-shared build/basicfwd

出现编译错误

cmake_minimum_required(VERSION 3.10)
# the `pkg_check_modules` function is created with this call
find_package(PkgConfig REQUIRED)
pkg_check_modules(DPDK_LIB REQUIRED libdpdk)
add_executable(basicfwd  basicfwd.c )
target_link_libraries(basicfwd ${DPDK_LIB_LIBRARIES})
target_include_directories(basicfwd PUBLIC ${DPDK_LIB__INCLUDE_DIRS})
target_compile_options(basicfwd PUBLIC ${DPDK_LIB_CFLAGS_OTHER})

请提出解决此问题的建议

解决方法

这不是 DPDK 示例或 pkg-config 相关问题,但这与 CMAKE 使用有关。根据自定义 CMakelist.txt,link_directories 缺少 /usr/local/lib/aarch64-linux-gnu。如果 DPDK 如上所述构建并安装了库,则需要将相同的内容添加到 CMakelis.txt

在我看来,如果 DPDK 存在,应该首先尝试使用 pkg-config。如果是,使用cmake支持的_CFLAGS and _LDFLAGS解决依赖。

示例代码

add_definitions(${DPDK_CFLAGS}
include_directories(${DPDK_INCLUDE_DIR})
link_libraries(${MYDPDK_LIBRARIES})
add_definitions(-DHAVE_DPDK)

[Edit-2] 基于共享的 compilation error 信息

对于native build

CMake Error: CMake can not determine linker language for target: basicfwd
CMake Error: Cannot determine link language for target "basicfwd".
-- Generating done
-- Build files have been written to: /tmp/cmaketest/build

$ make
Scanning dependencies of target basicfwd
[ 50%] Building C object CMakeFiles/basicfwd.dir/basicfwd.c.o
[100%] Linking C executable basicfwd
[100%] Built target basicfwd

$ sudo ./basicfwd --no-pci --vdev=net_tap0  --vdev=net_tap1
EAL: Detected 32 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: Probing VFIO support...
EAL: No legacy callbacks,legacy socket not created
Port 0 MAC: a6 1a ac 56 7f a8
Port 1 MAC: be 52 49 67 d3 fa

WARNING: Too many lcores enabled. Only 1 used.

Core 0 forwarding packets. [Ctrl+C to quit]

基于错误 you are trying a cross-build,but the CMakeLists.txt is not having the same 的有限日志原因。对于使用 CMAKE 进行交叉编译,应使用 CMAKE 方法和选项,例如 cmake -DCMAKE_TOOLCHAIN_FILE=[target tool chain root folder]/toolchain.cmake ..。乙

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-