在ubuntu在安装cp-abe的过程中往往会遇到很多问题,由于cpabe库依赖于其他很多库,例如gmp、pbc、glib、openssl、libbswabe库等。在安装的过程中会出现这样的错误:
The library libbswabe was not found on your system! Please obtain it
from http://acsc.csl.sri.com/cpabe/
这是由于在安装cpabe时需要调用libbswabe.a静态库,没有把libbswabe.a静态库的安装路径放到LD_LIBRARY_PATH中,就会出现上述错误。
正确的解决办法是:在命令终端输入
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
有时在依赖于别的动态库时也会出现这样的错误:
test: error while loading shared libraries: libexampleso.so.0: cannot open shared object file: No such file or directory。
这也是因为没有把链接库的安装路径放到LD_LIBRARY_PATH中。
由于Ubuntu不能在profile、 ~/.bashrc中设置LD_LIBRARY_PATH,解决办法是 编辑 /etc/ld.so.conf 文件,将指定的路径加上,然后运行ldconfig命令即可。