From: hemant Date: 2007-05-03T02:02:46+09:00 Subject: Re: MySQL gem problem on OS X On 5/2/07, John Joyce wrote: > > On May 3, 2007, at 1:16 AM, Ryan Davis wrote: > > > > > On May 2, 2007, at 08:57 , John Joyce wrote: > > > >> On OS X 10.4.9 > >> > >> When trying to run a simple file starting with: > >> require 'rubygems' > >> require 'mysql' > >> ... > >> > >> I get this: > >> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > >> `gem_original_require': no such file to load -- mysql (LoadError) > >> from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ > >> custom_require.rb:27:in `require' > >> from mysql_ruby.rb:3 > >> > >> But when I do a local: > >> gem list my > >> > >> mysql (2.7) > >> > >> So I know it is there. Other gems seem fine. irb also says there > >> is no mysql gem. > >> MySQL is installed and running. With Rails it works. > >> What I am doing is not Rails, but is Ruby. > >> Can anybody help out? > > > > First, this is a good problem report. I'd like to see more people > > writing the list with such good problem descriptions. > > > > Has it ever worked? If not, then you probably ignored/missed an > > error on gem install with it complaining about not being able to > > build. There will be a log file in the gem's dir stating what went > > wrong. Chances are it is missing/unknown config/headers. Rebuild it > > by doing gem install again. You'll probably have to do something > > similar to: > > > > sudo gem install mysql -- --with-mysql-config=/opt/local/bin/ > > mysql_config5 > > Thanks for the compliment. I've seen enough help requests over the > years on lists like this and in person where people are indeed in > need but haven't thought about the right questions or presented all > the details. It's not their fault usually, they need to be gently > educated on how to ask for help with problems. It's like going to the > mechanic and saying "my car makes a strange noise". So the mechanic > learns to teach everyone how to report problems. We have to do that too. > > Anyway, I see from your response you are using MacPorts (a.k.a > DarwinPorts). > I'm not using that. (the convenience of package management, gem is no > exception, is also a problem when things do go wrong, because the > dependencies are hidden, so we don't know what they are) > > Yes, the mysql gem has worked. Rails with mysql depends on it. So it > works, or has worked before, or seemed to. > I stopped messing with Rails and decided to focus on getting a good > grounding in Ruby first since one of the big problems with the Rails > community is all the people who mistakenly believe Rails somehow > doesn't require Ruby or other skills. (some Rails based apps are > getting closer to being consumer-friendly like many PHP apps are, but > not quite there yet, and developing a Rails app will never be a no- > Ruby-knowledge-needed situation.) > > It's been a while and I didn't make notes at the time (my mistake) > but I seem to remember reinstalling this gem long ago. > > Rails works is no guarantee of the fact that, you have broken build of mysql C extension. Its because rails ships with its own drivers, which it will use, if it can't find native mysql drivers, which are a lot more faster. Now as zenspider said, please try to do "gem install mysql" and see if it gets installed properly. Because of various reasons I have seen, when native C extensions fail to build using gem command, they still get installed in WHATEVER_GEM_PATH. Of course, they are of little use and usually as zenspider suggested mkmf.log, contains a log of build errors. May be, in future, a failed build shouldn't install anything in WHATEVER_GEM_PATH and do proper reporting of errors.