解决DOCA官方例程 ninja 编译错误

在测试DOCA给的应用firewall在进行编译的时候出现错误如下:

1、

sun@sun-G3-3590:/opt/mellanox/doca/applications$ sudo meson build
The Meson build system
Version: 0.61.2
Source dir: /opt/mellanox/doca/applications
Build dir: /opt/mellanox/doca/applications/build
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: DOCA_APPLICATIONS
Project version: 1.4.0079
C compiler for the host machine: cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C linker for the host machine: cc ld.bfd 2.34
C++ compiler for the host machine: c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Found CMake: /usr/bin/cmake (3.16.3)
Run-time dependency libdpdk found: NO (tried cmake)

meson.build:32:0: ERROR: Could not generate cargs for libdpdk:
Package libmlx4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmlx4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libmlx4', required by 'libdpdk', not found


A full log can be found at /opt/mellanox/doca/applications/build/meson-logs/meson-log.txt

解决方案:

在root环境下运行:

root@sun-G3-3590:/opt/mellanox/doca/applications# meson build
The Meson build system
Version: 0.61.2
Source dir: /opt/mellanox/doca/applications
Build dir: /opt/mellanox/doca/applications/build
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: DOCA_APPLICATIONS
Project version: 1.4.0079
C compiler for the host machine: cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C linker for the host machine: cc ld.bfd 2.34
C++ compiler for the host machine: c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Run-time dependency libdpdk found: YES 20.11.5.2.2
Run-time dependency threads found: YES
Run-time dependency libbsd found: YES 0.10.0
Run-time dependency doca-argp found: YES 1.4.0079
Run-time dependency doca-flow found: YES 1.4.0079
Run-time dependency doca-common found: YES 1.4.0079
Dependency doca-argp found: YES 1.4.0079 (cached)
Run-time dependency doca-flow-grpc found: YES 1.4.0079
Dependency doca-common found: YES 1.4.0079 (cached)
Build targets in project: 2

Found ninja-1.12.0.git at /usr/bin/ninja

2、找不到json-c/json.h文件

linux-gnu/librte_telemetry.so /opt/mellanox/dpdk/lib/x86_64-linux-gnu/librte_kvargs.so /usr/lib/x86_64-linux-gnu/libbsd.so -pthread -Wl,--as-needed /opt/mellanox/doca/lib/x86_64-linux-gnu/libdoca_argp.so -Wl,--as-needed /opt/mellanox/doca/lib/x86_64-linux-gnu/libdoca_flow_grpc.so -Wl,--as-needed /opt/mellanox/doca/lib/x86_64-linux-gnu/libdoca_common.so -Wl,--end-group
/usr/bin/ld: firewall/src/doca_firewall.p/firewall_core.c.o: undefined reference to symbol 'json_object_array_length'
/usr/bin/ld: /lib/x86_64-linux-gnu/libjson-c.so.4: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

解决方案:

参考:

https://zhangboyi.gitlab.io/post/2020-09-14-resolve-dso-missing-from-command-line-error/

运行:

export LDFLAGS="-Wl,--copy-dt-needed-entries"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值