Posts Tagged ‘rubygame’

OSX Lion Rubygame Install

Posted in Libraries on November 28th, 2011 by Jamie – Be the first to comment

I tried setting up Rubygame on Snow Leopard this time last year. I had many difficulties setting up SDL. I had some time to kill so I tried to set it up again, this time on my new MacBook Air running Lion.

This old blog post from 2005 helped me this time around: http://inquirylabs.com/blog2005/?p=21 to nail down the requirements. Instead of following the installation instructions here, I used Homebrew to set things up.

One of the key requirements is rubysdl, ruby bindings for the SDL multimedia library, and the rsdl gem. The following Gist is a rubysdl Homebrew formula that will help install the required packages: https://gist.github.com/1394440. The SGE formula is not part of the included formulas. I forked the following Gist to provide SGE: https://gist.github.com/1394414/.


# install the sge graphics lib
wget https://gist.github.com/raw/1394414/4a6bfa4a8bab179ebe263b1d044a4322c7628f60/sge.rb
brew install sge

# install rubysdl ruby sdl bindings
wget https://raw.github.com/gist/1394440/8a71160306ad277f08fbad3eaf028b2e8700f2f1/rubysdl.rb
brew install rubysdl

# install the required gem
gem install rsdl
gem install rubygame

Afterwards, most of the rubygame samples ran fine, but the ones requiring opengl had issues. I installed ruby 1.9.2 using rbenv, compiled a new dynamic library libruby.dylib, based on the 1.9.2 source. Then, I cloned this repo providing an upgraded ruby-opengl gem: https://github.com/theymaybecoders/ruby-opengl.

# clone the repo
git clone https://github.com/theymaybecoders/ruby-opengl
cd ruby-opengl

# make sure that the libruby.1.9.1.dylib compiled from the
# ruby 1.9.2 source is present in the gcc class path. For
# me, it was ~/.rbenv/versions/1.9.2-p290/lib/libruby.dylib
# use build option --enable-shared

rake

# build the gem
rake gem

# install the gem
gem install pkg/ruby-opengl-0.60.1.gem

Afterwards, the rubygame opengl samples compiled fine.

Ruby Hiccups

Posted in Libraries on January 28th, 2010 by Jamie – Be the first to comment

I decided to try out some Ruby stuff this weekend. I wanted to do a quick little game with the rubygame gem, but I got some weird error attempting to install it on my 64-bit Snow Leopard Intel Mac Powerbook. I abandoned the effort, since I hate to expend time in system administration and installation.

Next, I decided to try running through a Rails demo. I wanted to use MySQL instead of the default SQLite, but got an error, whose text is below, when I tried installing the mysql gem. I resolved it by using the command string that follows, which I found on a MySQL website forum post.  I think the main issue was that I had a non-standard installation of mysql on my machine via macports, so I had to specify the locations of the various MySQL directories in the gem install command.

Error:
cdERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb --with-mysql-dir=/opt/local/bin
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
checking for main() in -lmygcc... 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.

Command:

sudo gem install --include-dependencies mysql -- --with-mysql-dir=/opt/local/bin --with-mysql-config=/opt/local/bin/mysql_config5

Switch to our mobile site