filterfish / smith2

A complete rewrite of Smith
12 stars 7 forks source link

MIssing depencies for smith2 #35

Closed qnm closed 9 years ago

qnm commented 9 years ago

Hi,

When installing the smith2 gem, it appeared that the following dependencies are missing from the gemspec.

I derived these two gems from the error messages received from running bundle exec agency.

~/P/D/ci ❯❯❯ bundle exec agency
/Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ffi-1.9.6/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'gdbm': dlopen(gdbm, 5): image not found. (LoadError)
Could not open library 'libgdbm.dylib': dlopen(libgdbm.dylib, 5): image not found
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ffi-1.9.6/lib/ffi/library.rb:100:in `map'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ffi-1.9.6/lib/ffi/library.rb:100:in `ffi_lib'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gdbm-1.2/lib/gdbm.rb:24:in `<module:GDBM_FFI>'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gdbm-1.2/lib/gdbm.rb:22:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/lib/smith/agent_cache.rb:2:in `require'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/lib/smith/agent_cache.rb:2:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/bin/agency:10:in `require'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/bin/agency:10:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/bin/agency:23:in `load'
        from /Users/qnm/.rbenv/versions/2.1.2/bin/agency:23:in `<main>'
~/P/D/ci ❯❯❯ bundle exec agency
/Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gdbm-1.2/lib/gdbm.rb:19:in `require': cannot load such file -- ffi (LoadError)
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gdbm-1.2/lib/gdbm.rb:19:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/lib/smith/agent_cache.rb:2:in `require'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/lib/smith/agent_cache.rb:2:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/bin/agency:10:in `require'
        from /Users/qnm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/smith-0.6.5.2/bin/agency:10:in `<top (required)>'
        from /Users/qnm/.rbenv/versions/2.1.2/bin/agency:23:in `load'
        from /Users/qnm/.rbenv/versions/2.1.2/bin/agency:23:in `<main>'

I'm unsure which versions are required so I'm logging an issue rather than submitting a PR.

-- Rob

filterfish commented 9 years ago

This is a side effect of how you compiled the version of ruby you are using.

It gets confusing! gdbm is directly supported by ruby but only if you have the libgdbm-dev package (on Debian) installed when you compile ruby. The confusing part is that there is a gem called gdbm so people assume that this is the gem to use (I've fallen into that trap).

I'm not sure how best to deal with this, though.

Can you install gdbm (I would assume brew install gdbm) and recompile ruby. You should check that the headers are actually installed by brew, though having said that it's a source package management system so I guess it must install them! You should also check the output of configure which will tell you if it finds the headers.

If there is still a problem let me know and I'll look into it further.

qnm commented 9 years ago

A recompilation of ruby fixed the issue - thanks!

I'm not sure how best to deal with this, though.

Ideally we'd throw an exception when gdbm isn't detected, along with a short message advising the user how to proceed or perhaps linking to the wiki with what you've written above.