Building MacRuby r2765 with llvm r82747 failed on core duo macbook, Leopard
Hi all, I failed to build llvm r82747 and MacRuby r2765 following the instruction of README. I use core duo macbook and Leopard. $ svn co -r 2765 http://svn.macosforge.org/repository/ruby/MacRuby/trunk MacRuby-trunk $ svn co -r 82747 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk $ cd llvm-trunk $ UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make ... llvm[2]: Compiling BasicBlockTracing.c for Release build (bytecode) ... llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags To avoid the error, omited univsersal environment variables. $ ENABLE_OPTIMIZED=1 make It worked. Next, build MacRuby itself. My llvm isn't universal binary anymore, so I explicitly specified archs options; $ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake archs=i386 ... /usr/bin/g++ -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -Woverloaded-virtual -I. -I./include -g -Wall -arch i386 -Wno-parentheses -Wno-deprecated-declarations -Werror -Winline --param inline-unit-growth=10000 --param large-function-growth=10000 -x objective-c++ -c dispatcher.cpp -o dispatcher.o cc1objplus: warnings being treated as errors /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline ... I got warnings which stopped build. So added "allow_build_warnings=true"; $ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake archs=i386 allow_build_warnings=true ... ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -o "./rbconfig.rbo" terminate called after throwing an instance of 'RoxorReturnFromBlockException*' rake aborted! I stucked. I don't have any idea to avoid the exception yet. Also, I tried some of ideas; * use gcc-4.2 instead of default version of gcc 4.0 on Leopard, but this doesn't seem to have any effect. * append --disable-dependency-tracking to ./configure of llvm Before continue to struggle, I want some help. If someone succeeded to build MacRuby after releasing 0.5 beta1, please help me. Or have any idea, I'll try it. Thanks in advance. ====== Lines below are more details of the build fialures: $ uname -a Darwin hiroshi-macbook.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 $ gcc -v .. gcc version 4.0.1 (Apple Inc. build 5493) $ svn co -r 2765 http://svn.macosforge.org/repository/ruby/MacRuby/trunk MacRuby-trunk $ svn co -r 82747 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk $ cd llvm-trunk $ ./configure $ UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make ... llvm[2]: Compiling BasicBlockTracing.c for Release build (bytecode) /Developer/usr/bin/llvm-gcc -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/runtime/libprofile -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -mmacosx-version-min=10.5 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -arch i386 -arch x86_64 BasicBlockTracing.c -o /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/runtime/libprofile/Release/BasicBlockTracing.ll -S -emit-llvm llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags make[2]: *** [/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/runtime/libprofile/Release/BasicBlockTracing.ll] Error 1 make[1]: *** [libprofile/.makeall] Error 2 make: *** [all] Error 1 Instead of building llvm with multiple archs, I tried to build it without universal flags: $ ENABLE_OPTIMIZED=1 make It works, but next, building macruby itself failed. $ cd ..; cd MacRuby-trunk $ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake archs=i386 ... /usr/bin/g++ -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -Woverloaded-virtual -I. -I./include -g -Wall -arch i386 -Wno-parentheses -Wno-deprecated-declarations -Werror -Winline --param inline-unit-growth=10000 --param large-function-growth=10000 -x objective-c++ -c dispatcher.cpp -o dispatcher.o cc1objplus: warnings being treated as errors /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:95: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:422: warning: ‘void llvm::PATypeHandle::removeUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:96: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:434: warning: ‘llvm::Type* llvm::PATypeHolder::get() const’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:159: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:440: warning: ‘void llvm::PATypeHolder::addRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:182: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:446: warning: ‘void llvm::PATypeHolder::dropRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:183: warning: previous non-inline declaration here rake aborted! ========== Hiroshi Saito hiroshi3110@gmail.com http://blog.yakitara.com/ http://github.com/hiroshi
Hi, On Oct 9, 2009, at 4:22 AM, hiroshi saito wrote:
Hi all,
I failed to build llvm r82747 and MacRuby r2765 following the instruction of README. I use core duo macbook and Leopard.
$ svn co -r 2765 http://svn.macosforge.org/repository/ruby/MacRuby/trunk MacRuby-trunk $ svn co -r 82747 https://llvm.org/svn/llvm-project/llvm/trunk llvm- trunk $ cd llvm-trunk $ UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make ... llvm[2]: Compiling BasicBlockTracing.c for Release build (bytecode) ... llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
Looks like the LLVM build system it picking llvm-gcc instead of gcc. This is probably why it's failing. You probably want to remote llvm-gcc out of your $PATH and try again.
To avoid the error, omited univsersal environment variables.
$ ENABLE_OPTIMIZED=1 make
It worked.
Next, build MacRuby itself. My llvm isn't universal binary anymore, so I explicitly specified archs options;
$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake archs=i386 ... /usr/bin/g++ -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -Woverloaded-virtual -I. -I./include -g -Wall -arch i386 -Wno-parentheses -Wno-deprecated-declarations -Werror -Winline --param inline-unit-growth=10000 --param large-function-growth=10000 -x objective-c++ -c dispatcher.cpp -o dispatcher.o cc1objplus: warnings being treated as errors /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline
Mmh, this never happened to me. But I never tried to build MacRuby for a single architecture like this yet. I recommend to rebuild LLVM without llvm-gcc and try again. Good luck, Laurent
Hi Laurent, Thanks for pointing out possibility about llvm-gcc somewhere in the PATH. That's right. I found llvm-gcc in /Developer/usr/bin. After removing /Developer/usr/bin from the PATH, I could successfully build llvm as an universal binary. However, as for MacRuby itself, libmacruby.dylib and macruby is OK with allow_build_warnings=true option, but aot_compile_stdlib is failed. I used MacRuby trunk r2779 this time. $ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake allow_build_warnings=true -t ... ** Invoke macruby:dylib ** Execute aot_compile_stdlib ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -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 ./rbconfig.rbo' rake aborted! The content of /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/main.c is: extern "C" { void *MREP_-107041289(void *, void *); void *rb_vm_top_self(void); __attribute__((constructor)) static void __init__(void) { MREP_-107041289(rb_vm_top_self(), 0); } } FYI, the warnings I forced to ignore with allow_build_warnings=true are those below. I wonder this is happened by not installing llvm, but specifying it's location with "PATH". /usr/bin/g++ -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -Woverloaded-virtual -I. -I./include -g -Wall -arch i386 -arch x86_64 -Winline --param inline-unit-growth=10000 --param large-function-growth=10000 -x objective-c++ -c dispatcher.cpp -o dispatcher.o /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:95: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:422: warning: ‘void llvm::PATypeHandle::removeUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:96: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:434: warning: ‘llvm::Type* llvm::PATypeHolder::get() const’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:159: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:440: warning: ‘void llvm::PATypeHolder::addRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:182: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:446: warning: ‘void llvm::PATypeHolder::dropRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:183: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:95: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:422: warning: ‘void llvm::PATypeHandle::removeUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:96: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:434: warning: ‘llvm::Type* llvm::PATypeHolder::get() const’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:159: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:440: warning: ‘void llvm::PATypeHolder::addRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:182: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:446: warning: ‘void llvm::PATypeHolder::dropRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/AbstractTypeUser.h:183: warning: previous non-inline declaration here
Hi, On Oct 10, 2009, at 7:17 AM, hiroshi saito wrote:
Hi Laurent,
Thanks for pointing out possibility about llvm-gcc somewhere in the PATH. That's right. I found llvm-gcc in /Developer/usr/bin. After removing /Developer/usr/bin from the PATH, I could successfully build llvm as an universal binary.
Cool.
However, as for MacRuby itself, libmacruby.dylib and macruby is OK with allow_build_warnings=true option, but aot_compile_stdlib is failed. I used MacRuby trunk r2779 this time.
$ PATH=$PATH:~/Desktop/wc/MacRuby/llvm-trunk/Release/bin rake allow_build_warnings=true -t ... ** Invoke macruby:dylib ** Execute aot_compile_stdlib ./miniruby -I. -I./lib bin/rubyc --internal -C "rbconfig.rb" -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 ./rbconfig.rbo' rake aborted!
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
The content of /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/ main.c is: extern "C" { void *MREP_-107041289(void *, void *); void *rb_vm_top_self(void); __attribute__((constructor)) static void __init__(void) { MREP_-107041289(rb_vm_top_self(), 0); } }
Looks like the unique ID is negative. Maybe a bug of macrubyc.
FYI, the warnings I forced to ignore with allow_build_warnings=true are those below. I wonder this is happened by not installing llvm, but specifying it's location with "PATH".
/usr/bin/g++ -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -I/Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-common -Woverloaded-virtual -I. -I./include -g -Wall -arch i386 -arch x86_64 -Winline --param inline-unit-growth=10000 --param large-function-growth=10000 -x objective-c++ -c dispatcher.cpp -o dispatcher.o /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:95: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:422: warning: ‘void llvm::PATypeHandle::removeUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:96: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:434: warning: ‘llvm::Type* llvm::PATypeHolder::get() const’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:159: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:440: warning: ‘void llvm::PATypeHolder::addRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:182: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:446: warning: ‘void llvm::PATypeHolder::dropRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:183: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:417: warning: ‘void llvm::PATypeHandle::addUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:95: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:422: warning: ‘void llvm::PATypeHandle::removeUser()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:96: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:434: warning: ‘llvm::Type* llvm::PATypeHolder::get() const’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:159: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:440: warning: ‘void llvm::PATypeHolder::addRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:182: warning: previous non-inline declaration here /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/Type.h:446: warning: ‘void llvm::PATypeHolder::dropRef()’ was used before it was declared inline /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/include/llvm/ AbstractTypeUser.h:183: warning: previous non-inline declaration here
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). Laurent
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" -V ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc" MREP_-107041289 "rbconfig.rb" /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc -o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -march=x86-64 -enable-eh /usr/bin/gcc -c -arch x86_64 /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -o /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.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 ./rbconfig.rbo' 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" -107041289 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 "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" MREP_146681552 "lib/date.rb"' rake aborted! The exact error of the executed subcommand is: $ ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" 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.
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" -107041289
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...
Laurent, wouldn't it be better to use something like a SHA1: require 'digest/sha1' init_func = "MREP_#{Digest::SHA1.hexdigest(File.read(path))}"
On Oct 11, 2009, at 7:42 PM, Vincent Isambart wrote:
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" -107041289
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...
Laurent, wouldn't it be better to use something like a SHA1: require 'digest/sha1' init_func = "MREP_#{Digest::SHA1.hexdigest(File.read(path))}"
miniruby cannot load C extensions, so this isn't an option. Laurent
Hi Hiroshi-san, On Oct 11, 2009, at 7:11 PM, hiroshi saito wrote:
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" -V ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc" MREP_-107041289 "rbconfig.rb" /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc -o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -march=x86-64 -enable-eh /usr/bin/gcc -c -arch x86_64 /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -o /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.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 ./rbconfig.rbo'
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" -107041289
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...
Indeed, it's weird that nobody reported that problem, yet.
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')
I committed this change in r2781.
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 "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" MREP_146681552 "lib/date.rb"' rake aborted!
The exact error of the executed subcommand is:
$ ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" 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.
In fact, this crash is because of a limitation in the AOT compiler, I forgot to handle literal bignums. $ ./miniruby --emit-llvm foo omg -e "p 1267650600228229401496703205376" unrecognized literal `1267650600228229401496703205376' (class `Bignum' type 10) Abort trap In any case I will fix it. But I don't know yet why this problem hits you when compiling lib/date.rb. The same file appears to compile fine for the rest of us. It's not a waste of time at all because you found legitimate bugs :-) ありがとうございます! Laurent
On Oct 11, 2009, at 10:10 PM, Laurent Sansonetti wrote:
Hi Hiroshi-san,
On Oct 11, 2009, at 7:11 PM, hiroshi saito wrote:
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" -V ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc" MREP_-107041289 "rbconfig.rb" /Users/hiroshi/Desktop/wc/MacRuby/llvm-trunk/Release/bin/llc -f /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.bc -o=/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -march=x86-64 -enable-eh /usr/bin/gcc -c -arch x86_64 /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.s -o /var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/rbconfig.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 ./rbconfig.rbo'
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" -107041289
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...
Indeed, it's weird that nobody reported that problem, yet.
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')
I committed this change in r2781.
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 "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" MREP_146681552 "lib/date.rb"' rake aborted!
The exact error of the executed subcommand is:
$ ./miniruby --emit-llvm "/var/folders/HQ/HQYJapbxHKW7ieZsqEt5-++++TI/-Tmp-/date.bc" 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.
In fact, this crash is because of a limitation in the AOT compiler, I forgot to handle literal bignums.
$ ./miniruby --emit-llvm foo omg -e "p 1267650600228229401496703205376" unrecognized literal `1267650600228229401496703205376' (class `Bignum' type 10) Abort trap
In any case I will fix it. But I don't know yet why this problem hits you when compiling lib/date.rb. The same file appears to compile fine for the rest of us.
Quick investigation: $ ./miniruby -e 'p 86400000000000.class' Fixnum $ arch -i386 ./miniruby -e 'p 86400000000000.class' Bignum I think that your miniruby runs in 32-bit mode, which should be the case if your computer is a Core Duo as mentioned in the subject of this e-mail. 32-bit has not been tested a lot, which could explain these bugs :) Laurent
On Oct 11, 2009, at 10:10 PM, Laurent Sansonetti wrote:
In fact, this crash is because of a limitation in the AOT compiler, I forgot to handle literal bignums.
$ ./miniruby --emit-llvm foo omg -e "p 1267650600228229401496703205376" unrecognized literal `1267650600228229401496703205376' (class `Bignum' type 10) Abort trap
I fixed the problem in r2782. $ cat t.rb p 1267650600228229401496703205376 $ macrubyc t.rb -o /tmp/t $ /tmp/t 1267650600228229401496703205376 Laurent
participants (3)
-
hiroshi saito
-
Laurent Sansonetti
-
Vincent Isambart