Ruby, RVM, LLVM and MySQL

后端 未结 6 658
旧巷少年郎
旧巷少年郎 2020-12-07 12:42

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

相关标签:
6条回答
  • 2020-12-07 13:15

    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.

    0 讨论(0)
  • 2020-12-07 13:16

    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

    0 讨论(0)
  • 2020-12-07 13:26

    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.

    0 讨论(0)
  • 2020-12-07 13:27

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

    rvm install ruby-1.9.3 --with-gcc=clang
    
    0 讨论(0)
  • 2020-12-07 13:28

    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

    0 讨论(0)
  • 2020-12-07 13:39

    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.

    0 讨论(0)
提交回复
热议问题