架构不一致或无法链接库出错:/usr/bin/ld: cannot find -lxx问题

(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
        )
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值