Archive for October, 2012

Compiling load81 on Mac OS X 10.7+ with brew

I use the great project ‘load81’ (https://github.com/antirez/load81) by Antirez (Redis fame) to work on algorithms on the road on my Pandora (http://openpandora.org) which is great fun and easy. Load81 allows you to code in the nice Lua language which is easy to learn and once mastered works on many platforms, especially if you are into game coding.

Normally I just send the code from the Pandora to github from which point the developer (a colleague or myself) can use the fleshed out algorithm to implement the required solution. 
This works well and so far I didn’t feel the need to execute the code on my macbook. Today that changed however; I finished a complete working game (WIP but working to show the algorithm and test the game play) and I wanted to test it on my macbook with my colleagues. 
I’m using brew here and your mileage may vary, but I did discover a snag
brew install pkg-config
brew install sdl 
brew install sdl_image
brew install sdl_gfx
git clone git://github.com/antirez/load81.git
cd load81
make
This resulted in an error; 

Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc’
to the PKG_CONFIG_PATH environment variable

Fixed with;
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Another make resulted in the following error: 

framebuffer.h:7:23: error: SDL_image.h: No such file or directory

Which seemed to be a bug in the brew package; 
sudo nano /usr/local/lib/pkgconfig/SDL_image.pc
shows on line #1: prefix=/usr/local
which should be; 
prefix=/usr/local/Cellar/sdl_image/1.2.10
After that  make works fine and you can use load81: 
./load81 examples/text.lua
Have fun!