Comments (4)
The same problem you can see in Travis: https://travis-ci.org/le0pard/webp-ffi
from ffi-compiler.
It looks like WebPGetInfo() is defined in libwebp, and not in your library.
It also looks like linux does not re-export symbols from shared lib dependencies when building that shared lib.
What you need to do, is explicitly load libwebp via FFI, as well as your wrapper.
You can either use another module, and extend FFI::Library inside it, then ffi_lib, attach_function, etc, OR you can just tack it on to the end of your ffi_lib call.
e.g.
ffi_lib FFI::Compiler::Loader.find('webp_ffi'), 'webp'
from ffi-compiler.
Thanks, but right now I have another error:
$ rake
rm -r ext/webp_ffi/x86_64-linux/util.o
rm -r ext/webp_ffi/x86_64-linux/webp_ffi.o
rm -r ext/webp_ffi/x86_64-linux/libwebp_ffi.so
rm -r ext/webp_ffi/x86_64-linux/libwebp_ffi.so
rm -r ext/webp_ffi/x86_64-linux/util.o
rm -r ext/webp_ffi/x86_64-linux/webp_ffi.o
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -DHAVE_PUTS=1 -DHAVE_STDIO_H=1 -o ext/webp_ffi/x86_64-linux/util.o -c ext/webp_ffi/util.c
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -DHAVE_PUTS=1 -DHAVE_STDIO_H=1 -o ext/webp_ffi/x86_64-linux/webp_ffi.o -c ext/webp_ffi/webp_ffi.c
gcc -shared -o ext/webp_ffi/x86_64-linux/libwebp_ffi.so ext/webp_ffi/x86_64-linux/util.o ext/webp_ffi/x86_64-linux/webp_ffi.o -fexceptions -lz -lwebp
/home/vagrant/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -S rspec ./spec/webp_ffi_spec.rb
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/ffi-1.4.0/lib/ffi/library.rb:123:in `block in ffi_lib': Could not open library 'webp': webp: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libwebp.so': libwebp.so: cannot open shared object file: No such file or directory
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/ffi-1.4.0/lib/ffi/library.rb:90:in `map'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/ffi-1.4.0/lib/ffi/library.rb:90:in `ffi_lib'
from /vagrant/lib/webp_ffi.rb:7:in `<module:C>'
from /vagrant/lib/webp_ffi.rb:5:in `<module:WebpFfi>'
from /vagrant/lib/webp_ffi.rb:4:in `<top (required)>'
from /vagrant/spec/spec_helper.rb:3:in `require'
from /vagrant/spec/spec_helper.rb:3:in `<top (required)>'
from /vagrant/spec/webp_ffi_spec.rb:1:in `require'
from /vagrant/spec/webp_ffi_spec.rb:1:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/configuration.rb:819:in `load'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/configuration.rb:819:in `each'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/runner.rb:80:in `run'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/runner.rb:17:in `block in autorun'
rake aborted!
/home/vagrant/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -S rspec ./spec/webp_ffi_spec.rb failed
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/rake_task.rb:156:in `run_task'
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/rake_task.rb:124:in `block (2 levels) in initialize'
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.0/lib/rspec/core/rake_task.rb:122:in `block in initialize'
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
/home/vagrant/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => default => spec
(See full trace by running task with --trace)
But library exist:
$ ls -la /usr/local/lib/
total 4504
drwxr-xr-x 5 root root 4096 Mar 8 11:53 .
drwxr-xr-x 10 root root 4096 Jun 5 2012 ..
-rw-r--r-- 1 root root 2914584 Mar 8 11:53 libwebp.a
-rwxr-xr-x 1 root root 956 Mar 8 11:53 libwebp.la
lrwxrwxrwx 1 root root 16 Mar 8 11:53 libwebp.so -> libwebp.so.4.0.1
lrwxrwxrwx 1 root root 16 Mar 8 11:53 libwebp.so.4 -> libwebp.so.4.0.1
-rwxr-xr-x 1 root root 1669468 Mar 8 11:53 libwebp.so.4.0.1
drwxr-xr-x 2 root root 4096 Mar 8 11:53 pkgconfig
drwxrwsr-x 4 root staff 4096 Mar 8 11:02 python2.7
drwxr-xr-x 3 root root 4096 Mar 8 11:42 site_ruby
from ffi-compiler.
I found the problem, thanks!
sudo ln -s /usr/local/lib/libwebp.* /usr/lib/
from ffi-compiler.
Related Issues (12)
- The ffi-compiler on rubygems.org is too old HOT 4
- How to create stub lib to call methods from C++ dynamic library? HOT 4
- Is anyone interested in adding functionality/continuing support of ffi-compiler? HOT 4
- Fix hompage and LICENSE? HOT 1
- should ffi dependency be for 1.9.2+ because of license? HOT 1
- Cannot install with bundler or with gem -P HOT 1
- 1.2.0 seems to break some packages with arg splitting HOT 3
- Missing releases on rubygems.org HOT 9
- Breaking change between 1.3.1 and 1.0.1 HOT 4
- Cannot build 2 extensions HOT 4
- Compilation error if C files are found in a sub-folder HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffi-compiler.