Wow, so that was quite the annoying ride getting Ruby on Rails running. Through about a thousand posts, I finally stumbled into the right incantations to make it go. There seems to be a whole bunch of suggestions/tips out there, with very little explanation of what they do. I thought I'd try clearing some of that up by walking through the individual problems I had, and putting best guesses down as to the cause. Thanks a ton to Rufy.com's scripts for fixing some things. Without further fanfare and in order of appearance:
"No database selected: SHOW FIELDS FROM recipes"
This is because your mysql driver in Ruby is no good. You need to get a version that works with your version of mysql. This is a best guess; to fix, go grab the most recent from www.tmtm.org (I used to 2.7)
When tryiing to build the libraries, yo get:
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
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
The script can't find your mysql libraries. They are probably installed in /usr/local/mysql. Easiest fix is to put /usr/local/mysql/bin in your path and use the --with-mysql-config switch to gem (after a --) or whatever it is.
mysql.c: In function 'query':
mysql.c:635: error: invalid storage class for function 'res_free'
You're trying to build an older mysql-ruby lib with gcc 3.3, and it's not going. Some sites will recommend that you do "gcc_select 3.3", but that will get you a binary that will cause problems. Get a newer version (>2.6) that will build with gcc 4.0.
When building mysql-ruby libs:
lipo: can't figure out the architecture type of: /var/tmp//cc7tIymK.out
make: *** [mysql.o] Error 255
gcc: cannot read specs file for arch `i386'
make: *** [mysql.o] Error 1
You haven't "fixed" your ruby config file to properly build shared libraries (Tiger bug presumably). Run: "gem install fixrbconfig" as root and answer yes. This error should go away.
When you try to actually do something with the rails server, it crashes with:
dyld: NSLinkModule() error dyld: Symbol not found: _sprintf$LDBLStub Referenced from: /usr/lib/ruby/site_ruby/1.8/powerpc-darwin8.0/mysql.bundle Expected in: flat namespaceTrace/BPT trap
You are the man! As you said, all thses problems happen, and they all get solved using your methods. :-)
This is Rob Meyer's weblog, a weblog focused on software development and system administration based on 10 years of experience. Want to explore further? You can find out more me or see the rest of my website.
Wondering if I've written on something in particular? Try searching:
You might want to take a look at some of the more requested postings (as judged by incoming traffic):
Want more? Subscribe to this site
or contact me at rob at big dis dot com.
See my writings on: