Skip to content

Lua compilation

David Mansolino edited this page Feb 4, 2019 · 5 revisions

This page explains how to recompile the lua dependency on every platforms. Lua is used internally by Webots to parse procedural PROTO nodes.

Reference: http://www.lua.org/download.html

cd ~/software
wget http://www.lua.org/ftp/lua-5.2.3.tar.gz
tar zxf lua-5.2.3.tar.gz
rm lua-5.2.3.tar.gz
cd lua-5.2.3

On Linux:

make linux test

On Mac:

You need to edit the src/Makefile in order to create a dynamic version of liblua. Create a Makefile.patch in src/ with the following diff:

22,23c22,23
< MYCFLAGS=
< MYLDFLAGS=
---
> MYCFLAGS= -mmacosx-version-min=10.7
> MYLDFLAGS= -mmacosx-version-min=10.7
31c31
< LUA_A=	liblua.a
---
> LUA_A=	liblua.dylib
60a61
> 	$(CC) -dynamiclib -o liblua.dylib $^
63c64,65
< 	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
---
> 	$(CC) -fno-common -DLUA_USE_LINUX -lreadline -L. -llua lua.c -o lua
> 	install_name_tool -change liblua.dylib @executable_path/liblua.dylib lua
cd src/
patch Makefile Makefile.patch && rm Makefile.patch
cd ../
make macosx test
cp src/liblua.dylib ~/webots/lib/liblua.dylib
install_name_tool -id @rpath/lib/liblua.dylib ~/webots/lib/liblua.dylib

On Windows:

make mingw test
cp src/lua52.dll $(WEBOTS_HOME)/msys64/mingw64/bin
Clone this wiki locally