Closed gfviegas closed 7 years ago
Looks like webp not linked and macOs cannot find header files.
A friend of mine could get the gem working but he is on macOs 10.11. Mine is 10.12.
Brew installed and linked everything okay
for instance:
brew link webp
Warning: Already linked: /usr/local/Cellar/webp/0.5.2
Maybe this could be helpful:
☺ sw_vers -productVersion
10.12.2
☺ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
☺ gem install webp-ffi
Building native extensions. This could take a while...
Successfully installed webp-ffi-0.2.5
Parsing documentation for webp-ffi-0.2.5
Installing ri documentation for webp-ffi-0.2.5
Done installing documentation for webp-ffi after 0 seconds
1 gem installed
☺ brew info webp
webp: stable 0.5.2 (bottled), HEAD
Image format providing lossless and lossy compression for web images
https://developers.google.com/speed/webp/
/usr/local/Cellar/webp/0.5.2 (35 files, 1.8M) *
sw_vers -productVersion
10.12.2
ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
gem install webp-ffi
Building native extensions. This could take a while...
ERROR: Error installing webp-ffi:
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
@gfviegas this just show, what compiler cannot find header files of webp. Check CPATH
directories.
☺ echo $CPATH
:/usr/local/include
☺ ls /usr/local/include/webp
decode.h demux.h encode.h mux.h mux_types.h types.h
Okay, my echo $CPATH is not returning a thing.
echo $CPATH
ls /usr/local/include/webp
decode.h demux.h encode.h mux.h mux_types.h types.h
Maybe xcode-select --install
can help or something in your bashrc/zshrc unset this variable. Don't forget reload terminal after all this changes.
Or just add in bashrc/zshrc
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
export CPATH=$CPATH:/usr/local/include
Thanks @le0pard worked like a charm.
Really pleased with the quickly reply
sudo apt install libwebp-dev
@L-Y issue about Mac OS, not about Debian/Ubuntu
@le0pard sorry,I have not used mac. I don't know.I solved this method under ubuntu 18.04. It is good to install this extension.
@L-Y requirements described in readme - https://github.com/le0pard/webp-ffi/blob/master/README.md#requirements
But this issue about Mac OS (please check subject)
@le0pard I know.
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?
@gotoAndBliss I did not see what version of a gem you trying to install. Please provide backtrace. If you have same backtrace, this mean compiler cannot find header files for webp. Check CPATH and LIBRARY_PATH as was written here https://github.com/le0pard/webp-ffi/issues/14#issuecomment-270973766
@le0pard
Really appreciate your response. My CPATH was also not returning anything. So I followed your export advice, but I still get the same result. The version of gem is included in the return below.
ॐ > echo $CPATH
:/usr/local/include
And then
ॐ > gem install webp-ffi -v '0.2.7'
Building native extensions. This could take a while...
ERROR: Error installing webp-ffi:
ERROR: Failed to build gem native extension.
current directory: /Users/prabhupad/.rvm/gems/ruby-2.7.3/gems/webp-ffi-0.2.7/ext/webp_ffi
/Users/prabhupad/.rvm/rubies/ruby-2.7.3/bin/ruby -I/Users/prabhupad/.rvm/rubies/ruby-2.7.3/lib/ruby/2.7.0/rubygems -rrubygems /Users/prabhupad/.rvm/gems/ruby-2.7.3/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/Users/prabhupad/.rvm/gems/ruby-2.7.3/extensions/arm64-darwin-21/2.7.0/webp-ffi-0.2.7 RUBYLIBDIR\=/Users/prabhupad/.rvm/gems/ruby-2.7.3/extensions/arm64-darwin-21/2.7.0/webp-ffi-0.2.7
mkdir -p arm-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 arm-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/prabhupad/.rvm/gems/ruby-2.7.3/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in `block (2 levels) in define_task!'
/Users/prabhupad/.rvm/gems/ruby-2.7.3/gems/rake-13.0.6/exe/rake:27:in `<main>'
Tasks: TOP => default => arm-darwin/libwebp_ffi.bundle => arm-darwin/jpegdec.o
(See full trace by running task with --trace)
rake failed, exit code 1
Gem files will remain installed in /Users/prabhupad/.rvm/gems/ruby-2.7.3/gems/webp-ffi-0.2.7 for inspection.
Results logged to /Users/prabhupad/.rvm/gems/ruby-2.7.3/extensions/arm64-darwin-21/2.7.0/webp-ffi-0.2.7/gem_make.out
@gotoAndBliss
First of all: check that your updated CPATH have header files (on M1 they can located in different directory). So by your CPATH you should have /usr/local/include/webp/encode.h
available (you wrote to github issue for intel Mac's, so this envs works on intel Mac's)
Next - as I wrote also need to be checked LIBRARY_PATH.
And last one. You trying to install version of gem 0.2.7
, which is not support M1. Only from 0.3.1
version added support for M1.
@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
@gotoAndBliss and @le0pard I was only able to get this to work on M1 by also running the code above from @le0pard. Should we have this added to the readme?
@jeremylynch it is looks like issue for m1 owners, which not set valid LIBRARY_PATH
and CPATH
to compile any native extensions, which require libs installed by homebrew (issue not only for this gem). So it is hard to say for me, because I do not have m1 machine.
I've sucessfully installed the dependencies via brew..