RK3588 ubuntu 20 编译 PaddlePaddle FastDeploy error: ‘string_view’ is not a member of ‘std’
在rk3588 板端编译FastDeploy 的python SDK, rk3588 运行ubuntu 20, 出现 如下问题:error: ‘string_view’ is not a member of ‘std’
·
1. 前言
在rk3588 板端编译FastDeploy 的python SDK, rk3588 运行ubuntu 20, 出现 如下问题:
/work/FastDeploy/fastdeploy/utils/utils.cc:64:28: error: ‘string_view’ is not a member of ‘std’
64 | os_string to_osstring(std::string_view utf8_str)
| ^~~~~~~~~~~
/work/FastDeploy/fastdeploy/utils/utils.cc:64:28: note: ‘std::string_view’ is only available from C++17 onwards
/work/FastDeploy/fastdeploy/utils/utils.cc:65:1: error: expected ‘,’ or ‘;’ before ‘{’ token
65 | {
| ^
/work/FastDeploy/fastdeploy/utils/utils.cc: In function ‘bool fastdeploy::ReadBinaryFromFile(const string&, std::string*)’:
/work/FastDeploy/fastdeploy/utils/utils.cc:84:38: error: no match for call to ‘(fastdeploy::os_string {aka std::__cxx11::basic_string<char>}) (const string&)’
84 | std::ifstream file(to_osstring(path), std::ios::binary | std::ios::ate);

2. 问题描述
string_view 是C++ 17 标准才有的成员,但是编译过程中,使用了C++ 11,如下图
因此需要配置为C++ 17 ,根据官方文档 要添加类似的编译选项
官方说明
export ENABLE_ORT_BACKEND=ON
export ENABLE_RKNPU2_BACKEND=ON
export ENABLE_VISION=ON
# 请根据你的开发版的不同,选择RK3588和RK356X
export RKNN2_TARGET_SOC=RK3588
python 的编译并没有提供该选项,因此需要直接改一行代码setup.py ,如下图所示
setup_configs["CMAKE_CXX_STANDARD"] = os.getenv("CMAKE_CXX_STANDARD", "17")

3. 测试
- 添加官方的选项
- 如上图,添加一行代码修订为C++ 17 标准
编译过程

以上顺利编译通过
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)