Haha! I solved the problem in the previous post with some cunning. And Google.
Basically, even though it looks like the mysql
gem has installed correctly, it won’t have, because, once you’ve upgraded to Xcode 2.1, gcc
is upgraded to 4.0. If you try and install the gem with gcc 4.0, it breaks. You need to install it with gcc 3.3 as your compiler. Doing this is as easy as typing
sudo gcc_select 3.3
in your terminal window before you run
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Once you’ve done all that, you can then type sudo gcc_select 4.o
to return things to normal.
Phew. Scaffolds now work. That was an exciting little detour.
Stefano | 27 Nov 2005
Tom,
this was a useful tip, however there must be something else to it. The following shows that your solution does not work for my system (OSX 10.4.3, MySQL 5.0, Ruby 1.8.2).
I am recording this next to your tip for the benefit of those like me who can’t get past the scaffold in RoR.
Best,
Stefano
stefano-bertolos-power-mac-g5:~/rails/depot stefano$ sudo gcc_select 3.3
Default compiler has been set to:
gcc version 3.3 20030304 (Apple Computer, Inc. build 1809)
stefano-bertolos-power-mac-g5:~/rails/depot stefano$ sudo gem install mysql — –with-mysql-dir=/usr/local/mysql
Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Building native extensions. This could take a while…
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:211: warning: Insecure world writable dir /usr/local, mode 040777
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:222: warning: Insecure world writable dir /usr/local, mode 040777
ld: truncated or malformed archive: /usr/local/mysql/lib/libmysqlclient.a (ranlib structures in table of contents extends past the end of the table of contents, can’t load from it)
make: *** [mysql.bundle] Error 1
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:224: warning: Insecure world writable dir /usr/local, mode 040777
ld: truncated or malformed archive: /usr/local/mysql/lib/libmysqlclient.a (ranlib structures in table of contents extends past the end of the table of contents, can’t load from it)
make: *** [mysql.bundle] Error 1
ruby extconf.rb install mysql — –with-mysql-dir=/usr/local/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
make
cc -dynamic -bundle -undefined suppress -flat_namespace -L”/usr/lib” -o mysql.bundle mysql.o -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lobjc
make install
cc -dynamic -bundle -undefined suppress -flat_namespace -L”/usr/lib” -o mysql.bundle mysql.o -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lobjc
Successfully installed mysql-2.7
stefano-bertolos-power-mac-g5:~/rails/depot stefano$ sudo gcc_select 4.0
Default compiler has been set to:
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)
stefano-bertolos-power-mac-g5:~/rails/depot stefano$ ruby script/generate scaffold Product Admin
exists app/controllers/
exists app/helpers/
exists app/views/admin
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/product.rb
identical test/unit/product_test.rb
identical test/fixtures/products.yml
Access denied for user ”@’localhost’ (using password: NO)
stefano-bertolos-power-mac-g5:~/rails/depot stefano$
Tom | 28 Nov 2005
Hmn. Not sure what the problem is, but I get a feeling it might be the “MySQL 5.0” part of your system. I’d check that there’s not a newer (less stable) version of the mysql gem for it. Also, check where Mysql is installed on your system – if it’s not in (or symlinked in) /usr/local/mysql, that would cause problems.
Finally, it’s giving a password error at the end – so it could be something to do with the new way of encrypting MySQL passwords (unless, of course, you’re just using no password for your account).
As a final measure: check out #rubyonrails on irc.freenode.net; they’re more knowledgable and helpful than I am, for sure. Thanks for your comment, anyhow, Stefano.
8 Aug 2005
Trackback: Infovore : Hear the Tiger RoR