linux下运行程序时无法找到库

问题

./test: error while loading shared libraries: libcyusbserial.so: cannot open shared object file: No such file or directory 

解决方案一

# echo “/home/root/workspace/cyusblib” >> /etc/ld.so.conf # 把库的路径添加到ld.so.conf文件末尾
# ldconfig # 使之生效

解决方案二:

配置 LD_LIBRARY_PATH环境变量

解决方案三:

把库放到系统目录去
/usr/lib
/usr/local/lib

总结

每种方法各有优缺点,上次使用方案一解决问题,平时使用方案二。比较少用方案三。

https://blog.csdn.net/guotianqing/article/details/106804065

猜你喜欢

转载自blog.csdn.net/amwha/article/details/115066584
今日推荐