[MacRuby-devel] Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard

hiroshi saito hiroshi3110 at gmail.com
Sun Oct 11 19:11:03 PDT 2009

Hi Laurent,

> Strange. Could you try the following in the same directory and paste us the
> output?
> $ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
> "./rbconfig.rbo" -V

MacRuby - Laurent にコマンド実行結果を送る

Hi Laurent,

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o
"./rbconfig.rbo" -V

$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin ./miniruby
-I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o "./rbconfig.rbo"
./miniruby --emit-llvm
MREP_-107041289 "rbconfig.rb"
/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f
-march=x86-64 -enable-eh
/usr/bin/gcc -c -arch x86_64
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -o
/usr/bin/g++ /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c
-dynamic -bundle -undefined suppress -flat_namespace -arch x86_64 -L.
-lmacruby /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.o
-o ./rbconfig.rbo
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c:2: error:
expected initializer before ‘-’ token
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c: In function
‘void __init__()’:
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c:5: error:
‘MREP_’ was not declared in this scope
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c:5: error:
‘107041289’ cannot be used as a function
Error when executing `/usr/bin/g++
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c -dynamic
-bundle -undefined suppress -flat_namespace -arch x86_64 -L. -lmacruby
/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.o -o

At the line around 100 of bin/rubyc:

    init_func = "MREP_#{File.read(path).hash}"

I extracted this line and execute it with -e option

$ ./miniruby -I. -I./lib -e "p File.read('rbconfig.rb').hash"

I suppose that String#hash method will return an integer, that could
be nagative value. I don't know why on other environments
the method return positive value everytime...

Anyway, I hack the line of code to continue like that:

Index: bin/rubyc
--- bin/rubyc   (revision 2779)
+++ bin/rubyc   (working copy)
@@ -96,7 +96,7 @@
     output ||= File.join(File.dirname(path), base + '.o')

     # Generate init function (must be unique).
-    init_func = "MREP_#{File.read(path).hash}"
+    init_func = "MREP_#{File.read(path).hash.abs}"

     # Compile the file into LLVM bitcode.
     bc = gen_tmpfile(base, 'bc')

It passed, but I got another error.

$ ./miniruby -I. -I./lib bin/rubyc --internal -C "lib/date.rb" -o "lib/date.rbo"
Error when executing `./miniruby --emit-llvm
MREP_146681552 "lib/date.rb"'
rake aborted!

The exact error of the executed subcommand is:

$ ./miniruby --emit-llvm
MREP_146681552 "lib/date.rb"
unrecognized literal `86400000000000' (class `Bignum' type 10)
zsh: abort      ./miniruby --emit-llvm  MREP_146681552 "lib/date.rb"

I doubt that numeric or integer part of my llvm or macruby went wrong,
it possibly caused by something bad in my environment.
If it is true, farther investigation will be waste of time to you and
me, I'm sorry, but I'll give up for now.

> I never got these warnings before on several machines, we build with -Werror
> since months and nobody reported this problem too.
> I suspect it has something to do with your LLVM installation, but I'm not
> sure. These warnings are probably because of -Winline that we only pass when
> building dispatcher.cpp (to make sure gcc won't lie to us).

I agreed that.

Thanks anyway.

More information about the MacRuby-devel mailing list