Reputation: 5754
I am attempting to install Ruby 1.9.3 using clang. I tried the following and it didn't work:
rvm install 1.9.3-p125 --with-gcc=clang
rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr
The error I get is the readline related error in the make log:
readline.c:1499:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
rl_username_completion_function);
^
readline.c:69:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
^
/usr/local/include/readline/readline.h:443:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make: *** [build-ext] Error 2
as well as this clang error for the first attempt: (rvm install 1.9.3-p125 --with-gcc=clang)
clang: error: unsupported option '--with-libyaml'
clang: error: unsupported option '--with-libyaml'
and for the second attempt: (rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr)
clang: error: unsupported option '--with-readline'
clang: error: unsupported option '--with-opt-dir=/Users/andrewjl/.rvm/usr'
clang: error: unsupported option '--with-readline'
clang: error: unsupported option '--with-opt-dir=/Users/andrewjl/.rvm/usr'
Given what I learned here, my guess is that clang is not recognizing my command line arguments to use specific gcc and/or specific readline directory.
My RVM is: rvm 1.14.3 (master)
My Clang is:
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
Here is my GCC:
andrewjl$ /usr/bin/gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/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.9~22/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.9.00)
I tried the method here and it didn't work for me. Specifically I installed Xcode 4.1 with command line tools and made sure to get openssl and readline updated. Does anybody know anything else I can try?
Upvotes: 1
Views: 2452
Reputation: 5754
Seems like RVM changed something on the command line, the following (changed) format works for me:
rvm pkg install readline
followed by:
rvm install 1.9.3 -C "--with-readline-dir=$HOME/.rvm/usr"
Upvotes: 1
Reputation: 1937
Your "GCC" is still LLVM-based. When installing ruby-1.9.3-p125, you shouldn't need to and probably shouldn't at all set --with-gcc=clang as RVM will automatically figure it out now.
Have you already tried installing that ruby without that option? If you're still having trouble, please tell me what exact Xcode version you have installed and we can proceed from there. gcc version 4.2.1 could be anywhere from 4.2.x to 4.5 DP2. Consider stopping by #rvm in Freenode IRC (http://webchat.freenode.net/?channels=rvm) and I (Remear) or mpapis can assist you further.
Some clarifying information:
All Xcode versions up to about 4.1 shipped with the standard GCC-based compiler. Starting with Xcode 4.2.x, Apple introduced the LLVM-based compiler and started to phase out the GCC-based one. Xcode 4.3 comes with only the LLVM compiler, no GCC. Ruby 1.8.x require GCC for compilation. Ruby 1.9.3-p0 had slight support for LLVM but you were lucky to get it installed. Ruby 1.9.3-p125 or newer has improved compatibility with the LLVM compiler.
So here's the breakdown of what you need to install pretty much any ruby:
Xcode 4.1 or osx-gcc-installer
Xcode 4.1 or osx-gcc-installer
or
Xcode 4.2.x or newer with Xcode Command Line Tools installed (this gives you back GCC in addition to LLVM)
Upvotes: 2