le0pard/webp-ffi

Error installing on Heroku

cmwendwa opened this issue · 29 comments

Have an issue installing sprockets-webp gem which arises from it requiring webp-ffi 0.2.5. The stack trace is

remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote:
remote:
remote:        current directory:
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5/ext/webp_ffi
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/ruby-2.3.0/bin/ruby -rubygems
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake
remote:
remote:        RUBYARCHDIR=/tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/webp-ffi-0.2.5
remote:
remote:        RUBYLIBDIR=/tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/webp-ffi-0.2.5
remote:
remote:        mkdir -p x86_64-linux
remote:
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:
remote:        -o x86_64-linux/pngdec.o -c ./pngdec.c
remote:
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:
remote:        -o x86_64-linux/tiffdec.o -c ./tiffdec.c
remote:
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:
remote:        -o x86_64-linux/util.o -c ./util.c
remote:
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:
remote:        -o x86_64-linux/webp_ffi.o -c ./webp_ffi.c
remote:
remote:        gcc -shared -o x86_64-linux/libwebp_ffi.so x86_64-linux/jpegdec.o
remote:
remote:        x86_64-linux/pngdec.o x86_64-linux/tiffdec.o x86_64-linux/util.o
remote:
remote:        x86_64-linux/webp_ffi.o -fexceptions -lz -lwebp -lpng -ljpeg -ltiff
remote:
remote:        /usr/bin/ld:
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/.apt/usr/lib/x86_64-linux-gnu/libpng.a(libpng12_la-png.o):
remote:
remote:        relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a
remote:
remote:        shared object; recompile with -fPIC
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/.apt/usr/lib/x86_64-linux-gnu/libpng.a:
remote:
remote:        error adding symbols: Bad value
remote:
remote:        collect2: error: ld returned 1 exit status
remote:
remote:        rake aborted!
remote:
remote:        Command failed with status (1): [gcc -shared -o x86_64-linux/libwebp_ffi.so...]
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:153:in
remote:
remote:        `block in define_task!'
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in
remote:
remote:        `<main>'
remote:
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so
remote:
remote:        (See full trace by running task with --trace)
remote:
remote:
remote:
remote:        rake failed, exit code 1
remote:
remote:
remote:
remote:        Gem files will remain installed in
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/gems/webp-ffi-0.2.5
remote:
remote:        for inspection.
remote:
remote:        Results logged to
remote:
remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/webp-ffi-0.2.5/gem_make.out
remote:
remote:
remote:
remote:        An error occurred while installing webp-ffi (0.2.5), and Bundler cannot
remote:
remote:        continue.
remote:
remote:        Make sure that `gem install webp-ffi -v '0.2.5'` succeeds before bundling.
remote:
remote:
remote:
remote:        In Gemfile:
remote:
remote:          sprockets-webp was resolved to 0.3.2, which depends on
remote:
remote:            webp-ffi
remote:
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to c-test-deployment.
remote:
To https://git.heroku.com/c-test-deployment.git

I used apt-buildpack to install libjpeg-dev, libpng-dev, libtiff-dev and libwebp-dev then used this buildpack to install libwebp.

remote:        /tmp/build_5d794d5d69686126964a581ea9c0aa89/.apt/usr/lib/x86_64-linux-gnu/libpng.a:
remote:
remote:        error adding symbols: Bad value

Looks like libpng lib broken and cannot be linked to webp-ffi

Also added tests for new rubies - https://travis-ci.org/le0pard/webp-ffi/builds/361785827 - looks like all pass

Have you found any solution to this? I am having the same issue.

Have same problem

remote:        current directory:
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.5/ext/webp_ffi
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/ruby-2.5.3/bin/ruby
remote:        -rrubygems
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake
remote:        RUBYARCHDIR=/tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5
remote:        RUBYLIBDIR=/tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5
remote:        mkdir -p x86_64-linux
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:        In file included from ./jpegdec.c:1:0:
remote:        ././jpegdec.h:3:10: fatal error: webp/encode.h: No such file or directory
remote:         #include "webp/encode.h"
remote:                  ^~~~~~~~~~~~~~~
remote:        compilation terminated.
remote:        rake aborted!
remote:        Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in
remote:        `block (2 levels) in define_task!'
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so => x86_64-linux/jpegdec.o
remote:        (See full trace by running task with --trace)
remote:        
remote:        rake failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.5
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5/gem_make.out
remote:        
remote:        An error occurred while installing webp-ffi (0.2.5), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.5' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote:        Bundler Output: Fetching gem metadata from https://rubygems.org/........
remote:        Fetching rake 12.3.2
remote:        Installing rake 12.3.2
remote:        Fetching thread_safe 0.3.6
remote:        Fetching ice_nine 0.11.2
remote:        Using bundler 2.0.1
remote:        Fetching dotenv 2.7.2
remote:        Installing ice_nine 0.11.2
remote:        Installing dotenv 2.7.2
remote:        Installing thread_safe 0.3.6
remote:        Fetching equalizer 0.0.11
remote:        Installing equalizer 0.0.11
remote:        Fetching multipart-post 2.1.1
remote:        Installing multipart-post 2.1.1
remote:        Fetching ffi 1.11.1
remote:        Fetching inflecto 0.0.2
remote:        Fetching faraday 0.15.4
remote:        Installing inflecto 0.0.2
remote:        Installing faraday 0.15.4
remote:        Installing ffi 1.11.1 with native extensions
remote:        Fetching descendants_tracker 0.0.4
remote:        Installing descendants_tracker 0.0.4
remote:        Fetching axiom-types 0.1.1
remote:        Fetching coercible 1.0.0
remote:        Installing axiom-types 0.1.1
remote:        Installing coercible 1.0.0
remote:        Fetching virtus 1.0.5
remote:        Installing virtus 1.0.5
remote:        Fetching telegram-bot-ruby 0.9.1
remote:        Installing telegram-bot-ruby 0.9.1
remote:        Fetching ffi-compiler 1.0.1
remote:        Installing ffi-compiler 1.0.1
remote:        Fetching webp-ffi 0.2.5
remote:        Installing webp-ffi 0.2.5 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        current directory:
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.5/ext/webp_ffi
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/ruby-2.5.3/bin/ruby
remote:        -rrubygems
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake
remote:        RUBYARCHDIR=/tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5
remote:        RUBYLIBDIR=/tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5
remote:        mkdir -p x86_64-linux
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:        In file included from ./jpegdec.c:1:0:
remote:        ././jpegdec.h:3:10: fatal error: webp/encode.h: No such file or directory
remote:         #include "webp/encode.h"
remote:                  ^~~~~~~~~~~~~~~
remote:        compilation terminated.
remote:        rake aborted!
remote:        Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in
remote:        `block (2 levels) in define_task!'
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so => x86_64-linux/jpegdec.o
remote:        (See full trace by running task with --trace)
remote:        
remote:        rake failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.5
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_e5984f48182ef23997b9eeb8404f9379/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.5/gem_make.out
remote:        
remote:        An error occurred while installing webp-ffi (0.2.5), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.5' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to convert-sticker.
remote: 
To https://git.heroku.com/convert-sticker.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/convert-sticker.git'

done:
bundle install
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
different version
problem isn`t solved

@transfer76 what libwebp version installed by apt?

such versiion is installed by apt libwebp-dev:am 0.4.4-1 amd64 Lossy compression of digital phot

@transfer76

$ apt show libwebp-dev
Package: libwebp-dev
Priority: extra
Section: libdevel
Installed-Size: 740 kB
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Jeff Breidenbach <jab@debian.org>
Source: libwebp
Version: 0.4.0-4

Compiled fine last gem version. Also on CI tested 0.4.4 and 1.0.2 - https://github.com/le0pard/webp-ffi/blob/master/.travis.yml#L22-L23

Looks like from error

fatal error: webp/encode.h: No such file or directory

compiler cannot locate header files. Can you locate them?

$ ls -lah /usr/include/webp/
total 108K
drwxr-xr-x  2 root root 4.0K Jul 24  2018 .
drwxr-xr-x 44 root root  20K Apr 30 12:32 ..
-rw-r--r--  1 root root  23K Jan 13  2014 decode.h
-rw-r--r--  1 root root 9.5K Jan 13  2014 demux.h
-rw-r--r--  1 root root  24K Jan 13  2014 encode.h
-rw-r--r--  1 root root  16K Jan 13  2014 mux.h
-rw-r--r--  1 root root 3.1K Jan 13  2014 mux_types.h
-rw-r--r--  1 root root 1.5K Jan 13  2014 types.h
total 120K
drwxr-xr-x  2 root root 4,0K тра 22 14:41 .
drwxr-xr-x 62 root root  20K тра 22 14:41 ..
-rw-r--r--  1 root root  23K лис 17  2015 decode.h
-rw-r--r--  1 root root 9,5K лис 17  2015 demux.h
-rw-r--r--  1 root root  26K лис 17  2015 encode.h
-rw-r--r--  1 root root  17K лис 17  2015 mux.h
-rw-r--r--  1 root root 3,1K лис 17  2015 mux_types.h
-rw-r--r--  1 root root 1,5K лис 17  2015 types.h
transfer@vb:~$ apt show libwebp-dev
Package: libwebp-dev
Version: 0.4.4-1
Priority: extra
Section: libdevel
Source: libwebp
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Jeff Breidenbach <jab@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 792 kB
Depends: libwebp5 (= 0.4.4-1), libwebpmux1 (= 0.4.4-1), libwebpdemux1 (= 0.4.4-1)
Homepage: http://webp.googlecode.com
Supported: 9m
Download-Size: 225 kB
APT-Manual-Installed: yes

@transfer76 ok, so files here. What about CPATH env? Maybe it missed and compiler don't know where to find header files. Try to do:

export CPATH=$CPATH:/usr/include

before install gem

....all the same)
done:
export CPATH=$CPATH:/usr/include
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
gem install webp-ffi
in directory of program -- bundle

result:

remote:        An error occurred while installing webp-ffi (0.2.5), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.5' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to convert-sticker.
remote: 
To https://git.heroku.com/convert-sticker.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/convert-sticker.git'

@transfer76 can you grab error trace?

le0pard, I`m very sorry) and how can I get trace?

@transfer76

#15 (comment) - should look like this one. Previous trace show, that compiler cannot find header files. Interesting, is a problem still the same?

Maybe export env variable not work for git push heroku deploy and reset for each command. You also can try to do:

CPATH=$CPATH:/usr/include gem install webp-ffi

Unfortunately the same problem. I `ve done CPATH=$CPATH:/usr/include gem install webp-ffi and then ```bundle```

git push heroku master
Counting objects: 74, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (67/67), done.
Writing objects: 100% (74/74), 14.79 KiB | 0 bytes/s, done.
Total 74 (delta 34), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby
remote: -----> Using Ruby version: ruby-2.5.3
remote: -----> Installing dependencies using bundler 2.0.1
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Fetching gem metadata from https://rubygems.org/.......
remote:        Fetching rake 12.3.2
remote:        Installing rake 12.3.2
remote:        Fetching ast 2.4.0
remote:        Fetching thread_safe 0.3.6
remote:        Fetching ice_nine 0.11.2
remote:        Installing ast 2.4.0
remote:        Installing ice_nine 0.11.2
remote:        Installing thread_safe 0.3.6
remote:        Using bundler 2.0.1
remote:        Fetching dotenv 2.7.2
remote:        Installing dotenv 2.7.2
remote:        Fetching equalizer 0.0.11
remote:        Installing equalizer 0.0.11
remote:        Fetching multipart-post 2.1.1
remote:        Fetching ffi 1.11.1
remote:        Installing multipart-post 2.1.1
remote:        Fetching inflecto 0.0.2
remote:        Installing inflecto 0.0.2
remote:        Fetching jaro_winkler 1.5.2
remote:        Installing jaro_winkler 1.5.2 with native extensions
remote:        Installing ffi 1.11.1 with native extensions
remote:        Fetching parallel 1.17.0
remote:        Installing parallel 1.17.0
remote:        Fetching rainbow 3.0.0
remote:        Installing rainbow 3.0.0
remote:        Fetching ruby-progressbar 1.10.0
remote:        Installing ruby-progressbar 1.10.0
remote:        Fetching unicode-display_width 1.6.0
remote:        Installing unicode-display_width 1.6.0
remote:        Fetching parser 2.6.3.0
remote:        Installing parser 2.6.3.0
remote:        Fetching descendants_tracker 0.0.4
remote:        Installing descendants_tracker 0.0.4
remote:        Fetching faraday 0.15.4
remote:        Installing faraday 0.15.4
remote:        Fetching axiom-types 0.1.1
remote:        Installing axiom-types 0.1.1
remote:        Fetching coercible 1.0.0
remote:        Installing coercible 1.0.0
remote:        Fetching virtus 1.0.5
remote:        Installing virtus 1.0.5
remote:        Fetching telegram-bot-ruby 0.9.1
remote:        Installing telegram-bot-ruby 0.9.1
remote:        Fetching rubocop 0.70.0
remote:        Installing rubocop 0.70.0
remote:        Fetching ffi-compiler 1.0.1
remote:        Installing ffi-compiler 1.0.1
remote:        Fetching webp-ffi 0.2.7
remote:        Installing webp-ffi 0.2.7 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        current directory:
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7/ext/webp_ffi
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/ruby-2.5.3/bin/ruby
remote:        -rrubygems
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake
remote:        RUBYARCHDIR=/tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        RUBYLIBDIR=/tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        mkdir -p x86_64-linux
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:        In file included from ./jpegdec.c:1:0:
remote:        ././jpegdec.h:3:10: fatal error: webp/encode.h: No such file or directory
remote:         #include "webp/encode.h"
remote:                  ^~~~~~~~~~~~~~~
remote:        compilation terminated.
remote:        rake aborted!
remote:        Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in
remote:        `block (2 levels) in define_task!'
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so => x86_64-linux/jpegdec.o
remote:        (See full trace by running task with --trace)
remote:        
remote:        rake failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7/gem_make.out
remote:        
remote:        An error occurred while installing webp-ffi (0.2.7), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.7' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote:        Bundler Output: Fetching gem metadata from https://rubygems.org/.......
remote:        Fetching rake 12.3.2
remote:        Installing rake 12.3.2
remote:        Fetching ast 2.4.0
remote:        Fetching thread_safe 0.3.6
remote:        Fetching ice_nine 0.11.2
remote:        Installing ast 2.4.0
remote:        Installing ice_nine 0.11.2
remote:        Installing thread_safe 0.3.6
remote:        Using bundler 2.0.1
remote:        Fetching dotenv 2.7.2
remote:        Installing dotenv 2.7.2
remote:        Fetching equalizer 0.0.11
remote:        Installing equalizer 0.0.11
remote:        Fetching multipart-post 2.1.1
remote:        Fetching ffi 1.11.1
remote:        Installing multipart-post 2.1.1
remote:        Fetching inflecto 0.0.2
remote:        Installing inflecto 0.0.2
remote:        Fetching jaro_winkler 1.5.2
remote:        Installing jaro_winkler 1.5.2 with native extensions
remote:        Installing ffi 1.11.1 with native extensions
remote:        Fetching parallel 1.17.0
remote:        Installing parallel 1.17.0
remote:        Fetching rainbow 3.0.0
remote:        Installing rainbow 3.0.0
remote:        Fetching ruby-progressbar 1.10.0
remote:        Installing ruby-progressbar 1.10.0
remote:        Fetching unicode-display_width 1.6.0
remote:        Installing unicode-display_width 1.6.0
remote:        Fetching parser 2.6.3.0
remote:        Installing parser 2.6.3.0
remote:        Fetching descendants_tracker 0.0.4
remote:        Installing descendants_tracker 0.0.4
remote:        Fetching faraday 0.15.4
remote:        Installing faraday 0.15.4
remote:        Fetching axiom-types 0.1.1
remote:        Installing axiom-types 0.1.1
remote:        Fetching coercible 1.0.0
remote:        Installing coercible 1.0.0
remote:        Fetching virtus 1.0.5
remote:        Installing virtus 1.0.5
remote:        Fetching telegram-bot-ruby 0.9.1
remote:        Installing telegram-bot-ruby 0.9.1
remote:        Fetching rubocop 0.70.0
remote:        Installing rubocop 0.70.0
remote:        Fetching ffi-compiler 1.0.1
remote:        Installing ffi-compiler 1.0.1
remote:        Fetching webp-ffi 0.2.7
remote:        Installing webp-ffi 0.2.7 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        current directory:
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7/ext/webp_ffi
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/ruby-2.5.3/bin/ruby
remote:        -rrubygems
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake
remote:        RUBYARCHDIR=/tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        RUBYLIBDIR=/tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        mkdir -p x86_64-linux
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:        In file included from ./jpegdec.c:1:0:
remote:        ././jpegdec.h:3:10: fatal error: webp/encode.h: No such file or directory
remote:         #include "webp/encode.h"
remote:                  ^~~~~~~~~~~~~~~
remote:        compilation terminated.
remote:        rake aborted!
remote:        Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in
remote:        `block (2 levels) in define_task!'
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so => x86_64-linux/jpegdec.o
remote:        (See full trace by running task with --trace)
remote:        
remote:        rake failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_bd367ce3dc4faa2517d0d631bd6ec86f/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7/gem_make.out
remote:        
remote:        An error occurred while installing webp-ffi (0.2.7), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.7' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to convert-sticker.
remote: 
To https://git.heroku.com/convert-sticker.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/convert-sticker.git'

I tryed to change gem version to 0.2.5
All the same

On another computer I`ve installed latest version Ubuntu 18.04 LTS, have done all the step and all the same)

@transfer76 looks like I cannot test right now - new mac os break VirtualBox. Just updated system on CI to xenial - https://travis-ci.com/le0pard/webp-ffi/builds/113294788

Ок. I`ve one computer with VirtualBox Ubuntu 16.04 and other computer with native Ubuntu 18.04.

Just tested on clear ubuntu 18.04:

$ rvm install 2.6.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/18.04/x86_64/ruby-2.6.2.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system.....
Installing required packages: g++, gcc, autoconf, automake, bison, libc6-dev, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, make, pkg-config, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev.................................
Requirements installation successful.
...
$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
$ ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]
$ gem install pry webp-ffi
Fetching pry-0.12.2.gem
Fetching coderay-1.1.2.gem
Fetching method_source-0.9.2.gem
Successfully installed method_source-0.9.2
Successfully installed coderay-1.1.2
Successfully installed pry-0.12.2
Parsing documentation for method_source-0.9.2
Installing ri documentation for method_source-0.9.2
invalid options: -SNw2
(invalid options are ignored)
Parsing documentation for coderay-1.1.2
Installing ri documentation for coderay-1.1.2
Parsing documentation for pry-0.12.2
Installing ri documentation for pry-0.12.2
Done installing documentation for method_source, coderay, pry after 2 seconds
Fetching ffi-compiler-1.0.1.gem
Fetching ffi-1.11.1.gem
Fetching webp-ffi-0.2.7.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.11.1
Successfully installed ffi-compiler-1.0.1
Building native extensions. This could take a while...
Successfully installed webp-ffi-0.2.7
Parsing documentation for ffi-1.11.1
Installing ri documentation for ffi-1.11.1
Parsing documentation for ffi-compiler-1.0.1
Installing ri documentation for ffi-compiler-1.0.1
Parsing documentation for webp-ffi-0.2.7
Installing ri documentation for webp-ffi-0.2.7
Done installing documentation for ffi, ffi-compiler, webp-ffi after 7 seconds
6 gems installed
vagrant@ubuntu-bionic:~$ irb
2.6.2 :001 > require 'webp-ffi'
 => true
2.6.2 :002 > WebP.decoder_version
 => "0.6.1"
2.6.2 :003 >

Looks like no issues @transfer76

transfer@vb:~$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
[sudo] password for transfer: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libpng12-dev' instead of 'libpng-dev'
Note, selecting 'libtiff5-dev' instead of 'libtiff-dev'
libjpeg-dev is already the newest version (8c-2ubuntu8).
libwebp-dev is already the newest version (0.4.4-1).
libpng12-dev is already the newest version (1.2.54-1ubuntu1.1).
libtiff5-dev is already the newest version (4.0.6-1ubuntu0.6).
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic
  linux-headers-4.15.0-45 linux-headers-4.15.0-45-generic
  linux-headers-4.15.0-46 linux-headers-4.15.0-46-generic
  linux-headers-4.15.0-47 linux-headers-4.15.0-47-generic
  linux-image-4.15.0-29-generic linux-image-4.15.0-45-generic
  linux-image-4.15.0-46-generic linux-image-4.15.0-47-generic
  linux-modules-4.15.0-29-generic linux-modules-4.15.0-45-generic
  linux-modules-4.15.0-46-generic linux-modules-4.15.0-47-generic
  linux-modules-extra-4.15.0-47-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.
transfer@vb:~$ ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
transfer@vb:~$ gem install pry webp-ffi
Fetching pry-0.12.2.gem
Fetching coderay-1.1.2.gem
Successfully installed coderay-1.1.2
Successfully installed pry-0.12.2
Building native extensions. This could take a while...
Successfully installed webp-ffi-0.2.7
3 gems installed
transfer@vb:~$ irb
2.5.3 :001 > require 'webp-ffi'
 => true 
2.5.3 :002 > WebP.decoder_version
 => "0.4.4" 
2.5.3 :003 > exit

It works @transfer76 😄

don`t understand, why installed 3gems instead of 6 gems like yours example?

@transfer76 I added pry in list (if irb will not work)

$ gem install pry webp-ffi

yes, I saw) I used it also

@transfer76 looks like you already had ffi, ffi-compiler and method_source gems

Heroku loves take out brains! but problem is still exist)

I had the same problem. Here is the solution (working on heroku-18 stack):
1. Install heroku-buildpack-apt

heroku buildpacks:add --index 1 heroku-community/apt

2. Add Aptfile in the root with the following:

libwebp-dev
webp

I love this gem and have used it for a while, but this has always been a major problem for me. Unfortunately the solutions above did not solve it for me. Going to dig in further and see if I can find the issue.

remote:        Installing webp-ffi 0.2.7 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        current directory:
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7/ext/webp_ffi
remote:        /tmp/build_c473afa0/vendor/ruby-2.5.1/bin/ruby -rrubygems
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake
remote:        RUBYARCHDIR=/tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        RUBYLIBDIR=/tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7
remote:        mkdir -p x86_64-linux
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/jpegdec.o -c ./jpegdec.c
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/pngdec.o -c ./pngdec.c
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/tiffdec.o -c ./tiffdec.c
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/util.o -c ./util.c
remote:        gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
remote:        -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1
remote:        -o x86_64-linux/webp_ffi.o -c ./webp_ffi.c
remote:        gcc -shared -o x86_64-linux/libwebp_ffi.so x86_64-linux/jpegdec.o
remote:        x86_64-linux/pngdec.o x86_64-linux/tiffdec.o x86_64-linux/util.o
remote:        x86_64-linux/webp_ffi.o -fexceptions -lz -lwebp -lpng -ljpeg -ltiff
remote:        /usr/bin/ld: /tmp/build_c473afa0/.apt/usr/lib/x86_64-linux-gnu/libpng.a(png.o):
remote:        relocation R_X86_64_PC32 against symbol `png_user_version_check' can not be used
remote:        when making a shared object; recompile with -fPIC
remote:        /usr/bin/ld: final link failed: Bad value
remote:        collect2: error: ld returned 1 exit status
remote:        rake aborted!
remote:        Command failed with status (1): [gcc -shared -o x86_64-linux/libwebp_ffi.so...]
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:153:in
remote:        `block in define_task!'
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in
remote:        `<main>'
remote:        Tasks: TOP => default => x86_64-linux/libwebp_ffi.so
remote:        (See full trace by running task with --trace)
remote:        
remote:        rake failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/gems/webp-ffi-0.2.7 for inspection.
remote:        Results logged to
remote:        /tmp/build_c473afa0/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/webp-ffi-0.2.7/gem_make.out
remote:        
remote:        An error occurred while installing webp-ffi (0.2.7), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install webp-ffi -v '0.2.7' --source
remote:        'https://rubygems.org/'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:          webp-ffi
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 

Nevermind, it was my fault. If you do exactly as @jeremylynch described above, it will work. I had this in my Aptfile, (foolishly, I just figured the more the better):

libjpeg-dev 
libpng-dev 
libtiff-dev 
libwebp-dev
webp

But what you need are exactly

libwebp-dev
webp

And for whatever reason that works.

remote:        Installing webp-ffi 0.2.7 with native extensions
remote:        Bundle complete! 40 Gemfile dependencies, 138 gems now installed.

Thanks guys!

Looks like working solution is here - #15 (comment)