跳到主要内容

CMake 加载动态库

出现错误 “error while loading shared libraries: libag1.so: cannot open shared object file: No such file or directory”

ldd 显示

libag1.so => not found

可以在 CMakeLists.txt 中针对某个 target 设置 RPATH

## Targets can have properties that affect how they are built.
## set_target_properties(target1 target2 ... PROPERTIES prop1 value1 prop2 value2 ...)
set_target_properties(lane_detect PROPERTIES INSTALL_RPATH "${onnxruntime_INSTALL_PREFIX}/lib")