2016年7月19日火曜日

Recommendifyを入れてみたらちょっとはまった

今更なのですがRecommendifyを試してみて、普通にgem入れようとしたら入らなかったので調べました。
試した環境はMac OSX El Capitanです。

まずは以下の2つをインストール。
brew insert redis
brew insert hiredis

次にGemfileにhiredisとrecommendifyを追加。
gem install hiredis
gem install recommendify

そしてbundle installを実行。
すると、recommendifyが入らなくてエラーになりました。
Installing recommendify 0.3.8 with native extensions

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

    /Users/xxx/.rbenv/versions/2.1.3/bin/ruby extconf.rb

make "DESTDIR=" clean
rm -f *.o

make "DESTDIR="
mkdir -p ../bin
gcc -Wall recommendify.c -lhiredis -o ../bin/recommendify
recommendify.c:4:10: fatal error: 'hiredis/hiredis.h' file not found
#include 
         ^
1 error generated.
make: *** [build] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/xxx/yyy/vendor/bundle/ruby/2.1.0/gems/recommendify-0.3.8 for inspection.
Results logged to /Users/xxx/yyy/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/recommendify-0.3.8/gem_make.out
An error occurred while installing recommendify (0.3.8), and Bundler cannot continue.
Make sure that `gem install recommendify -v '0.3.8'` succeeds before bundling.

調べてみたところ、recommendifyをgitからnativeブランチで取得するとよさそうです。
gem install recommendify, git: "https://github.com/danmorin/recommendify.git", branch: "native"
これで無事に入りました。

参考URL
http://blog.naberon.jp/post/2013/09/09/site-recommend/
http://d.hatena.ne.jp/itmsc/20130812/1376289715
http://qiita.com/toyama0919/items/bef2e375e9ebde9a01ba
https://github.com/paulasmuth/recommendify/issues/6

0 件のコメント:

コメントを投稿