Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to build Ruby 1.9.3 on Lion

Upon switching to Lion (and rebuilding my system from scratch), I decided to also try out rbenv in the process. Unfortunately, I have been unable to get Ruby 1.9.3 to compile since the switch and am now stuck using the Ruby I compiled while still on Snow Leopard. I'm hoping someone can spot whatever it is that continues to elude me. Here are the assumptions I've been operating under:

  • Ruby 1.9.3-p125 and later supports clang
  • XCode 4.3.x introduced some instability
  • Several issues (e.g., #87, #137) from the ruby-build project indicate that it now correctly handles 1.9.3 installs

What I've tried so far:

  1. Manual build

    ./configure && make && make install
    
  2. Letting ruby-build do #1. for me.

    rbenv install -v 1.9.3-p286
    
  3. Compiling with a non-LLVM compiler (via installing the apple-gcc42 Homebrew package)

    CC=/usr/local/bin/gcc-4.2 rbenv install -v 1.9.3-p286
    
  4. Trying the shared option because it worked on Snow Leopard

    CONFIGURE_OPTS="--with-shared" rbenv install -v 1.9.3-p286
    

And every time the build fails in the same, obscure way: through nonexistent tests and failing, Array-related tests:

configuring win32ole
Failed to configure win32ole. It will not be installed.
configuring zlib
/bin/sh: line 0: cd: ext/-test-/array/resize: No such file or directory
/bin/sh: line 0: cd: ext/-test-/add_suffix: No such file or directory
make[1]: *** [ext/-test-/array/resize/all] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [ext/-test-/add_suffix/all] Error 1
make: *** [build-ext] Error 2

(rbenv log in full)

I am using the latest version (October 2012) of the Command Line Tools for Xcode, but not Xcode itself. Relevant component versions are:

gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

cc -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

In addition to what I've tried above, I've also searched the web to no avail.

like image 379
Gary Iams Avatar asked Dec 08 '22 20:12

Gary Iams


1 Answers

I had the same problem. In my case I added . to my CDPATH (via export CDPATH=.:$CDPATH) and was able to get ruby to build via rbenv install. I had been tinkering with CDPATH recently so it's possible (even likely) that I caused the problem myself.

like image 126
sequethin Avatar answered Dec 28 '22 20:12

sequethin