LoginSignup
0

More than 3 years have passed since last update.

【備忘録】MacのrbenvでRubiniusをインストールするときにハマった

Posted at

rbenvでrubiniusをインストールできない

普通にrbenv installしようとするとApple LLVMではrubinusをビルドできないと怒られる.

$ rbenv install rbx-2.5.1

BUILD FAILED (OS X 10.13.6 using ruby-build 20160426)


ERROR: Rubinius will not be able to compile using Apple's LLVM-based 
build tools on OS X. You will need to install LLVM 3.5 first.

TO FIX THE PROBLEM: Install Homebrew's llvm package with this
command: brew tap homebrew/versions ; brew install llvm35

BUILD FAILED (OS X 10.13.6 using ruby-build 20160426)

ちなみに僕の環境ではbrew install llvm35はできなかった.

純正LLVMを導入する

純正のLLVMを導入すればよいのだが,普通にインストールするとLLVM-3.5は入らず,より高いバージョンが入ってしまう.
しかも,今回入れたいrbx-2.5.1はLLVM-3.6以上だとだめらしい.

そこで試行錯誤していくうちに下記サイトが参考になった.
https://qiita.com/babie/items/ce242a2b5195c2001ec3
http://straitwalk.hatenablog.com/entry/2015/06/28/221227

結果LLVMはprebuiltされたものをダウンロードして環境変数で指定する形にした.
prebuilt binaryは下記URLからダウンロードした.
http://releases.llvm.org/download.html#3.5.2

opensslがないと怒られる.

ところが今度はopensslが見つからないと怒られる.

Checking for global 'timezone': found!
Checking for global 'tzname': found!
Checking for global 'daylight': found!
Checking for header 'zlib.h': found!
Checking for header 'openssl/ssl.h': not found
openssl/ssl.h is required

brewで入れたLLVMのパスを指定する

最終的にはRUBY_CONFIGURE_OPTS環境変数を指定して,--with-include-dir--with-lib-dirをbrewで入れたopensslのパスに指定したところビルドが通った.

LDFLAGS=-L/path/to/prebuilt_clang/lib \
CPPFLAGS=-I/path/to/prebuilt_clang/include \
CC=/path/to/prebuilt_clang/bin/clang \
CXX=/path/to/prebuilt_clang/bin/clang++ \
RUBY_CONFIGURE_OPTS="--llvm-config=/path/to/prebuilt_clang/bin/llvm-config \
--with-include-dir=/path/to/openssl/include \
--with-lib-dir=/path/to/openssl/lib" \
rbenv install -v rbx-2.5.1

/path/to/prebuilt_clangpath/to/opensslをそれぞれの環境に合わせて使ってください.

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0