I was about to start my first Rails 3 app and thought I would upgrade to the latest version of ruby before I did and the ruby fails to make correctly.
I'm using Snow leopard on the 32bit kernal at the moment and every time I try and run 1.9.2 whether it's through readline or ssl I still get the following error:
ld: warning: in ../../libruby.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: in /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
collect2: ld returned 1 exit status
make[1]: *** [../../.ext/i386-darwin10.5.0/tcltklib.bundle] Error 1
I tried using the 64 kernal using this among other as a guide http://www.markhneedham.com/blog/2010/07/08/installing-ruby-1-9-2-with-rvm-on-snow-leopard/ but then I get a similar message saying libxml1.dylib is failing because it's not set up to 64bit.
Has anyone got any ideas? it's driving me nuts...
Ok for anyone having the same issue as me I would suggest going to 64bit kernal - if your not sure how go here
I would then follow this excellent blog post
The only other thing I need to do above this post was as well as updating libxml I also had to update libxlst (which you can download from the same source). Once I ran the install checked it was pointing to the the correct kernal then everything updated fine.
Hope that helps anyone having the same issue!
You need to make sure your Ruby is 64-bit, and the native gem drivers match it. ruby -v on 64-bit Snow Leopard should display:
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
Your gems will complain about the architecture, returning the i386 fingerprint when there is a mismatch. To fix that you can try:
gem pristine --all
which should walk through all gems and reload them from the clean cached versions. In that process any native drives should be rebuilt.
Related
This question already has answers here:
Getting a "bad interpreter" error when using brew
(12 answers)
Closed 6 years ago.
DISCLAIMER: I am on a machine where numerous things have most probably been installed, uninstalled, moved around and/or somehow modified so I can't really provide a lot of information on what has happened before I got my hands on it. I would be more than grateful, however, to use this situation as an opportunity to better understand how all these tools work so please don't hesitate to answer even with steps I could probably follow to solve the problem I have.
Short Version:
rbenv is used for ruby and the current installed version is 2.3.0
brew -v outputs Homebrew 0.9.9 (no git repository)
Homebrew/homebrew-core (git revision 8427; last commit 2016-08-01)
The latest version of Xcode is installed and gcc outputs
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Now, I (suppossedly) "install" rails
(gem install rails outputs Successfully installed rails-5.0.0
1 gem installed)
but straight after that rails -v outputs -bash: /usr/local/bin/rails: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
Is there maybe some way to do a clean uninstall and install of all the aforementioned tools?
As per your suggestions to look in those other questions and after some more digging, I ended up limiting the error to Not a directory which led me to an rbenv issue that pointed me to the possibility of having /usr/local/bin at the head of my PATH after initializing rbenv. And, as jeremy writes, that's why invoking rails is finding the executable in /usr/local/bin/ instead of in /Users/michelfrechette/.rbenv/shims/. So I removed that line and problem solved!
Operating System I am using is Mac OSX Mountain Lion.
First I will give some back story on how this cluster F started. I am going through a Ruby on Rails Web development book. I want to use PostgreSQL as my server. Before today I was using sqlite3. I downloaded PostgreSQL 9.1 from there website. I used the DMG installer. Once I was done with the install process it asked me to re-boot because of some sort of memory problem, I did that and it installed without error.
The problem started when I tried to use the "Rails Server" command in the terminal. This is what I got (I tried to strip out the unimportant stuff which would clutter everything up)
/Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg.rb:4:in `require': dlopen(/Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libcrypto.dylib (LoadError)
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libcrypto.0.9.8.dylib provides version 0.9.8 - /Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg_ext.bundle
...
from /Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/commands.rb:50:in
I have read through the out put and I have done a lot of Google searching, and what I have found is that it's a problem with which version of libcrypto the server is fetching. Or something about the libssl. I have gone through the solutions on google and nothing seems to be working. Hopefully someone has had the same problem I have, and can help me.
Thanks in advance! -Chris
I really recommend you to use Homebrew to install postrgresql. It helps you to install all proper dependencies for version which correctly works with rails.
$ brew install postgresql
Do not forget to follow after install instructions from homebrew
Are you sure you installed PostgreSQL server/rubygem successfully? From the stack trace I think there's a problem about it.
If your PostgreSQL server/rubygem are working well, then switch another webserver, mongrel/thin are both OK, both have better performance than the default rails server(webrick) and easy to use.
I have read just about every post regarding rails errors looking for the solution to my issues and while I have resolved some, I come up with more. I upgraded to Snow Leopard and installed RVM and Rails according to the Agile Development with Rails book. However once I create my app folders and do RAKE, I get this error and I just can not figure out how to fix it. I've tried re-installing everything several times to no avail. Is this an architecture problem? or do I need to find a library and load it? how do I do that?
rake aborted!
dlopen(/opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
Referenced from: /opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle
Reason: no suitable image found. Did find:
/opt/local/lib/libcrypto.1.0.0.dylib: mach-o, but wrong architecture - /opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle
(See full trace by running task with --trace)
There was probably a change in your system. You might have moved or deleted some files or folders, which were needed by ruby.
rvm reinstall ree
Or spyle's answer is basically correct, but ewww macports. go go Homebrew!
I had this problem with ruby 1.8.7/passenger/apache stack. Reinstalling ruby (via macports) and rebuilding it against the openssl library fixed this for me.
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.
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.
add --with-gcc=clang as a parameter:
rvm install ruby-1.9.3 --with-gcc=clang
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
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.
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
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.
dyld: Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib
Referenced from: /opt/local/bin/identify
Reason: image not found
Does anyone have a solution? Would upgrading Xcode to 4.1 help?
I'd recommend installing the latest XCode, 4.1, from the App Store before you do anything else, so as to get the latest build tools and dev libraries.
You'll likely need to recompile any Gems with native bindings (which it looks like you have, since something is looking for OpenCL, likely not RSPec itself).
To recompile all your gems run:
gem pristine --all
dydl errors are commonly associated with database drivers/bindings. Try re-installing your database if neither of the above work.
Your /opt/local/bin/identify is probably ImageMagick’s identify.
You probably need to rebuild your installation of ImageMagick. Based on the pathname (/opt/local/), you probably installed it as a part of MacPorts.
You should probably follow the instructions for Migrating a MacPorts install to a new major OS version or CPU architecture: install new Xcode, install latest MacPorts base, record installed ports, remove ports, reinstall ports.
Unfortunately, MacPorts’ bug #30322 indicates that the ImageMagick port may not yet build properly under Lion (found via MacPorts’ Lion Problems page).
I had a problem similar to this after a clean install of Lion, with Xcode 4.1 installed (both from the Mac App Store).
What eventually fixed it was running sudo gem install rspec -v 2.6.0. The actual problem (for me, your mileage may vary) was that the script stub wasn't being installed in /usr/bin, which meant the OS couldn't find RSpec without a full path spec.