Back Home
In trying to run the publish test project from the tutorial, i get the error ./publish: error while loading shared libraries: libzcm.so: cannot open shared object file: No such file or directory
If you see this error when trying to use anything zcm related, then you probably have a problem with your LD_LIBRARY_PATH environment variable. Try echoing $LD_LIBRARY_PATH and verifying that it points to /usr/lib:/usr/local/lib
. If it doesn't (which is weird), point it there yourself with:
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
Add that line to the bottom of your ~/.bashrc to make it permanent.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no zcmjni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at zcm.zcm.ZCMJNI.<clinit>(ZCMJNI.java:7)
at zcm.zcm.ZCM.<init>(ZCM.java:37)
at zcm.spy.Spy.<init>(Spy.java:77)
at zcm.spy.Spy.main(Spy.java:481)
This is a similar symptom to the first question. It means your $LD_LIBRARY_PATH isn't set correctly. See the answer to the question above.
Have you tried running your program with ZCM_DEBUG=1
in front of it? This enables debug output from zcm which should help you diagnose your problems
Calling the subscribe / unsubscribe functions modifies the same internal data structures as
the dispatch code reads during callbacks. Due to a lock, calling these functions from within a
callback causes a deadlock. You should therefore alter the subscriptions outside of your callbacks.
If your code really needs to change subscriptions in response to a received message, try using a queue
to pass the work to another thread or in your main-loop if using zcm_handle
.
This is no longer an issue and is addressed on ZCM master
NodeJS' garbage collector will come around and clean up a subscription unless that subscription is referenced elsewhere in your code. The easiest way to get around this problem is by calling unsubscribe on all your subscriptions on process.exit
process.on('exit', function() { z.unsubscribe(sub); });