webp-ffi: Error installing on Heroku

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.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

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

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

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!