« Previous - Version 8/35 (diff) - Next » - Current version
TomH, 07/01/2010 09:41 pm


Installing Luabind on Linux, Mac OS X, ...

Since luabind is not available from macports (I think certain Linux Distributions do not provide it too), here the short summary how to install luabind on a Unix like system :)

Installing lua

To build luabind, you need liblua. Install it, for example on a Mac using macports:

sudo port install lua

On Ubuntu 10.04:
sudo apt-get install liblua5.1-0-dev

On CentOS 5+

yum install lua-devel

Getting the source

While writing this, the most current version is 0.9. Get it!
On Mac OS X:

curl -O http://sunet.dl.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.tar.gz

On Linux:

wget http://sunet.dl.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.tar.gz

Extract the source

tar zxf luabind-0.9.tar.gz

Building and installing

On Ubuntu 10.04:

install boost build:

sudo apt-get install boost-build libboost1.40-dev

and compile / install with the following command:

sudo bjam --prefix=/usr/local install

On Mac OS X:

Bjam might be annoying and complicated, use this small build script. Put it in the luabind root directory.

This script is configured for a Mac OS X having lua and boost installed in /opt/local (using macports).
Please adjust LUA_INCLUDE_DIR, LUA_LIBRARY_DIR and LIB_EXTENSION if you have a different setup.

#!/bin/sh

LUA_INCLUDE_DIR=/opt/local/include
LUA_LIBRARY_DIR=/opt/local/lib
LIB_EXTENSION=dylib

rm -rf build
mkdir -p build/src

for i in src/*.cpp
do 
    gcc -I$LUA_INCLUDE_DIR -I. -fPIC -c $i -o build/$i.o
done

gcc -shared -o build/libluabind.$LIB_EXTENSION build/src/*.o \
    -L$LUA_LIBRARY_DIR -lstdc++ -llua

To install the thing, just copy lib and header into the preferred path. For example:

sudo mkdir -p /usr/local/include
sudo cp -r luabind /usr/local/include
sudo mkdir -p /usr/local/lib
sudo cp build/libluabind.* /usr/local/lib

Thats all

Hope that works for you.
Have fun!