MacOSX版Bitnami Redmineでbundleコマンドに失敗
Bitnami Redmineのプラグインインストールでエラーが出た
MaxOSX Marvericks(Ver10.9)でBitnami Redmineをインストールし、json-1.8.1を導入しようとbundle updateしたところ、以下のエラーが!
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Applications/redmine-2.5.1-0/ruby/bin/ruby extconf.rb
creating Makefile
make
dyld: Symbol not found: _sqlite3_intarray_bind
Referenced from: /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
Expected in: /Applications/redmine-2.5.1-0/sqlite/lib/libsqlite3.dylib
in /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
make: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
make: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
Gem files will remain installed in /Applications/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /Applications/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
どうやらxcodebuildコマンドが配置されている場所が間違っているようで、dyldがエラーを出しています。なぜ?
MaOSXにXCode,CommandLineToolsを導入すると、コンパイル環境が別々にできる
MacOSXでiPhoneアプリを開発するためにXCodeをインストールしたり、gccやサーバー運用したりするためにCommandLineToolsをインストールすると、以下のように異なるパスにコンパイル環境ができます。
| XCode | /Applications/ |
|---|---|
| Command Line Tools | /Library/ |
今回のエラーは、XCode側の環境で設定されていたためにmakeに失敗してしまったのでした。
ではこれを回避してCommand Line Tools側の環境に切り替えるには?
xcode-select -switch を使う
xcode-select -switchコマンドを使うと、コンパイル環境を切り替えることができます。
どの環境でも実行する場合は/usr/bin/xcode-selectのようにフルパスで指定します。
$ sudo /usr/bin/xcode-select -switch /Library/Developer/CommandLineTools Password:(rootパスワード入力) $ bundle update ... Your bundle is updated!
困ったときにはこのように切り替えてみてください。
Auto Amazon Links: プロダクトが見つかりません。
2014-11-06
