Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Ruby Installation Error #436

Closed
sturma opened this issue Feb 7, 2013 · 8 comments
Closed

Ruby Installation Error #436

sturma opened this issue Feb 7, 2013 · 8 comments

Comments

@sturma
Copy link

sturma commented Feb 7, 2013

While installing ruby on Mac Mountain Lion, I get the following error:

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p385.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/alex/.rvm/archives
Extracting yaml to /Users/alex/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/alex/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/alex/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/alex/.rvm/usr
Installing Ruby from source to: /Users/alex/.rvm/rubies/ruby-1.9.3-p385, this may take a while depending on your cpu(s)...
ruby-1.9.3-p385 - #downloading ruby-1.9.3-p385, this may take a while depending on your connection...
ruby-1.9.3-p385 - #extracted to /Users/alex/.rvm/src/ruby-1.9.3-p385 (already extracted)
ruby-1.9.3-p385 - #configuring
ruby-1.9.3-p385 - #compiling
Error running 'make', please read /Users/alex/.rvm/log/ruby-1.9.3-p385/make.log
There has been an error while running make. Halting the installation.

Looking at the make.log file:

[2013-02-07 19:58:28] make
    CC = clang
    LD = ld
    LDSHARED = clang -dynamic -bundle
    CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration  -pipe 
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/Users/alex/.rvm/usr/include -I. -I.ext/include/x86_64-darwin12.1.0 -I./include -I.
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  
    SOLIBS = 
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    return t->num_entries;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1

I have installed latest Xcode 4, and also tried the workaround of issue #168; no success.

@sturma
Copy link
Author

sturma commented Feb 8, 2013

ok, solved!

  • uninstalled Xcode
  • installed macports
  • executed 'sudo port selfupdate'
  • executed 'sudo port install apple-gcc42'
  • rvm install 1.9.3: finished successfully

@nesv
Copy link

nesv commented Feb 11, 2013

I came across this issue while searching because I was experiencing the exact same issue while using rvm to install ruby-1.9.3-p385.

You do not need to uninstall Xcode. If you have Xcode installed, and you are using Homebrew, you can just do the following:

$ brew tap homebrew/dupes
$ brew install apple-gcc42

@dhull
Copy link

dhull commented Feb 11, 2013

This does look like an error in Ruby's onig_number_of_names function. The num_entries field in the st_table of type st_index_t which is ultimately unsigned long, but onig_number_of_names returns int.

@uasi
Copy link

uasi commented Feb 12, 2013

Without uninstalling Xcode or installing apple-gcc42, just turning off the -Werror will do: CFLAGS="-Wno-error=shorten-64-to-32" rvm install ...

@peterpeng001
Copy link

Just do this:
export CC=gcc

It solves my error.

@terratakashi
Copy link

export CC=gcc

It solved my problem too.

@uasi
Copy link

uasi commented Feb 25, 2013

It is said that gcc shipped with Xcode 4.x (which is actually llvm-gcc) is buggy: rbenv/ruby-build#290 (comment)
Maybe it's not right to do export CC=gcc.

@paulwalker
Copy link

export CC=gcc just sets it for that terminal session. if you want to just even use it for this use case only:

CC=gcc rvm install 1.9.3

which worked for me. no need to un-install xcode

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants