(1)库架构不一致引起/usr/bin/ld: cannot find -lxx问题
在Linux嵌入式平台上开发程序,除了网上能查到的库文件路径问题和/etc/ld.so.conf配置文件或/etc/ld.so.conf.d/目录下conf,再ldconfig等问题外,还有一种可能是目标so和当前可用的so架构不一致,比如armv7或者arch64(armv8a)等。可用file命令查看。如果不一致,需要重在相同环境下新生成so库文件
arch64架构
# lichunhong @ lichunhong-ThinkPad-T470p in ~/Documents/src/motion_planner/bin/arm64 on git:dev o [18:00:16]
$ file libAprMotionPlanner.so
libAprMotionPlanner.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2ffad15377c8bd9630a5558186d05a604b347fba, not stripped
x86-64 android
# lichunhong @ lichunhong-ThinkPad-T470p in ~/Documents/src/motion_planner/bin/x64 on git:dev o [18:03:09]
$ file libAprMotionPlanner.so
libAprMotionPlanner.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=d52ee3999399e736cfd92846186b1c7575bc9817, not stripped
x86-64 Linux
# lichunhong @ lichunhong-ThinkPad-T470p in ~/Documents/src/effective_robotics_programming_with_ros-master/catkin_ws/src/pathPlan/lib on git:lichunhong/dev x [18:04:23]
$ file libpathplan_old.so
libpathplan_old.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=2d5bcc52746636bbccf3eb97bae2d48dc2c3c2b7, not stripped
(2)cmakelists文件中 target_link_libraries 多加了链接库, 计算机中没有liblog.so库,去掉看是否报错
target_link_libraries(pathplan
${OpenCV_LIBS}
log
)