Here's what I get when I try to install Ruby 2.2:
$ ruby-install ruby 2.2.10
# ...
>>> Compiling ruby 2.2.10 ...
CC = clang
LD = ld
LDSHARED = clang -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I/opt/X11/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin19 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/openssl#1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework CoreFoundation
SOLIBS = -lgmp
Apple clang version 12.0.0 (clang-1200.0.31.1)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
translating probes probes.d
. ./vm_opts.h
file2lastrev.rb: does not seem to be under a vcs: .
make: [.revision.time] Error 1 (ignored)
./revision.h unchanged
compiling main.c
compiling dmydln.c
compiling miniinit.c
compiling miniprelude.c
compiling array.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
1 error generated.
make: *** [encoding.o] Error 1
!!! Compiling ruby 2.2.10 failed!
OS Version: 10.15.6
ruby-install version: 0.7.1
Any ideas on how to debug or fix this? I was previously able to install other versions of 2.2 before I upgraded my OS. I'm also able to install later versions like Ruby 2.7 with no problem
After a lot of breaking my head and realizing that the error has to do with the compilation using GCC that is native to macOS, I decided to do a test.
Because older versions of Ruby need instructions that are no longer present in updated make, it is necessary to download an older version of Command Line Tools for Xcode.
First, remove your actual version with:
sudo rm -rf /Library/Developer/CommandLineTools
Ignore the error about missing git.
Proceed to https://developer.apple.com/download/more/ and download 11.x version of Command Line Tools for Xcode.
I downloaded version 11.5 and it worked.
My return when running gcc -v
Configured with: --prefix = / Library / Developer / CommandLineTools / usr --with-gxx-include-dir = / Library / Developer / CommandLineTools / SDKs / MacOSX.sdk / usr / include / c ++ / 4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: / Library / Developer / CommandLineTools / usr / bin
To compare, with recent Command Lines, 12.x, you'll see something like:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Apparently ignoring the compiler warning is also an option
export optflags="-Wno-error=implicit-function-declaration"
For further duscussion see Problem when installing Ruby 2.2.9 on Mac Big Sur M1
I was able to install that version on Mac 10.15.7 using rvm.
I have openssl#1.1 installed with homebrew. If you run brew info openssl what do you see? I would try brew upgrade openssl first.
Try running
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig" with the info brew returns. Then try rvm install 2.2.10. If that doesn't work I would try rvm install 2.2.10 --with-openssl-dir=/usr/local/opt/openssl --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include just make sure those paths are correct for your system.
You may also need to run
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
beforehand, which will be supplied by brew info.
Adding some extra options here that might help:
We need the right SSL version:
$ brew install rbenv/tap/openssl#1.0
$ rvm install 2.2.10 -C --with-openssl-dir=`brew --prefix openssl#1.0`
First, install open-ssl
brew install rbenv/tap/openssl#1.0
Then
CFLAGS="-Wno-error=implicit-function-declaration" rvm reinstall ruby-2.2.5 --with-openssl-dir='/usr/local/opt/openssl#1.0'
I recently had to install ruby-2.2.0 in Catalina 10.15.7 and was facing the same issues. But luckily managed to get my work done. Steps are as follows:
Installed openssl as a rvm package:
$ rvm pkg install openssl
Ignored compiler warnings:
$ export optflags="-Wno-error=implicit-function-declaration"
Installed required ruby version (2.2.0 in my case) while providing openssl directory parameter and ignoring rubygems:
$ rvm install 2.2.0 --with-openssl-dir=$rvm_path/usr --rubygems ignore
Related
I am trying to install ruby 2.7.0 version on mac(12.2.1) using rvm but getting below error, and tried all the solution possible on github nothing seems to work. Even tried using rbenv but same error. Please help, thank you in advance.
rashmi.b#xxxx Documents % rvm install 2.7.0
ruby-2.7.0 - #removing src/ruby-2.7.0 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/12.2/x86_64/ruby-2.7.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/rashmi.b/.rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection...
ruby-2.7.0 - #extracting ruby-2.7.0 to /Users/rashmi.b/.rvm/src/ruby-2.7.0 - please wait
ruby-2.7.0 - #configuring - please wait
ruby-2.7.0 - #post-configuration - please wait
ruby-2.7.0 - #compiling - please wait
ruby-2.7.0 - #installing - please wait
Error running '__rvm_make install',
please read /Users/rashmi.b/.rvm/log/1647236002_ruby-2.7.0/install.log
There has been an error while running make install. Halting the installation.
/Users/rashmi.b/.rvm/log/1647236002_ruby-2.7.0/install.log =>
generating x86_64-darwin21-fake.rb
x86_64-darwin21-fake.rb updated
BASERUBY = /usr/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99 -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-darwin21 -I./include -I. -I./enc/unicode/12.1.0
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl#1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl#1.1/lib -install_name /Users/rashmi.b/.rvm/rubies/ruby-2.7.0/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.0 -fstack-protector-strong -framework Security -framework Foundation -fstack-protector-strong -framework Security -framework Foundation
SOLIBS = -lpthread -lgmp -ldl -lobjc
LANG =
LC_ALL =
LC_CTYPE = UTF-8
MFLAGS =
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
generating enc.mk
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
generating makefiles ext/configure-ext.mk
ext/configure-ext.mk updated
generating makefile exts.mk
exts.mk unchanged
./revision.h unchanged
make[1]: Nothing to be done for `note'.
making enc
make[1]: Nothing to be done for `enc'.
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
make[1]: Nothing to be done for `encs'.
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-darwin21-fake ./tool/rbinstall.rb --make="/Library/Developer/CommandLineTools/usr/bin/make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --exclude=doc
make: *** [do-install-nodoc] Killed: 9
+__rvm_make:0> return 2
Openssl version - 3.0.1 14
It seems that something forcefully killed your compilation process. Unfortunately, it's not clear what external process that was, but it might be some virus scanner or other security software on your mac.
In any case, please be aware that no released Ruby supports OpenSSL 3.0 yet. You have to use OpenSSL 1.1.1 in the meantime.
If any one face problem with OSX Montrerey and installing Ruby 2.7.0 use the following instead of wasting so much trying:
brew install ruby-build
brew install rbenv
CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.7.0
rbenv global 2.7.0
rbenv local --unset
rbenv init -
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source of second half of solution is here to select the version you just installed by the OS
https://stackoverflow.com/a/39238995/3086197
replace 2.7.0 with the version you need
I had the same issue and fixed it by running rvm install 2.7.3 -j 1
Error running '__rvm_make -j16'
Here's what I get when I try to install Ruby 2.2:
$ ruby-install ruby 2.2.10
# ...
>>> Compiling ruby 2.2.10 ...
CC = clang
LD = ld
LDSHARED = clang -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I/opt/X11/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin19 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/openssl#1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework CoreFoundation
SOLIBS = -lgmp
Apple clang version 12.0.0 (clang-1200.0.31.1)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
translating probes probes.d
. ./vm_opts.h
file2lastrev.rb: does not seem to be under a vcs: .
make: [.revision.time] Error 1 (ignored)
./revision.h unchanged
compiling main.c
compiling dmydln.c
compiling miniinit.c
compiling miniprelude.c
compiling array.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
1 error generated.
make: *** [encoding.o] Error 1
!!! Compiling ruby 2.2.10 failed!
OS Version: 10.15.6
ruby-install version: 0.7.1
Any ideas on how to debug or fix this? I was previously able to install other versions of 2.2 before I upgraded my OS. I'm also able to install later versions like Ruby 2.7 with no problem
After a lot of breaking my head and realizing that the error has to do with the compilation using GCC that is native to macOS, I decided to do a test.
Because older versions of Ruby need instructions that are no longer present in updated make, it is necessary to download an older version of Command Line Tools for Xcode.
First, remove your actual version with:
sudo rm -rf /Library/Developer/CommandLineTools
Ignore the error about missing git.
Proceed to https://developer.apple.com/download/more/ and download 11.x version of Command Line Tools for Xcode.
I downloaded version 11.5 and it worked.
My return when running gcc -v
Configured with: --prefix = / Library / Developer / CommandLineTools / usr --with-gxx-include-dir = / Library / Developer / CommandLineTools / SDKs / MacOSX.sdk / usr / include / c ++ / 4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: / Library / Developer / CommandLineTools / usr / bin
To compare, with recent Command Lines, 12.x, you'll see something like:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Apparently ignoring the compiler warning is also an option
export optflags="-Wno-error=implicit-function-declaration"
For further duscussion see Problem when installing Ruby 2.2.9 on Mac Big Sur M1
I was able to install that version on Mac 10.15.7 using rvm.
I have openssl#1.1 installed with homebrew. If you run brew info openssl what do you see? I would try brew upgrade openssl first.
Try running
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig" with the info brew returns. Then try rvm install 2.2.10. If that doesn't work I would try rvm install 2.2.10 --with-openssl-dir=/usr/local/opt/openssl --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include just make sure those paths are correct for your system.
You may also need to run
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
beforehand, which will be supplied by brew info.
Adding some extra options here that might help:
We need the right SSL version:
$ brew install rbenv/tap/openssl#1.0
$ rvm install 2.2.10 -C --with-openssl-dir=`brew --prefix openssl#1.0`
First, install open-ssl
brew install rbenv/tap/openssl#1.0
Then
CFLAGS="-Wno-error=implicit-function-declaration" rvm reinstall ruby-2.2.5 --with-openssl-dir='/usr/local/opt/openssl#1.0'
I recently had to install ruby-2.2.0 in Catalina 10.15.7 and was facing the same issues. But luckily managed to get my work done. Steps are as follows:
Installed openssl as a rvm package:
$ rvm pkg install openssl
Ignored compiler warnings:
$ export optflags="-Wno-error=implicit-function-declaration"
Installed required ruby version (2.2.0 in my case) while providing openssl directory parameter and ignoring rubygems:
$ rvm install 2.2.0 --with-openssl-dir=$rvm_path/usr --rubygems ignore
I am trying to install Lektor on a MacbookPro with OS X 10.6.8.
Imagemagick and Python2.7 are already installed.
When I run the installation command:
curl -sf https://www.getlektor.com/install.sh | sh
The build process runs until it gets an error when building '_watchdog_fsevents' extension. The error is:
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
I've cut and pasted the output just prior to the error into the following code section.
How should I overcome this?
running build_ext
building '_watchdog_fsevents' extension
creating build/temp.macosx-10.6-x86_64-2.7
creating build/temp.macosx-10.6-x86_64-2.7/src
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -DWATCHDOG_VERSION_STRING="0.8.3" -DWATCHDOG_VERSION_MAJOR=0 -DWATCHDOG_VERSION_MINOR=8 -DWATCHDOG_VERSION_BUILD=3 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/watchdog_fsevents.c -o build/temp.macosx-10.6-x86_64-2.7/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-error=unused-command-line-argument-hard-error-in-future
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
error: command 'gcc-4.2' failed with exit status 1
----------------------------------------
Failed building wheel for watchdog
Failed to build watchdog
Most likely your version of OS X is too old to support the installation of watchdog with the version of gcc you have. If you cannot upgrade your OS X installation then I recommend installing a recent version of clang via brew and install lektor after exporting CC=clang.
Note though that Lektor is not tested for OS X < 10.9.
Your problem may be an updated version of Xcode in which you have not agreed to the license. Try running this first:
sudo xcodebuild -license
scroll to the very bottom and it will allow you to type "agree".
This resolved the issue for me.
When I execute
sudo pip install pandas
I get the error:
creating build/temp.macosx-10.9-intel-2.7/pandas/src/datetime
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -Ipandas/src/klib -Ipandas/src -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pandas/index.c -o build/temp.macosx-10.9-intel-2.7/pandas/index.o
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
I have installed xcode and xcode command line tools.
In fact, I can confirm that cc is installed by executing:
cc -v
which returns:
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
These flags ended up letting me install it:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
and then (of course):
sudo -E pip install pandas
Thanks #user3378649 for the flags suggestion - that got me thinking along the right track!
Can you please these commands for more information.
As long as you didn't mention what you used to overcome this problem, I'd suggest different approaches to help narrow down in order to find the problem:
First Solution :
Run these flags :
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
if it doesn't work
run these flags :
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Second Solution :
Get Homebrew - it's a one-line shell script to install!
Edit your .profile, or whatever is appropriate, and put /usr/local/bin at the start of -your PATH so that Homebrew binaries are found before system binaries
brew install python - this installs a newer version of python in /usr/local
run "pip install pandas"
Third Solution :
use easy_install.
Execute the following command in Terminal
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:$(PATH)}"
export PATH
Then :
$ sudo easy_install pandas
I've been trying to install Ruby on my Lion machine (OSX 10.7.3).
I installed rbenv and ruby-build and am trying to get 1.9.2-p290 on my machine. Here is the output of the install failing:
$ rbenv install 1.9.2-p290
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/CSC/.rbenv/versions/1.9.2-p290
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz...
Installing ruby-1.9.2-p290...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239
Results logged to /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239.log
Last 10 log lines:
/usr/bin/gcc-4.2 -I. -I../../../.ext/include/x86_64-darwin11.3.0 -I../../.././include -I../../.././ext/racc/cparse -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/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 -pipe -o cparse.o -c cparse.c
/usr/bin/gcc-4.2 -dynamic -bundle -o ../../../.ext/x86_64-darwin11.3.0/racc/cparse.bundle cparse.o -L. -L../../.. -L. -L'/Users/SamCouch/.rbenv/versions/1.9.2-p290/lib' -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lpthread -ldl -lobjc
compiling readline
/usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin11.3.0 -I../.././include -I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/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 -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: *** [mkmain.sh] Error 1
I attempted to troubleshoot the issue, but so far I haven't come up with any solution:
$ which gcc
/usr/bin/gcc
$ gcc
i686-apple-darwin11-llvm-gcc-4.2: no input files
$ ruby-build
ruby-build 20120216
usage: ruby-build [-v|--verbose] definition prefix
ruby-build --definitions
Any help would be greatly appreciated!
As a side note, I've tried other similar suggestions posted here, and none have worked for me.
Per ruby-build issue #130 the current workaround is:
env CC=/usr/bin/gcc rbenv install 1.9.3-p125
I've just tested this successfully on a system with:
OS X 10.7.3
Xcode 4.3.1
Command Line Tools for Xcode installed (via Xcode > Preferences > Downloads)
ruby-build # fbfa944
rbenv # 975b45d
Also, pending pull request #137 aims to fix this upstream once and for all.
FWIW, lots of folks are shaking out build chain issues with Xcode 4.3.x since it came out. Expect some instability in any system if you've upgraded to the new toolchain until the collective dust settles.
There seem to be two or three stack overflow questions related to bugs with using rbenv to install ruby 1.9.x on Mac OS X via homebrew / rbenv and I have tried the solutions for many of them without luck. Setting the compiler and installing the apple gcc42 compiler via homebrew didn't help ( brew install apple-gcc42 and CC=/usr/bin/gcc - no luck ) so I'm not sure if they are necessary. I'm using the rbenv manager and so this is what worked for me when trying to install 1.9.3-p385
The problem is with the readline as the log shows:
readline.c: In function ‘username_completion_proc_call’:
readline.c:1499: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:1499: error: (Each undeclared identifier is reported only once
readline.c:1499: error: for each function it appears in.)
So after looking specifically for that error I found the solution:
Solution:
brew install readline
CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p385
You can chance the rbenv install 1.9.3-p385 part of the command to match whatever version is latest or that you are trying to install. Found the note on this blog.
This may be answering on the level of what you need rather than on the level of what you're directly asking, but: have you considered simply using macports (see macports.org) or brew as a way of installing ruby 1.9? It works very well and with much less effort.
It's not exactly what you were asking for but "Can't install Ruby under Lion with RVM – GCC issues" answers how to get Ruby working on Lion with RVM. The errors are pretty similar so you could either:
Use them for some guidance for rbenv troubleshooting, or simply use RVM as described in the top answer to install Ruby that way. It seems like the easier method to me.