Giter Club home page Giter Club logo

Comments (11)

lt-schmidt-jr avatar lt-schmidt-jr commented on September 27, 2024 3

Mac OSX uses DYLD_LIBRARY_PATH instead of unix LD_LIBRARY_PATH

from jzmq.

felixrabe avatar felixrabe commented on September 27, 2024 2

I finally got it to work today! This is how, step-by-step:

I'm using MacPorts and am on Mac OS X 10.6.6. I have installed a current Xcode (and thus gcc and that stuff), as well as pkg-config using MacPorts.

First, I get and build zeromq2:

git clone git://github.com/zeromq/zeromq2.git
cd zeromq2  # current commit is 2970d6c30b1f57e9a75d46982378b103899bddbc
./autogen.sh && ./configure && make && sudo make install && echo ":: ALL OK ::"
cd ..
ls -al /usr/local/lib/libzmq.*

Output of 'ls -al':

-rwxr-xr-x  1 root  wheel   348920 Mar 14 13:14 /usr/local/lib/libzmq.1.dylib
-rw-r--r--  1 root  wheel  6306760 Mar 14 13:14 /usr/local/lib/libzmq.a
lrwxr-xr-x  1 root  wheel       14 Mar 14 13:14 /usr/local/lib/libzmq.dylib -> libzmq.1.dylib
-rwxr-xr-x  1 root  wheel      912 Mar 14 13:14 /usr/local/lib/libzmq.la

Then, I get and build jzmq:

git clone git://github.com/zeromq/jzmq.git
cd jzmq  # current commit is 522d7474effe8c96dfaece51e739eda9189bad45
export JAVA_HOME="$(/usr/libexec/java_home)"  # /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
./autogen.sh && ./configure && make && sudo make install && echo ":: ALL OK ::"
cd ..
ls -al /usr/local/lib/*jzmq* /usr/local/share/java/*zmq*

Output of 'ls -al':

-rwxr-xr-x  1 root  wheel   27600 Mar 14 13:42 /usr/local/lib/libjzmq.0.dylib
-rw-r--r--  1 root  wheel  279448 Mar 14 13:42 /usr/local/lib/libjzmq.a
lrwxr-xr-x  1 root  wheel      15 Mar 14 13:42 /usr/local/lib/libjzmq.dylib -> libjzmq.0.dylib
-rwxr-xr-x  1 root  wheel     943 Mar 14 13:42 /usr/local/lib/libjzmq.la
-rw-r--r--  1 root  wheel   10268 Mar 14 13:42 /usr/local/share/java/zmq.jar

Then, I build and run HelloWorldClient.java:

javac -classpath /usr/local/share/java/zmq.jar HelloWorldClient.java
java -classpath .:/usr/local/share/java/zmq.jar -Djava.library.path=/usr/local/lib HelloWorldClient

This client runs, and I can now e.g. start a server or communicate interactively using a Python console with PyZMQ.

from jzmq.

felixrabe avatar felixrabe commented on September 27, 2024

I've also tried:
mvn clean install
But both the included tests also fail with UnsatisfiedLinkError.

from jzmq.

felixrabe avatar felixrabe commented on September 27, 2024

mvn -version -> 2.2.1

from jzmq.

gonzus avatar gonzus commented on September 27, 2024

I don't use (nor have I ever used) OSX. But let's assume it is just another flavor of Linux (I mean, Unix). The jzmq JAR (zmq.jar) requires two other components to work properly: the native 0MQ shared library (libzmq.so), the same thing used by any regular C/C++ program, and a bridge shared library (jzmq.so) that allows the Java 0MQ classes to interface with the native 0MQ shared library.

With that out of the way, I would try the following:

  1. Put zmq.jar, jzmq.so and libzmq.so in a place that you are POSITIVE will make things work. I am thinking of /usr/local/lib or even /usr/lib. Make sure a minimal test program actually does work.
  2. Once that works, move things to your CWD and try the same minimal program there.
  3. One that works, move things to wherever you really want to put them, and make that work.

Apologies if these instructions seem too basic; this is really the way I would approach diagnosing this. Please let me know how it goes.

from jzmq.

abelaska avatar abelaska commented on September 27, 2024

I've found this link http://blog.pmorelli.com/getting-zeromq-and-jzmq-running-on-mac-os-x in discussion for issue 6 https://github.com/zeromq/jzmq/issues/closed#issue/6

Maybe it will help you.

from jzmq.

gonzus avatar gonzus commented on September 27, 2024

Felix, have you had any progress? I am trying to close issues that have already been solved.

from jzmq.

felixrabe avatar felixrabe commented on September 27, 2024

gonzus: Thanks for responding! I will report back in the next few days with more details, following your checklist. Please give me another week or so, I've already been trying three times over the course of a month to get this to work without success.

abelaska: I think I've looked at pretty much everything that Google gave me for "jzmq osx", but I'll have another look at that link to check that I haven't forgotten anything. I think I've got the pkg-config and Java Development Kit parts right though.

I will install it all again and come back with more detailed notes.

from jzmq.

gonzus avatar gonzus commented on September 27, 2024

Felix, this is great news. Perhaps you could add this documentation to the proper section in http://www.zeromq.org/docs:tuning-zeromq (I think that is the proper place). Thanks for the update.

from jzmq.

felixrabe avatar felixrabe commented on September 27, 2024

Gonzus, thanks for the feedback. Feel free to add a link to this issue there, as I don't have an account there.

By the way, HelloWorldClient.java mentioned above is https://github.com/imatix/zguide/blob/609b4255d87287a42932392db1d50256c1b878ae/examples/Java/hwclient.java

from jzmq.

lt-schmidt-jr avatar lt-schmidt-jr commented on September 27, 2024

As a note:
On Mac, I found that I prefer using Homebrew over MacPorts, as many of the ports are stale.
Cheers.

from jzmq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.