LoginSignup
0
0

More than 3 years have passed since last update.

Imlib2をMacで使うときに遭遇したエラーと対処

Posted at

imlib2を使いたい

ImageMagcikの代わりとして一時期はやった。

今回は環境はLinuxじゃなくてMacで。rubyで使いたい。

bundle installしたい

Imlib2-Ruby 0.5.2 を使いたいとき。gemfileは以下。

gem 'Imlib2-Ruby', git: 'https://github.com/pepabo/imlib2-ruby.git'

本家にない。
http://pablotron.org/files/gems/imlib2-ruby-0.5.2.gem

Imlib2 を使いたいと思ったときにforkしているこちらのgithubから参照する形をとっている。

imlib2がないとエラー

bundle install をしていたときに下記エラーでつまずいた。

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

imlib2が必要ということだと判断。

環境はMac。ruby2.5.3(rbenv)
実行時の詳細なエラーは下記。

Using Imlib2-Ruby 0.5.2 from https://github.com/pepabo/imlib2-ruby.git (at master@47c04bc)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/hoge/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/imlib2-ruby-47c04bce88f1
/Users/hoge/.rbenv/versions/2.5.3/bin/ruby -r ./siteconf20190903-6773-1sradmq.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/hoge/.rbenv/versions/2.5.3/bin/$(RUBY_BASE_NAME)
        --with-imlib2-config
        --without-imlib2-config
extconf.rb:5:in ``': No such file or directory - imlib2-config (Errno::ENOENT)
        from extconf.rb:5:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/hoge/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/imlib2-ruby-47c04bce88f1 for inspection.
Results logged to
/Users/hoge/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/extensions/x86_64-darwin-18/2.5.0-static/imlib2-ruby-47c04bce88f1/gem_make.out

An error occurred while installing Imlib2-Ruby (0.5.2), and Bundler cannot continue.


In Gemfile:
  Imlib2-Ruby

Imlib2を使うとこができる環境

imlib2が必要ということだと判断。
その上で下記操作が必要だった。

brew cask install xquartz
brew install imlib2

homebrewで管理していたのでimlib2をいれたかった。
imlib2-develはなく、imlib2も xquartzを必要としていた。

これで解決。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0