libxxx.so cannot open shared object file No such file or directory
- 没安装
- 装了没找到
所以先定位locate libxxx.so
,找到了说明装了
Linux下ld对于动态库的搜索路径的配置方式包括以下几种方式:
- 通过配置gcc编译器的参数-Wl,-rpath指定;
- 通过LD_LIBRARY_PATH环境变量指定;
- 通过
sudo vim /etc/ld.so.conf
指定,切记修改完ld.so.conf之后必须执行sudo /sbin/ldconfig -v
同步动态库; - 默认搜素路径/lib、/usr/lib/指定;
一般用sudo vim /etc/ld.so.conf
, 在里面加一句/usr/local/lib
,然后sudo /sbin/ldconfig -v
。
就可以了。
实在不行就target_link_libraries (xxx /usr/local/lib/libxxxxxx.so)
,指腚行。
https://blog.csdn.net/lhl_blog/article/details/87914237
在CLION的config里,可以在环境变量里设置LD_LIBRARY_PATH=/path to .so