configuration error in RVM - ruby

I am trying to download ruby 1.9.3 (for learning purposes, this is the version in the book)
When I run $rvm install 1.9.3 I get a configuration error:
Error running './configure --prefix=/Users/john/.rvm/rubies/ruby-1.9.3-p545 --with-opt-dir=/usr/local/Cellar/libyaml/0.1.6:/usr/local/Cellar/readline/6.3.3:/usr/local/Cellar/libksba/1.3.0:/usr/local/Cellar/openssl/1.0.1g --without-tcl --without-tk --disable-install-doc --enable-shared',
showing last 15 lines of /Users/john/.rvm/log/1398181983_ruby-1.9.3-p545/configure.log
Then the last 15 lines are:
[2014-04-22 10:53:15] ./configure
current path: /Users/john/.rvm/src/ruby-1.9.3-p545
PATH=/usr/local/Cellar/pkg-config/0.28/bin:/usr/local/Cellar/libtool/2.4.2/bin:/usr/local/Cellar/automake/1.14.1/bin:/usr/local/Cellar/autoconf/2.69/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/john/.rvm/bin:/Users/john/.rvm/bin
command(7): ./configure --prefix=/Users/john/.rvm/rubies/ruby-1.9.3-p545 --with-opt-dir=/usr/local/Cellar/libyaml/0.1.6:/usr/local/Cellar/readline/6.3.3:/usr/local/Cellar/libksba/1.3.0:/usr/local/Cellar/openssl/1.0.1g --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin13.1.0
checking host system type... i386-apple-darwin13.1.0
checking target system type... i386-apple-darwin13.1.0
checking whether the C compiler works... no
configure: error: in `/Users/john/.rvm/src/ruby-1.9.3-p545':
configure: error: C compiler cannot create executables
Does anyone know what is wrong here? Since I'm new, I'm assuming it is something simple...
Thanks in advance!

Issue is with the c compliers. You should be doing
sudo apt-get install clang && rvm install 1.9.3 --with-gcc=clang

Related

Mac OS - m1: Can't install ruby 2.7.5 because of an error from configure

I need to install ruby 2.7.5 for my react native app but I can't install 2.7.5 through rvm. I tried many things to install any ruby version, I ended up to get this configure error.
Error running './configure --prefix=/Users/myname/.rvm/rubies/ruby-2.1.1 --disable-install-doc --enable-shared',
please read /Users/myname/.rvm/log/1672107647_ruby-2.1.1/configure.log
There has been an error while running configure. Halting the installation.
Here is the configure log
configure: WARNING: you should use --build, --host, --target
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... arm-apple-darwin22.2.0
checking host system type... arm-apple-darwin22.2.0
checking target system type... arm-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I tried...
remove rvm and reinstall
rvm install 2.7.5
rvm install ruby-2.7.5
use rbenv
install openssl
brew install openssl
rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl
remove rvm by using rvm implode
all those throw same error message. After trying 4., all ruby versions are removed but still can't install any ruby version.
Please help!!!
Edit
I tried
CFLAGS="-Wno-error=implicit-function-declaration" rvm install 2.7.5
and got this error
Error running './configure --prefix=/Users/myname/.rvm/rubies/ruby-2.7.5 --with-opt-dir=/opt/homebrew/opt/libyaml:/opt/homebrew/opt/libksba:/opt/homebrew/opt/readline:/opt/homebrew/opt/zlib:/opt/homebrew/opt/openssl#1.1 --disable-install-doc --enable-shared',
please read /Users/myname/.rvm/log/1672116807_ruby-2.7.5/configure.log
There has been an error while running configure. Halting the installation.
EDIT-----
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl#1.1/lib/pkgconfig"
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
rvm install 2.7.5
this returns same error
but I got this configure log
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... aarch64-apple-darwin22.2.0
checking host system type... aarch64-apple-darwin22.2.0
checking target system type... aarch64-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.5':
configure: error: cannot run C compiled programs. // <---- new!
If you meant to cross compile, use `--host'.
See `config.log' for more details
------ EDIT --------
after 2days, I try to install 2.7.6 and got this message again.
checking for ruby... /Users/myname/.rvm/rubies/ruby-2.7.5/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... aarch64-apple-darwin22.2.0
checking host system type... aarch64-apple-darwin22.2.0
checking target system type... aarch64-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.6':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Add Command Line Tools:
Ensure the command line tools are correctly installed. We might need to reinstall Xcode after OS upgrades.
Here are the exact steps to follow assuming we have openssl installed
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl#1.1/lib/pkgconfig"
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
rvm install 2.7.5
Do you have xcode developer tools installed? Run this "xcode-select --install"
xcode-select --install
Once you have developer tools installed you may need to refer to this comment:-
https://github.com/rbenv/ruby-build/discussions/1947#discussioncomment-2317356

I am not able to install ruby via rvm

My Config log file is -
./configure
current path: /home/username/.rvm/src/ruby-2.1.6
PATH=/usr/local/jdk/bin:/home/username/perl5/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin:/home/username/.rvm/bin:/home/username/bin:/home/username/.rvm/bin
command(4): ./configure --prefix=/home/username/.rvm/rubies/ruby-2.1.6 --disable-install-doc --enable-shared
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/username/.rvm/src/ruby-2.1.6':
configure: error: C compiler cannot create executables
See `config.log' for more details
gcc already installed -
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
I guess you do not have the required packages (dependencies) to install ruby via rvm.
Following steps should help you out:
yum install gcc-c++ patch readline readline-devel zlib zlib-devel
yum install libyaml-devel libffi-devel openssl-devel make
yum install bzip2 autoconf automake libtool bison iconv-devel
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install 2.1.2
rvm use 2.1.2 --default
Now check your ruby version:
ruby --version
Check out http://tecadmin.net/install-ruby-2-1-on-centos-rhel/ for more details
There must be some problem with your host compiler GCC.
Another issue may be binutils.
At any rate, you should first try to see if you can compile other C-based programs.
I also recommend you wget ftp://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.xz extract it and have a look what happens if you compile it (you can compile into an /opt prefix for now; you can use rvm lateron anyway; ./configure --prefix=/opt/ruby/2.2.2; make; make install)
This may possibly fail, have a look at config.log then. Often, but not always, config.log will have the specific error.
I assume that your compile toolchain is not complete.

Installing RVM getting errors with configure

I'm getting errors installing RVM, I have installed Ruby 2.0.0 with brew, and now I'm trying to run the RVM command at http://www.rvm.io
Error running './configure --prefix=/Users/name/.rvm/rubies/ruby-2.0.0-p0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libxml2:/usr/local/opt/libxslt:/usr/local/opt/libksba:/usr/local/opt/openssl:/usr/local/opt/sqlite --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /Users/name/.rvm/log/ruby-2.0.0-p0/configure.log
There has been an error while running configure. Halting the installation.
This is what my log looks like
[2013-04-10 21:50:21] ./configure
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin12.3.0
checking host system type... i386-apple-darwin12.3.0
checking target system type... i386-apple-darwin12.3.0
checking for gcc-4.2... no
checking for clang... no
checking for gcc... no
checking for cc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/name/.rvm/src/ruby-2.0.0-p0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
I have Xcode installed too.
Do you have Xcode installed? You then have to go into its preference window to install the command line tools. Take a look at this question.

Errors installing Ruby 1.9.3 using RVM

I'm trying to install Ruby 1.9.3-p385 on my work machine using Mountain Lion.
I've installed RVM and run
rvm install 1.9.3
But I get this error...
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p385 --with-opt-dir=/usr/local/rvm/usr --disable-shared', please read /usr/local/rvm/log/ruby-1.9.3-p385/configure.log
There has been an error while running configure. Halting the installation.
This is the contents of configure.log that the error points to...
[2013-02-18 10:10:50] ./configure
checking build system type... x86_64-apple-darwin12.2.1
checking host system type... x86_64-apple-darwin12.2.1
checking target system type... x86_64-apple-darwin12.2.1
checking whether the C compiler works... no
configure: error: in `/usr/local/rvm/src/ruby-1.9.3-p385':
configure: error: C compiler cannot create executables
See `config.log' for more details
It's all a bit cryptic to me. If anyone can help it would be appreciated.
This is problem with railsinstaller default settings, check this answer https://stackoverflow.com/a/12929017/497756
See this question and my answer.
To sum up, install MacPorts and run:
sudo port selfupdate
sudo port install gcc-apple42
CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl

checking whether the C compiler works... no

I recently uninstalled Xcode 4.2 and re-installed Xcode 4.3.1. Installed Command Line Tools also. The error says 'C compiler doesn't work`. On searching for this error, it said that it happens when Xcode is not installed. What am I missing?
rvm install 1.9.3 --with-gcc=clang
Installing Ruby from source to: /Users/ava/.rvm/rubies/ruby-1.9.3-preview1, this may take a while depending on your cpu(s)...
ruby-1.9.3-preview1 - #fetching
ruby-1.9.3-preview1 - #extracting ruby-1.9.3-preview1 to /Users/ava/.rvm/src/ruby-1.9.3-preview1
ruby-1.9.3-preview1 - #extracted to /Users/ava/.rvm/src/ruby-1.9.3-preview1
Fetching yaml-0.1.4.tar.gz to /Users/ava/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/ava/.rvm/src
Configuring yaml in /Users/ava/.rvm/src/yaml-0.1.4.
ERROR: Error running ' ./configure --prefix="/Users/ava/.rvm/usr" --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/configure.log
Compiling yaml in /Users/ava/.rvm/src/yaml-0.1.4.
ERROR: Error running '/usr/bin/make ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/make.log
Installing yaml to /Users/ava/.rvm/usr
ERROR: Error running '/usr/bin/make install', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/yaml/make.install.log
ruby-1.9.3-preview1 - #configuring
ERROR: Error running ' ./configure --prefix=/Users/ava/.rvm/rubies/ruby-1.9.3-preview1 --enable-shared --disable-install-doc --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --with-libyaml-dir=/Users/ava/.rvm/usr ', please read /Users/ava/.rvm/log/ruby-1.9.3-preview1/configure.log
ERROR: There has been an error while running configure. Halting the installation.
➜ yaml git:(master) ✗ vi configure.log
[2012-03-18 21:03:00] ./configure --prefix="/Users/ava/.rvm/usr" --with-gcc=clang --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0 --build=x86_64-apple-darwin11.3.0 --host=x86_64-apple-darwin11.3.0
configure: WARNING: unrecognized options: --with-gcc
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for x86_64-apple-darwin11.3.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/ava/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
➜ ~ git:(master) ✗ 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)
➜ ~ git:(master) ✗ which gcc
/usr/bin/gcc
In the Terminal:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Also, in Xcode, make sure the Command Line Tools are installed. Choose Xcode > Preferences, click on Downloads, and if necessary, click the Install button next to "Command Line Tools".
you use old RVM which does not know about latest ruby pathclevel, update with rvm get head
Ruby is not yet fully ready for LLVM, your get best chances for compilation using osx-gcc-installer and --with-gcc=gcc-4.2
I fixed it by running :
rvm install <ruby-version> --with-gcc=clang
Replace < ruby-version> with version you want to use
For those out there running into the same problem,
System (in order of installation)
OSX 10.7.3
RVM
XCode 4.3
Developer Tools (through XCode Preferences > Downloads)
OSX-GCC-Installer-10.7
I had set LDFLAGS and CPPFLAGS to point to Homebrew installations, this resulted in errors. I "unlinked" LDFLAGS and CPPFLAGS, ran 'rvm install 1.9.2' and everything worked fine.
rvm install 1.9.2
Try ./configure --without-gcc to use clang.
I'm on Mavericks and the provided answers didn't work for me. However, updating my version of Xcode and making sure Command Line Tools are installed did the trick.
It is a lot easier to install by using the compiler the system knows about
1. rvm install ruby-1.9.3-p547 --with-gcc=`echo which gcc`

Resources