6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bundlerでmecabをインストールする際に 'mecab.h' file not found になった時の対処

Posted at

概要

以下の環境で bundle install した際に 'mecab.h' file not found になったので、解決策とエラー内容をメモっておきます。

  • Mac OS X El Capitan
  • ruby-2.2.3p173 (rbenv)
  • MeCab-0.996をHomebrewでインストール済み
  • mecabのgemをBundlerでインストールしようとする

解決策

bundle configmecab.h の在処を教えてやればOK

$ bundle config build.mecab --with-cppflags=-I/usr/local/Cellar/mecab/0.996/include

エラー内容

$ bundle install --path vendor/bundle
...
Installing mecab 0.996 with native extensions

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

    /usr/local/var/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160308-35660-17ft5zo.rb extconf.rb
checking for make... yes
checking for main() in -lstdc++... yes
checking for main() in -lmecab... yes
checking for main() in -lstdc++... yes
checking for mecab.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling mecab_wrap.cpp
mecab_wrap.cpp:1855:10: fatal error: 'mecab.h' file not found
#include "mecab.h"
         ^
1 error generated.
make: *** [mecab_wrap.o] Error 1

make failed, exit code 2
...

参考

6
4
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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?