Make error installing Ruby 1.9.2 with RVM and Readline under OSX Lion
Asked Answered
D

4

14

I'm having extensive problems getting rvm to work again under OSX Lion. Unsurprisingly, it seems to be a problem with readline, which is noted in several places.

HOWEVER, (and this is an update) it seems that readline itself is not being installed correctly!

Here is what I've tried so far:

Reinstalling xcode (4.1) (I also removed the Developer folder first.)

Cleaning and reinstalling all my ports as per http://trac.macports.org/wiki/Migration

Reinstalling readline as per: https://rvm.beginrescueend.com/packages/readline/

Using that specific readline version:

rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

I have also reinstalled rvm entirely. Still no go. Here is the current error I'm seeing:

ERROR: Error running 'make ', please read /Users/tristankromer/.rvm/log/ruby-1.9.2-p290/make.log
ERROR: There has been an error while running make. Halting the installation.

...and the accompanying log file.

make[1]: Entering directory `/Users/tristankromer/.rvm/src/ruby-1.9.2-p290/ext/readline'
/usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin11.0.0 -I../.././include -I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/tristankromer/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe  -o readline.o -c readline.c
readline.c: In function ‘username_completion_proc_call’:
readline.c:1386: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:1386: error: (Each undeclared identifier is reported only once
readline.c:1386: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make[1]: Leaving directory `/Users/tristankromer/.rvm/src/ruby-1.9.2-p290/ext/readline'
make: *** [mkmain.sh] Error 1

So after much investigation, I tried to manually install readline: (from: RVM Does Not Install Ruby 1.9.2 on Snow Leopard: 'Error running 'make ')

curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.1.tar.gz
tar xzvf readline-6.1.tar.gz
cd readline-6.1
./configure --prefix=/usr/local
make
sudo make install
cd ..

I get as far as make when I get an error compiling readline:

gcc-4.2 -dynamic -arch_only `/usr/bin/arch` -install_name /usr/local/lib/libreadline.6.1.dylib -current_version 6.1 -compatibility_version 6 -v -o libreadline.6.1.dylib readline.so vi_mode.so funmap.so keymaps.so parens.so search.so rltty.so complete.so bind.so isearch.so display.so signals.so util.so kill.so undo.so macro.so input.so callback.so terminal.so text.so nls.so misc.so xmalloc.so history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so tilde.so compat.so -lncurses
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/gcc/gcc-5666.3~278/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
i686-apple-darwin11-gcc-4.2.1: -compatibility_version only allowed with -dynamiclib
make[1]: *** [libreadline.6.1.dylib] Error 1
make[1]: Leaving directory `/Users/tristankromer/src/readline-6.1/shlib'
make: [shared] Error 2 (ignored)

So it seems like even installing readline I have a problem due to readline.

I then followed The directions from Andy (below) by adding to .bash_profile:

export ARCHFLAGS="-arch x86_64"

and ran:

brew install readline
brew link readline
brew install libxml2
brew link libxml2
rvm install 1.9.2 -C --with-readline-dir=/usr/local/Cellar/readline/6.2.1/ --with-libxml2-dir=/usr/local/Cellar/xml2/2.7.8

And now I seem to have a different error:

make[1]: Entering directory `/Users/tristankromer/.rvm/src/ruby-1.9.2-p290/ext/tk'
/usr/bin/gcc-4.2 -dynamic -bundle -o ../../.ext/x86_64-darwin11.0.0/tcltklib.bundle stubs.o tcltklib.o -L. -L../.. -L/System/Library/Frameworks/Tcl.framework -L/System/Library/Frameworks/Tk.framework -L. -L/usr/local/lib   -lpthread -framework CoreFoundation  -F/System/Library/Frameworks -framework Tcl    -lpthread -framework CoreFoundation -framework Cocoa -framework Carbon -framework IOKit   -lpthread -framework CoreFoundation  -F/System/Library/Frameworks -framework Tk -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lruby.1.9.1 -lm -ldl  -lpthread -ldl -lobjc
ld: in /usr/local/lib/libiconv.2.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../.ext/x86_64-darwin11.0.0/tcltklib.bundle] Error 1
make[1]: Leaving directory `/Users/tristankromer/.rvm/src/ruby-1.9.2-p290/ext/tk'
make: *** [mkmain.sh] Error 1
Deoxyribonuclease answered 7/8, 2011 at 3:29 Comment(0)
W
12

I had a very similar issue. I eventually found that adding this to my .bash_profile stopped my initial make errors:

export ARCHFLAGS="-arch x86_64"

Also from the command line run the following:

brew install readline
brew link readline
brew install libxml2
brew link libxml2

Then when you install ruby use this command:

rvm install 1.9.2 -C --with-readline-dir=/usr/local/Cellar/readline/6.2.1/ --with-libxml2-dir=/usr/local/Cellar/xml2/2.7.8

Hope that helps

Woeful answered 11/8, 2011 at 4:2 Comment(9)
Hmm....brew seems to not be installed so I tried /usr/bin/ruby -e "$(curl -fsSL raw.github.com/gist/323731)" No go. I am apparently not in the "staff group" whatever that means. Do you know how I can get around that?Deoxyribonuclease
Managed to follow your instructions and wound up with a slightly different error unfortunately. Will update the problem description.Deoxyribonuclease
It might be a bit overkill but you can run the following: sudo chown -R whoami /usr/local I think most of the brew install problems are due to lack of permissions on /usr/localWoeful
Actually did you run this: brew install libiconv brew link libiconv It might necessary to also add the flag --with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1 to your rvm commandWoeful
I managed to get brew installed, so my problem has shifted. :) Now I'm getting: missing required architecture x86_64 in file for architecture x86_64Deoxyribonuclease
Try adding this to your .bash_profile as well and see if it helps: export CC=/usr/bin/gcc-4.2Woeful
No love. :( I tried all combinations of export CC=/usr/bin/gcc-4.2, export CC=gcc-4.2, and export ARCHFLAGS="-arch x86_64" Same error.Deoxyribonuclease
I was just looking at your original post. Did you try installing libiconv with brew?Woeful
This worked for me as well. I had to pass rvm install the --force flag to restart the install process cleanly before it would work. Thanks!Eliza
W
5

I just had a similar error, and the previous answers didn't help me. I found the solution here: https://rvm.io/packages/readline

rvm pkg install readline
rvm reinstall 1.9.2 --with-readline-dir=$rvm_path/usr
Weinstein answered 8/5, 2012 at 17:50 Comment(0)
F
0

have you an updated Lion compatible version of Xcode? (4.1 I think)

Flap answered 8/8, 2011 at 0:8 Comment(0)
B
0
  1. Uninstall/remove all traces of manually installed old ruby versions and extras (sqlite3, libxml2-x.x.x, libxslt-x.x.x) from your /usr/local/ or wherever you installed them.
  2. Download and install JewlryBox http://unfiniti.com/software/mac/jewelrybox which is a RVM GUI interface for managing your rubies and gemsets.
  3. In JewlryBox, click "Add Ruby" and choose the version of ruby you want to install (I chose 64 bit, Enabled Shared and didn't check/tick the "Use clang" option).

Worked with OS X Lion 10.7.3 and Xcode 4.3 Command Line Tools installed.

Baier answered 27/2, 2012 at 22:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.