Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@yuuigara

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

概要

以下の環境で 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
...

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
3
Help us understand the problem. What are the problem?