le0pard / webp-ffi

Ruby wrapper for libwebp
https://leopard.in.ua/webp-ffi/
MIT License
113 stars 14 forks source link

Error installing gem on Travis #13

Closed marcoschicote closed 8 years ago

marcoschicote commented 8 years ago

Hi I get an error while installing the gem on TravisCI using container based infrastructure (which means I can't use sudo to install libwebp and imagemagick and that I'm restricted to Ubuntu 12.04 64bits).

I install libwebp and imagemagick doing the following:

before_install:
  - wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.3.tar.gz
  - tar -xzvf libwebp-0.4.3.tar.gz
  - cd libwebp-0.4.3 && ./configure --prefix=$HOME/libwep/ && make && make install && cd ..
  - wget http://www.imagemagick.org/download/ImageMagick.tar.gz
  - tar -xzvf ImageMagick.tar.gz
  - cd ImageMagick-* && ./configure CPPFLAGS="-I$HOME/libwep/include" LDFLAGS="-L$HOME/libwep/lib" -prefix=$HOME/imagemagick && make && make install
  - export PATH=$PATH:$HOME/imagemagick/bin

I get the following error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    current directory: /home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/ext/webp_ffi
/home/travis/.rvm/rubies/ruby-2.3.0/bin/ruby -rubygems /home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/bin/rake RUBYARCHDIR=/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/webp-ffi-0.2.5 RUBYLIBDIR=/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/webp-ffi-0.2.5
mkdir -p x86_64-linux
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -DHAVE_PUTS=1 -DHAVE_STDIO_H=1 -o x86_64-linux/jpegdec.o -c ./jpegdec.c
In file included from ./jpegdec.c:1:0:
././jpegdec.h:3:25: fatal error: webp/encode.h: No such file or directory
compilation terminated.
rake aborted!
Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/ffi-compiler-0.1.3/lib/ffi-compiler/compile_task.rb:114:in `block (2 levels) in define_task!'
Tasks: TOP => default => x86_64-linux/libwebp_ffi.so => x86_64-linux/jpegdec.o
(See full trace by running task with --trace)
rake failed, exit code 1

Any ideas? Thanks!

le0pard commented 8 years ago

Look how it work for tests in webp-ffi - https://github.com/le0pard/webp-ffi/blob/master/.travis.yml

marcoschicote commented 8 years ago

Thanks @le0pard ! Bundle finished correctly but now I get the following error when I try to prepare the DB:

LoadError: Could not open library '/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/ext/webp_ffi/x86_64-linux/libwebp_ffi.so': libwebp.so.5: cannot open shared object file: No such file or directory
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `map'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `ffi_lib'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/lib/webp_ffi.rb:7:in `<module:C>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/lib/webp_ffi.rb:5:in `<module:WebP>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/lib/webp_ffi.rb:4:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/models/shared/concerns/webp_preprocessor.rb:1:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:in `require_or_load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/uploaders/shared/avatar_uploader.rb:3:in `<class:AvatarUploader>'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/uploaders/shared/avatar_uploader.rb:2:in `<module:Shared>'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/uploaders/shared/avatar_uploader.rb:1:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:in `require_or_load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/models/shared/user.rb:42:in `<class:User>'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/models/shared/user.rb:2:in `<module:Shared>'
/home/travis/build/tobuy/tobuy-api/apps/shared/app/models/shared/user.rb:1:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:in `require_or_load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:263:in `const_get'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:263:in `block in constantize'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `each'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `inject'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `constantize'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:566:in `get'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:597:in `constantize'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise.rb:287:in `get'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/mapping.rb:81:in `to'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/mapping.rb:76:in `modules'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/mapping.rb:93:in `routes'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/mapping.rb:156:in `default_used_route'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/mapping.rb:70:in `initialize'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise.rb:321:in `new'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise.rb:321:in `add_mapping'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/rails/routes.rb:224:in `block in devise_for'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/rails/routes.rb:223:in `each'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/devise-3.5.2/lib/devise/rails/routes.rb:223:in `devise_for'
/home/travis/build/tobuy/tobuy-api/apps/public/config/routes.rb:2:in `block in <top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:601:in `instance_exec'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:601:in `block in with_default_scope'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:816:in `scope'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:600:in `with_default_scope'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:421:in `eval_block'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:401:in `draw'
/home/travis/build/tobuy/tobuy-api/apps/public/config/routes.rb:1:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `each'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/file_update_checker.rb:75:in `execute'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:27:in `updater'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
/home/travis/build/tobuy/tobuy-api/config/environment.rb:5:in `<top (required)>'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
/home/travis/build/tobuy/tobuy-api/vendor/bundle/ruby/2.3.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/home/travis/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.0/bin/bundle:23:in `load'
/home/travis/.rvm/gems/ruby-2.3.0/bin/bundle:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
le0pard commented 8 years ago

Try to change env vars:

  - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib
marcoschicote commented 8 years ago

Thanks @le0pard ! After a few attempts this finally worked:

before_install:
  - wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.3.tar.gz
  - tar -xzvf libwebp-0.4.3.tar.gz
  - cd libwebp-0.4.3 && ./configure --prefix=$HOME/libwebp && make && make install && cd ..
  - export LD_FLAGS=-L$HOME/libwebp/lib
  - export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/libwebp/lib
  - export CPATH=$CPATH:$HOME/libwebp/include
  - wget http://www.imagemagick.org/download/ImageMagick.tar.gz
  - tar -xzvf ImageMagick.tar.gz
  - cd ImageMagick-* && ./configure CPPFLAGS="-I$HOME/libwebp/include" LDFLAGS="-L$HOME/libwebp/lib" -prefix=$HOME/imagemagick && make && make install && cd ..
  - export PATH=$PATH:$HOME/imagemagick/bin