Well, that didn't seem to go too well.  It seems that somewhere in the
mkmf / extconf.rb soup the actual location of the mysql home has
gotten lost.  The only way this will work is if mysql is installed in /
usr/local, the default for the distributed precompiled version is to
go in /usr/local/mysql.


$ which ruby
/usr/bin/ruby
$ ruby --version
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
$ which rails
/usr/bin/rails
$ rails --version
Rails 2.2.2
$ which gem
/usr/bin/gem
$ gem --version
1.3.0
$ which mysql
/usr/local/mysql/bin/mysql
$ mysql --version
mysql  Ver 14.12 Distrib 5.0.51a, for apple-darwin8.6.0 (powerpc)
using readline 5.0
$ gem list mysql

*** LOCAL GEMS ***


$ sudo env ARCHFLAGS="" gem install mysql
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/
ruby
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/
mysql-2.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out
$

I haven't figured out how to pass "--with-mysql-dir" or any of the
other extconf.rb variants in on the command line so here's what I did.

1) Download the source from tmtm.org
2) Modify extconf.rb such that for line 15:
WAS:    inc, lib = dir_config('mysql', '/usr/local')
IS:         inc, lib = dir_config('mysql', '/usr/local/mysql')
3) Create  a mysql.gemspec thus:
#################
require 'rubygems'
require 'rake'

version = Dir.pwd.split(pattern="-").last

spec = Gem::Specification.new do |s|
  s.name = "mysql"
  s.version = "#{version}"
  s.email = "[EMAIL PROTECTED]"
  s.homepage = "http://www.tmtm.org/en/mysql/ruby/";
  s.platform = Gem::Platform::RUBY
  s.summary = "MySQL/Ruby provides the same functions for Ruby
programs that the MySQL C API provides for C programs."
  s.files = FileList['[A-Za-z]*'].to_a
  s.extensions = ["./extconf.rb"]
end

if $0 == __FILE__
  Gem::Builder.new(spec).build
end
#################

$ ruby --version
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
$ ruby mysql.gemspec
WARNING:  no author specified
WARNING:  no rubyforge_project specified
WARNING:  RDoc will not be generated (has_rdoc == false)
  Successfully built RubyGem
  Name: mysql
  Version: 2.8
  File: mysql-2.8.gem
$ gem --version
1.3.0
$ gem list mysql --local

*** LOCAL GEMS ***


$ sudo env ARCHFLAGS="" gem install mysql
Password:
Building native extensions.  This could take a while...
Successfully installed mysql-2.8
1 gem installed
$ gem list mysql --local

*** LOCAL GEMS ***

mysql (2.8)
$ cd /Library/Ruby/Gems/1.8/gems/mysql-2.8

$ ruby test.rb -- localhost rick tu44stu44 test222mysql_test
Loaded suite test
Started
...................................................................................................................
Finished in 3.697758 seconds.

115 tests, 391 assertions, 0 failures, 0 errors
$

so what do you think about that?
Rick

On Dec 2, 11:24 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Dec 3, 2:20 am, Rick <[EMAIL PROTECTED]> wrote:
>
> > Hey Joshua and Fred,
>
> > I agree with the general statement that installing the mysql gem has
> > gotten harder.  In fact, the only way I've been able to do it is by
> > pulling in the mysql-ruby source from tmtm.org, modifying the
> > extconf.rb file, and building my own gemspec.
>
> > I have been able to install versions from 2.7.0 through 2.8 on Mac OS
> > X under Ruby 1.8.7p72, Rails 2.2.2, Gem 1.3.1.  I don't have access to
> > a Windows system of any kind however so I don't know how portable my
> > change is.
>
> If you're dealing with the gem that is nothing to do with the rails
> version. The ruby version might have an impact though (I've been
> staying away from 1.8.7).
> Personally with ruby 1.8.6 I've had zero problems. It's a  bit of a
> coincidence timing wise but over the past week I've setup/helped setup
> 3 machines for our developers (2 macs, one ubuntu) and they've all
> gone swimmingly
>
> Fred
>
> > Rick
>
> > On Dec 2, 12:37 pm, Joshua Partogi <[EMAIL PROTECTED]> wrote:
>
> > > I was talking about the mysql ruby driver is not come bundled and
> > > installing it manually is not easy too.
>
> > > On Dec 3, 12:04 am, Frederick Cheung <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Dec 2, 12:50 pm, "Joshua Partogi" <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi all,
>
> > > > > I've been searching through the list about configuring MySQL adapter
> > > > > on Rails 2.2, and it seems that this question is asked over and over
> > > > > again without any solution :-D Why did Rails 2.2 made configuring the
> > > > > mysql driver so difficult? Why is it a move backward in Rails 2.2? Why
> > > > > isn't there any documentation on this at all while people keep asking
> > > > > this same question over and over again?
>
> > > > Are you talking about the removal of the pure ruby driver ?
> > > > I haven't moved most of the stuff I do to rails 2.2, but creating a
> > > > rails 2.2 app from scratch basically just worked in the same way as it
> > > > has ever done. (or are you talking about the change from mysql as a
> > > > default to sqlite3 ?)
>
> > > > Fred
>
> > > > > Cheers.
>
> > > > > --
> > > > > Not by might nor by power, but by His Spirit.
>
> > > > > Read my blog:http://joshuajava.wordpress.com/
> > > > > Follow me on twitter:http://twitter.com/jpartogi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to