Ruby, RVM, LLVM and MySQL

2019-01-16 05:00发布

I'm having big trouble in configuring Ruby and MySQL on MacOSX. Just a fact, I'm new on MacOSX and Ruby On Rails.

So, first I was having problems to install mysql2 gem, after get the gem installed I was trying developer a test, and when I tried start the WEBrick got this error saying that couldn't load a MySQL lib called "libmysqlclient.18.dylib". Googlin' about the error I saw that everyone was recommending using Ruby through RVM. I installed RVM and tried install ruby 1.9.3 and get this error:

ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read rvm requirements.

I'm almost giving up learn Rails, setup a development environment shouldn't be that painful. On Windows I got no problems.

[]'s Renan

6条回答
你好瞎i
2楼-- · 2019-01-16 05:22

Unfortunately, you're trying Rails at a bit of a bad time. There's a lot of transition at the moment, as others have mentioned Xcode 4.2 was recently released and has a new compiler, also Ruby 1.9.3 came out.

I've been developing Ruby and Rails for some years now, but trying to get up and running again after installing Lion clean this week has been more problematic than in the past.

First, make sure RVM is up to date (as the issue should be fixed):

rvm get head

Then try installing like so:

CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

EDIT:

Note, working through my own issues I believe the first command probably fixed the problem. The second wouldn't have provided any benefit over:

rvm install 1.9.3

As on my clean install, /usr/bin/gcc-4.2 doesn't exist.

Also I wanted to add that I ended up compiling the older GCC manually for those situations where the new compiler fails. I followed this very informative blog post.

查看更多
闹够了就滚
3楼-- · 2019-01-16 05:25

Thanks Delamenko finally got it to work

SUMMARY FOR STACK OVERFLOW

I was trying to install SiriProxy on a clean Lion installation on Xcode from App Store

I kept getting errors like : The provided CC(/usr/bin/gcc) is LLVM based.

bash-3.2$ rvm install 1.9.3
ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

After 2 days finally got it working with these two lines

http://stackoverflow.com/questions/8000145/ruby-rvm-llvm-and-mysql

bash-3.2$ rvm get head
bash-3.2$ CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

Before that I had tried every stackoverflow article on Ruby and Lion so doing these may have done some setup that helped the above 2 steps work:

Things I tried included:

Running Install Xcode.app (I had downloaded from App Store - running this does futher installation)

Installing

https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC.

Set up CC in

more /Users//.bash_profile

bash-3.2$ more /Users/<USERNAME>/.bash_profile 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
export CC=/usr/share/TargetConfigs/bin/gcc

First line came from SiriProxy install instruction https://github.com/plamoni/SiriProxy

2nd line export CC never seemed to work. So dont add.

It had many versions each pointing I finally used CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

查看更多
可以哭但决不认输i
4楼-- · 2019-01-16 05:30

Part of the problem is that with Mac OS X 10.7 (Lion), Apple switched C compilers, and some things don't build well with the new (LLVM) compiler yet. See http://eddorre.com/posts/rails-ultimate-install-guide-on-os-x-lion-using-rvm-homebrew-and-pow for decent instructions (note: I haven't followed these exact instructions, but they're a pretty good summary of the things I did do to get Rails working on Lion).

Once you have the C compiler issue dealt with, everything else should be pretty effortless.

Bonus tip: avoid MySQL. PostgreSQL is better in nearly every respect.

查看更多
冷血范
5楼-- · 2019-01-16 05:36

add --with-gcc=clang as a parameter:

rvm install ruby-1.9.3 --with-gcc=clang
查看更多
孤傲高冷的网名
6楼-- · 2019-01-16 05:37

See Arkku's answer - I tried everything here first, then did what he said and all is well.

As of Lion 10.7.3, Xcode 4.2 and Ruby 1.9.3p0 it's what works.

查看更多
Bombasti
7楼-- · 2019-01-16 05:39

Did you install the latest Xcode from Mac Store?

here is a nice guide i followed to update my ruby/Rails to 1.9.2/3.0

guide

good luck

查看更多
登录 后发表回答