webp-ffi: Error installing on MacOS

I’ve sucessfully installed the dependencies via brew…

Installing webp-ffi 0.2.5 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/viegas/.rvm/rubies/ruby-2.2.4/bin/ruby -rubygems /Users/viegas/.rvm/gems/ruby-2.2.4/gems/rake-12.0.0/exe/rake RUBYARCHDIR=/Users/viegas/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-15/2.2.0/webp-ffi-0.2.5 RUBYLIBDIR=/Users/viegas/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-15/2.2.0/webp-ffi-0.2.5
mkdir -p x86_64-darwin
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -DHAVE_PUTS=1 -DHAVE_WEBPDECODERCONFIG=1 -DHAVE_WEBPGETINFO=1 -DHAVE_STDIO_H=1 -o x86_64-darwin/jpegdec.o -c ./jpegdec.c
In file included from ./jpegdec.c:1:
././jpegdec.h:3:10: fatal error: 'webp/encode.h' file not found
#include "webp/encode.h"
         ^
1 error generated.
rake aborted!
Command failed with status (1): [gcc -fexceptions -O -fno-omit-frame-pointe...]
/Users/viegas/.rvm/gems/ruby-2.2.4/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in `block (2 levels) in define_task!'
/Users/viegas/.rvm/gems/ruby-2.2.4/gems/rake-12.0.0/exe/rake:27:in `<main>'
Tasks: TOP => default => x86_64-darwin/libwebp_ffi.bundle => x86_64-darwin/jpegdec.o
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/viegas/.rvm/gems/ruby-2.2.4/gems/webp-ffi-0.2.5 for inspection.
Results logged to /Users/viegas/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-15/2.2.0/webp-ffi-0.2.5/gem_make.out

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 22 (10 by maintainers)

Most upvoted comments

@le0pard Thanks so much for the quick reply. The final working configs are

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib:/opt/homebrew/lib/
export CPATH=$CPATH:/usr/local/include:/opt/homebrew/include/

And bumping to > 0.3.1

sudo apt install libwebp-dev

Or just add in bashrc/zshrc

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
export CPATH=$CPATH:/usr/local/include

Having the same issue on an Apple M1

> ruby -v
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [arm64-darwin21]

> brew info webp 
webp: stable 1.2.1 (bottled), HEAD
Image format providing lossless and lossy compression for web images
https://developers.google.com/speed/webp/
/opt/homebrew/Cellar/webp/1.2.1_1 (41 files, 2.2MB) *
  Poured from bottle on 2021-11-21 at 16:00:44
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/webp.rb
License: BSD-3-Clause
==> Dependencies
Required: giflib ✔, jpeg ✔, libpng ✔, libtiff ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 375,452 (30 days), 905,180 (90 days), 2,487,458 (365 days)
install-on-request: 13,747 (30 days), 31,008 (90 days), 76,414 (365 days)
build-error: 9 (30 days)

This returns the identical running error from above. I tried installing webp on both x86 and arm64 brews too. Same results.

Any ideas?