libthrift-0.9.1.so: cannot open shared object file: No such file or directory

▼魔方 西西 提交于 2019-12-11 13:38:40

问题


I have installed thrift 0.9.1 using the git repository. After building thrift I started the precompiled cpp Server and and the php client. This precompiled examples worked fine.

Now I am trying to compile my own cpp Server by following this tutorial (http://wiki.apache.org/thrift/ThriftUsageC++). I used:

g++ -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -Wall -I/usr/local/include/thrift *.cpp -L/usr/local/lib -lthrift -o something

to compile the server which worked without errors.

When I execute the server by typing ./something I get error while loading shared libraries: libthrift-0.9.1.so: cannot open shared object file: No such file or directory.

In the lib directory are the following files:

  • libthrift.a
  • libtrift.la
  • libthrift.so
  • libtthrift-0.9.0.so
  • libtthrift-0.9.1.so

There are also libthrift_c.glib.a, libthriftnb.a and libthriftz.a and the files which belong to them, but I think they are not important for this error.

Somebody knows what's the fault?

Thx for any help


回答1:


When a dynamic library is used (-lthrift), Linux searches for the directory containing libthrift.so in the directories within the environment variable LD_LIBRARY_PATH, you must make sure that the directory containing libthrift.so is setup correctly in the environment variable LD_LIBRARY_PATH.




回答2:


Set env_var as follows,
$vim ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib/:${LD_LIBRARY_PATH}
$source ~/.bashrc
$echo $LD_LIBRARY_PATH
$thrift -version


来源:https://stackoverflow.com/questions/23991830/libthrift-0-9-1-so-cannot-open-shared-object-file-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!