moai/moai-dev — pull request #809 by samibh (2013-11-27 15:24:40+00:00)
Title: Updated CMakeLists so LUA is compiled with loading of dynamic libraries enabled

LUA is missing a compilation option for linux. One consequence is it can't load dynamic libraries.
The compilation command used in the official lua makefile is:
`gcc -O2 -Wall -DLUA_USE_LINUX -c -o xxx.o xxx.c`
(as can be seen from line 99 of [lua-5.1.3/src/Makefile](https://github.com/moai/moai-dev/blob/linux/3rdparty/lua-5.1.3/src/Makefile))
The compilation options used in the CMake of the project currently is:
`/usr/bin/cc -DVERSION_GIT=2ef1ed405 -DVERSION_STAGE=linux -o xxx.o -c xxx.c`

If the define is absent, on line 36 of [luaconf.h](https://github.com/moai/moai-dev/blob/linux/3rdparty/lua-5.1.3/src/luaconf.h), the following defines are absent as well:
`#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
#define LUA_USE_READLINE /* needs some extra libraries */`
which, among other things, disables loading of dynamic libraries.

I also added "dl" as a library requirement to lua-lib. This fixes "make" failing with linker error :
`undefined reference to symbol 'dlclose@@GLIBC_2.2.5'`
which apparently I was not the only one to have (see http://franciscotufro.com/2013/01/compiling-moai-on-linux/).