java ZMQ - libzmq.so.3:无法打开共享对象文件:没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17275875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 01:33:26  来源:igfitidea点击:

ZMQ - libzmq.so.3: cannot open shared object file: No such file or directory

javazeromqpyzmqjzmq

提问by tokhi

I'm trying to embed zeroMQin my app, I followed this guidelineto install ZMQ, so till here everything works fine. I have this line of code in my app:

我正在尝试嵌入zeroMQ我的应用程序,我按照此指南进行安装ZMQ,所以直到这里一切正常。我的应用程序中有这行代码:

ZMQ.Context m_context = ZMQ.context(1);

but above line of code raise below exception:

但上面的代码行引发以下异常:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libjzmq-812339378390536247.lib: libzmq.so.3: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.zeromq.EmbeddedLibraryTools.loadEmbeddedLibrary(EmbeddedLibraryTools.java:136)
    at org.zeromq.EmbeddedLibraryTools.<clinit>(EmbeddedLibraryTools.java:22)
    at org.zeromq.ZMQ.<clinit>(ZMQ.java:38)
    at com.castaclip.verticals.Messenger.<init>(Messenger.java:125)
    at com.castaclip.verticals.PushMessenger.<init>(PushMessenger.java:30)
    at com.castaclip.verticals.pushserver.App.setup(App.java:60)
    at com.castaclip.verticals.pushserver.App.main(App.java:41)

The error is exactly pointing to this line.

错误正是指向这一行

P.S: its a little bit difficult to fully explain this question.. if you have any question plz let me know. thanks.

PS:完全解释这个问题有点困难..如果你有任何问题请告诉我。谢谢。

回答by Trevor Bernard

If you've successfully built libzmq and jzmq in that order, I would run:

如果您已按此顺序成功构建 libzmq 和 jzmq,我将运行:

$ sudo ldconfig

to update the system library cache. Then I would check to see if LD_LIBRARY_PATH is defined like Raffian mentioned, or set your library path explicitly to something like:

更新系统库缓存。然后我会检查 LD_LIBRARY_PATH 是否像 Raffian 提到的那样定义,或者将您的库路径显式设置为类似以下内容:

$ java -Djava.library.path=/usr/lib:/usr/local/lib

回答by tokhi

Finally I tried to figure out the problem. I was using zeromq-2.1.10and this was part of the problem.

最后我试图找出问题所在。我正在使用zeromq-2.1.10,这是问题的一部分。

So I installed zeromq-3.2.3from the source and problem resolved.

所以我zeromq-3.2.3从源代码安装并解决了问题。

回答by DJC

I encountered a mystifying instance of this message when I:

当我执行以下操作时,我遇到了此消息的一个神秘实例:

# java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA
Exception in thread "main"
java.lang.UnsatisfiedLinkError: /usr/hf/zmq/lib/libjzmq.so:
libzmq.so.3: cannot open shared object file: No such file or directory

which was fixed with a solution that makes no sense at all to me:

这是用一个对我来说毫无意义的解决方案修复的:

# LD_LIBRARY_PATH=/usr/hf/zmq/lib/ java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA

wierd.

怪异的。