Closed minad closed 8 years ago
@minad Is this still a problem?
Yes sure, if you didn't change it.
Did you do some change to the library lookup? Can you point me to the place then I check it quickly.
I did not change anything. Parsing ld.so.conf is going to be a bit too much, but if there is a new “well known” path used by your linux I can easily add it to the gem.
On Jan 28, 2015, at 1:18 PM, Daniel Mendler notifications@github.com wrote:
Did you do some change to the library lookup? Can you point me to the place then I check it quickly.
— Reply to this email directly or view it on GitHub https://github.com/chuckremes/ffi-rzmq/issues/114#issuecomment-71896886.
@chuckremes why are you hardcoding the library paths at all in ffi-rzmq-core
? Why not just use ffi_lib 'zmq'
by default and let the system loader do its thing? For example hardcoding everything breaks LD_LIBRARY_PATH=/path/to/custom/libzmq ruby zmqapp.rb
I noticed this because I'm trying to workaround #121 but setting my LD_LIBRARY_PATH
to libzmq3 doesn't work.
In fact I was able to fix my issue locally by hacking on the installed ffi-rzmq-core.
Before
~/git/zguide/examples/Ruby
$ LD_LIBRARY_PATH=~/git/zeromq3-x/src/.libs/ ruby identity.rb
------------------------------------
Bad address (src/fq.cpp:91)
Aborted (core dumped)
Change
# Search for libzmq in the following order...
# ZMQ_LIB_PATHS = ([inside_gem] + local_path + [
# '/usr/local/lib', '/opt/local/lib', homebrew_path, '/usr/lib64'
# ]).compact.map{|path| "#{path}/libzmq.#{FFI::Platform::LIBSUFFIX}"}
# ffi_lib(ZMQ_LIB_PATHS + %w{libzmq})
ffi_lib('zmq')
After
~/git/zguide/examples/Ruby
$ LD_LIBRARY_PATH=~/git/zeromq3-x/src/.libs/ ruby identity.rb
------------------------------------
Identity: kEg
Data: ROUTER uses a generated 5 byte identity
------------------------------------
Identity: PEER2
Data: Router uses socket identity
The original reasons are escaping me but I think it had to do with #ffi_lib not behaving the same across MRI, JRuby and Rubinius. If they are all in synch with how they work now, then we could probably change this. I’d also want to verify that it works correctly on Windows.
Feel like testing it out and submitting a patch?
On Jul 31, 2015, at 10:58, Dylan Cali notifications@github.com wrote:
@chuckremes https://github.com/chuckremes why are you hardcoding the library paths at all in ffi-rzmq-core? Why not just use the ffi_lib 'zmq' by default and let the system loader do its thing? For example hardcoding everything breaks LD_LIBRARY_PATH=/path/to/custom/libzmq ruby zmqapp.rb
I noticed this because I'm trying to workaround #121 https://github.com/chuckremes/ffi-rzmq/issues/121 but setting my LD_LIBRARY_PATH to libzmq3 doesn't work.
ref: https://github.com/chuckremes/ffi-rzmq-core/blob/ed352ac2315ebce9bbec866638e7f5256a95b71e/lib/ffi-rzmq-core/libzmq.rb#L34 https://github.com/chuckremes/ffi-rzmq-core/blob/ed352ac2315ebce9bbec866638e7f5256a95b71e/lib/ffi-rzmq-core/libzmq.rb#L34 — Reply to this email directly or view it on GitHub https://github.com/chuckremes/ffi-rzmq/issues/114#issuecomment-126733995.
Honestly I'm not sure I'll have the time (I also don't have the ability to test on windows).
I'm actually not a Ruby guy, this just happened to come up while I was working on the zeromq guide (I'm the author of the ffi bindings for Perl, and as I add new examples I try to make sure they're consistent across languages).
All that said, if no one else takes this and some time opens up for me I'll try to take a look.
Under debian wheezy this gem doesn't work without patching.
The relevant shared object is at /usr/lib/x86_64-linux-gnu/libzmq.so.3.0.0 which is not found. Do you have an idea on how to improve the search for the shared object? For example not looking at fixed paths but at the paths in /etc/ld.so.conf. This will fix many problems with https://github.com/minad/iruby that people had with the installation.
Also there should be a way to handle these version suffices, like .3.0.0
I think other FFI-gems have the same issues. Maybe look there.