環境
CentOS 5.6(32bit)
GitLab 6.3(アップデート前)
問題
GitLabを手順に従って6.4にアップデートすると、 bundle install時にlibv8のインストールエラーが発生する。
エラー内容
Installing libv8 (3.16.14.3) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb creating Makefile Compiling v8 for ia32 Using python 2.4.3 Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Using compiler: g++ Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Traceback (most recent call last): File "build/gyp/gyp", line 15, in ? import gyp File "build/gyp/pylib/gyp/__init__.py", line 8, in ? import gyp.input File "build/gyp/pylib/gyp/input.py", line 14, in ? import gyp.common File "build/gyp/pylib/gyp/common.py", line 395 with open(source_path) as source_file: ^ SyntaxError: invalid syntax gmake: *** [out/Makefile.ia32] エラー 1 /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound) from /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each' from /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!' from /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!' from extconf.rb:7:in `<main>' GYP_GENERATORS=make \ build/gyp/gyp --generator-output="out" build/all.gyp \ -Ibuild/standalone.gypi --depth=. \ -Dv8_target_arch=ia32 \ -S.ia32 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3 for inspection. Results logged to /home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/libv8-3.16.14.3/ext/libv8/gem_make.out An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
原因
libv8をインストールする場合、通常はバイナリ版を対象とするが、バイナリ版は64bit版しか用意されていない。
なので、ソースコードからのコンパイルとなるが、CentOS 5.8にデフォルトでインストールされているgccとpythonのバージョンが古い為、コンパイルエラーとなってしまう。
必要となるgccとpythonのバージョン
対応手順
gcc 4.4のインストール
sudo yum install gcc44-c++
pyhon 2.6のインストール(epelリポジトリが必要)
sudo yum install python26
このままだとデフォルトで入っているpython 2.4が使われてしまうので、gitユーザーだけ2.6が使われるように設定
mkdir ~/bin ln -s /usr/bin/python2.6 ~/bin/python echo 'export PATH=~/bin:$PATH' >> ~/.bashrc
再度 bundle install
cd ~/gitlab # MySQL sudo -u git -H bundle install --without development test postgres --deployment # PostgreSQL sudo -u git -H bundle install --without development test mysql --deployment
後は公式アップデート手順の通りに実行でOK
その他
上記手順でpython2.6へのリンクを削除していないが、GitLabが使用しているlibv8のバージョンが上がったら問題が再発するので、残していたほうが良さげ。