lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, 29 Nov 2010 13:28:12 +0100, Michal Kolodziejczyk <miko@wp.pl>
wrote:
>http://www.lua.org/source/5.1/loadlib.c.html
>Look for LUA_DL_DLOPEN set in your luaconf.h.

Thanks for the help. This seems to have successfully re-compiled the
interpreter with support for loading modules :-)

/tmp> ./lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
LuaSocket 2.0.2

In case another newbie is looking for the same type of info, here's
how I customized Lua's Makefile:

=================
ubuntu:/usr/src/lua-5.1.4# cat Makefile
TOPDIR:=/
TOOLCHAIN_PATH=$(TOPDIR)/opt/uClinux/bfin-linux-uclibc/bin:$(TOPDIR)/opt/uClinux/bfin-uclinux/bin
export PATH:= $(TOOLCHAIN_PATH):$(PATH)

PLAT= none

CROSS  = bfin-uclinux-
CROSS  = bfin-linux-uclibc-
STRIP  = $(CROSS)strip
CC     = $(CROSS)gcc
AR     = $(CROSS)ar rcu
RANLIB = $(CROSS)ranlib
RM = rm -f

CFLAGS += -Wall -O2 $(MYCFLAGS)
#FLAT
ifeq ($(CROSS),bfin-uclinux-)
        LDFLAGS = -Wl,-elf2flt
#FDPIC ELF
#else
endif
LDFLAGS += $(MYLDFLAGS)
LIBS = -Wl,-E -lm $(MYLIBS)

MYCFLAGS = -DLUA_USE_POSIX -DLUA_USE_DLOPEN
MYLDFLAGS =
MYLIBS = -ldl

PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
uclinux

...

$(LUA_T): $(LUA_O) $(LUA_A)
        $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)

        #FDPIC ELF binaries can be stripped, but not FLAT binaries
ifeq ($(CROSS),bfin-linux-uclibc-)
        $(STRIP) $@
endif

...

uclinux:
        $(MAKE) all MYCFLAGS="$(MYCFLAGS)" MYLIBS="$(MYLIBS)"
=================

Thank you.