Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open libzmq.so.3, needs relative rpath using '$ORIGIN' #43

Open
ackalker opened this issue Aug 6, 2015 · 0 comments
Open

Cannot open libzmq.so.3, needs relative rpath using '$ORIGIN' #43

ackalker opened this issue Aug 6, 2015 · 0 comments

Comments

@ackalker
Copy link

ackalker commented Aug 6, 2015

This is not working with version 1.7.9 on Arch Linux x86_64, rbzmq installed as a dependency of iruby, which itself was installed user-local using $ gem install iruby.

Test:

$ LD_DEBUG=libs irb
[...snip libraries loaded during startup of irb itself...]
irb(main):001:0> require 'zmq'
     18609: find library=libzmq.so.3 [0]; searching
     18609:  search path=ext/rbczmq/dst/lib/tls/x86_64:ext/rbczmq/dst/lib/tls:ext/rbczmq/dst/lib/x86_64:ext/rbczmq/dst/lib      (RPATH from file /home/miki/.gem/ruby/2.2.0/extensions/x86_64-linux/2.2.0/rbczmq-1.7.9/rbczmq_ext.so)
     18609:   trying file=ext/rbczmq/dst/lib/tls/x86_64/libzmq.so.3
     18609:   trying file=ext/rbczmq/dst/lib/tls/libzmq.so.3
     18609:   trying file=ext/rbczmq/dst/lib/x86_64/libzmq.so.3
     18609:   trying file=ext/rbczmq/dst/lib/libzmq.so.3
     18609:  search cache=/etc/ld.so.cache
     18609:  search path=/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/x86_64:/usr/lib(system search path)
     18609:   trying file=/usr/lib/tls/x86_64/libzmq.so.3
     18609:   trying file=/usr/lib/tls/libzmq.so.3
     18609:   trying file=/usr/lib/x86_64/libzmq.so.3
     18609:   trying file=/usr/lib/libzmq.so.3
     18609:
LoadError: libzmq.so.3: cannot open shared object file: No such file or directory - /home/miki/.gem/ruby/2.2.0/extensions/x86_64-linux/2.2.0/rbczmq-1.7.9/rbczmq_ext.so
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/miki/.gem/ruby/2.2.0/gems/rbczmq-1.7.9/lib/zmq.rb:9:in `rescue in <top (required)>'
    from /home/miki/.gem/ruby/2.2.0/gems/rbczmq-1.7.9/lib/zmq.rb:6:in `<top (required)>'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from (irb):1
    from /usr/bin/irb:11:in `<main>'
irb(main):002:0>

Please consider linking using -Wl,-R,'$ORIGIN/../path/to/libdir' (note single-quotes to protect it from the shell!) to resolve this. The $ORIGIN path specifies the directory path of one shared library relative to that of another.

Please have a look at the first answer to this SO question: http://stackoverflow.com/questions/3960641/how-to-link-to-shared-lib-from-shared-lib-with-relative-path .

bwalex added a commit to bwalex/rbczmq that referenced this issue Oct 25, 2015
Statically link against libzmq, czmq and libsodium, to avoid issues with
dynamic linking of libzmq (see e.g. methodmissing#43).

Whilst on it (mainly because the existing versions of czmq/libzmq were
being a PITA to get to link statically properly), also bump the versions
of libzmq and czmq.

With czmq now being at API v3, also adjust the extension to be
compatible with it. It still uses a fair number of deprecated APIs, but
it absolutely works with API v3.

Fixes methodmissing#43
Fixes methodmissing#45 (hopefully)
Fixes methodmissing#47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant