(OS X를 싹 밀지 않고 OS X 업그레이드를 하면 ruby 때문에 좀 힘들 수 있다. )
아래 내용의 후속판이다.
Gemfile에 'gem 'zookeeper', '1.4.11''가 추가되어
$bundle 실행하면, 아래와 같이 You have to install development tools first. 에러가 발생했다.
링크에 있는데로 최신 Xcode를 깔아도 계속 발생했다.
checking for rb_thread_blocking_region()... *** 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/Samuel/.rbenv/versions/2.1.0/bin/ruby
/Users/Samuel/.rbenv/versions/2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
gcc 확인했고..
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
XCode 최신 확인..
$ brew config
..
Xcode: 7.2
..
~/.rbenv/versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/mkmf.log 를 참조하니, gcc 4.2를 사용하고 있다.
$ cat /Users/Samuel/.rbenv//versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/mkmf.log
"gcc-4.2 -o conftest -I/Users/Samuel/.rbenv/versions/2.1.0/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/Samuel/.rbenv/versions/2.1.0/include/ruby-2.1.0/ruby/backward -I/Users/Samuel/.rbenv/versions/2.1.0/include/ruby-2.1.0 -I. -I/Users/Samuel/.rbenv/versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/include -L/Users/Samuel/.rbenv/versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/lib -L/Users/Samuel/.rbenv/versions/2.1.0/lib -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L/Users/Samuel/.rbenv/versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/lib -L/Users/Samuel/.rbenv/versions/2.1.0/gemsets/story-deploy/gems/zookeeper-1.4.11/ext/lib -L/Users/Samuel/.rbenv/versions/2.1.0/lib -L. -L/Users/Samuel/.rbenv/versions/2.1.0/lib -fstack-protector -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc -lzookeeper_st_gem -lm"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
그래서 아래와 같이 gcc42와 libv8을 설치하니 잘 된다.
$ gem install libv8 -v 3.16.14.7 -- --with-system-v8
Fetching: libv8-3.16.14.7-x86_64-darwin-13.gem (100%)
Successfully installed libv8-3.16.14.7-x86_64-darwin-13
Parsing documentation for libv8-3.16.14.7-x86_64-darwin-13
Installing ri documentation for libv8-3.16.14.7-x86_64-darwin-13
Done installing documentation for libv8 after 0 seconds
1 gem installed
$ brew install homebrew/dupes/apple-gcc42
$ bundle update
(ok)
정확한 문제의 원인은 잘 모르겠지만, ruby는 gcc-4.2가 반드시 필요하다
운영체제 업그레이드할 때는 일부 라이브러리 컴파일시 gcc-4.2가 안좋을 수 있지만,
bundle update시 ruby rake가 gcc-4.2를 참조하여 native 컴파일을 하도록 되어 있어서, 상황에 맞게 작업해야 할 듯..
참조
https://gist.github.com/jpodlech/837c7e5103c4cf5cb9b1
https://github.com/cowboyd/therubyracer/issues/304
'Ruby' 카테고리의 다른 글
[ruby] ruby에서 현재 디렉토리 얻기 (0) | 2016.08.16 |
---|---|
[ruby] enumeration의 inject (0) | 2016.08.12 |
[ruby] Errno::EACCES: Permission denied (0) | 2016.01.13 |
[ruby] gem install 시 openssl 설치시 file not found 해결하기 (0) | 2015.12.22 |
[ruby gem] You have to install development tools first. 해결하기 (0) | 2015.12.21 |