onnxruntime生成静态链接库libonnxruntime.a

如果通过源码编译会在build文件夹下得到一系列的.a库,但是onnxruntime默认将其链接成动态链接库,可以通过如下方式生成静态链接库

在build文件夹里创建文件merge.mri

create libonnxruntime.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_common.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_framework.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_graph.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_mlas.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_optimizer.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_providers.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_session.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/libonnxruntime_util.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/onnx/libonnx.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/onnx/libonnx_proto.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/lib/libgmock.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/lib/libgtest.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/external/nsync/libnsync_cpp.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/external/re2/libre2.a
addlib /workspace/ygao/software_backup/onnxruntime/build/Linux/RelWithDebInfo/external/protobuf/cmake/libprotobuf-lite.a
save
end

之后在build里执行

ar -M < ./run.mri

即可得到libonnxruntime.a

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值