« Previous -
Version 15/35
(diff) -
Next » -
Current version
molator, 09/28/2010 03:11 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
Alternativly, you can take the source on Kervala's repository
svn checkout http://svn.kervala.net/utils/packaging/luabind/
That version includes a cmake config and allows to build a debian package.
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 libboost-dev
and compile / install with the following command:
sudo bjam --prefix=/usr/local install
On Gentoo¶
if boost-build package is not installed:
sudo emerge boost-build -av
and compile /install with the following command: (replace 1_41 by your version of bjam)
sudo bjam-1_41 --prefix=/usr/local install
check if lib is named correctly.
ls /usr/local/lib/libluabind*.so
if lib si named libluabindd.so create a symlink
sudo ln -s /usr/local/lib/libluabindd.so /usr/local/lib/libluabind.so
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!

