There's an echo in my head



  1. RubyでOSXのネイティブアプリケーションを作りたくなってMacRubyを入れようと思って、
  2. どうせならruby-buildで入れようと思ったらなかったので自前で定義ファイルを書こうと思って、
  3. ひとまず手動でどうやってビルドしようとしたら詰まった

とりあえずやったことのメモ。環境はMac OSX 10.8.2、MacRuby 0.12を入れようとした。


$ brew install llvm


$ cd ~/src
$ wget
$ tar zxf v0.12.tar.gz
$ cd MacRuby-0.12


$ rake
llvm-config: error: components given, but unused

usage: llvm-config <OPTION>... [<COMPONENT>...]

Get various configuration information needed to compile programs which use
LLVM.  Typically called from 'configure' scripts.  Examples:
  llvm-config --cxxflags
  llvm-config --ldflags
  llvm-config --libs engine bcreader scalaropts

  --version         Print LLVM version.
  --prefix          Print the installation prefix.
  --src-root        Print the source root LLVM was built from.
  --obj-root        Print the object root used to build LLVM.
  --bindir          Directory containing LLVM executables.
  --includedir      Directory containing LLVM headers.
  --libdir          Directory containing LLVM libraries.
  --cppflags        C preprocessor flags for files that include LLVM headers.
  --cflags          C compiler flags for files that include LLVM headers.
  --cxxflags        C++ compiler flags for files that include LLVM headers.
  --ldflags         Print Linker flags.
  --libs            Libraries needed to link against LLVM components.
  --libnames        Bare library names for in-tree builds.
  --libfiles        Fully qualified library filenames for makefile depends.
  --components      List of all possible components.
  --targets-built   List of all targets currently built.
  --host-target     Target triple used to configure LLVM.
  --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).
Typical components:
  all               All LLVM libraries (default).
  engine            Either a native JIT or a bitcode interpreter.
/usr/bin/bison -o parse.y
parse.y: conflicts: 1 shift/reduce
/usr/bin/sed -f ./tool/ytab.sed -e "/^#/s!!parse.c!" >
mv parse.c
rm -f .objs/parse.o
cp lex.c.blt lex.c
/usr/bin/ruby -n tool/node_name.rb include/ruby/node.h >
echo '' > .objs/kernel_data.c
/usr/bin/llvm-gcc -arch x86_64 -fexceptions -fno-stack-protector -fwrapv -I. -I./include -I./icu-1060  --emit-llvm -c kernel.c -o .objs/kernel-x86_64.bc
/usr/local/bin/opt -O3 .objs/kernel-x86_64.bc -o=.objs/kernel-x86_64.bc
/usr/local/bin/opt: .objs/kernel-x86_64.bc: error: Invalid MODULE_CODE_GLOBALVAR record
rake aborted!
Command failed with status (1): [/usr/local/bin/opt -O3 .objs/kernel-x86_64...]
/Users/aerial/src/MacRuby-0.12/rakelib/builder.rake:51:in `block in build_objects'
/Users/aerial/src/MacRuby-0.12/rakelib/builder.rake:47:in `each'
/Users/aerial/src/MacRuby-0.12/rakelib/builder.rake:47:in `build_objects'
/Users/aerial/src/MacRuby-0.12/rakelib/builder.rake:77:in `block in <top (required)>'
Tasks: TOP => default => all => macruby => macruby:build => macruby:dylib => rbconfig => miniruby
(See full trace by running task with --trace)


ちなみにこのあとに待ち受けているrake installでは環境変数DESTDIRでインストール先を指定できる。

$ DESTDIR=/path/to/install/dir rake install

ついでに言うと、MacRuby 0.12はhomebrewでインストールできる。

$ brew install macruby