lua-users home
lua-l archive

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


I'm trying to build the Lua random library under Cygwin and get the
following errors. Any pointers for this novice? (Makefile included below
compilation / linking results)

$ make
gcc -I/cygdrive/j/bsmlab/LuaWindows/Lua-5.1.4/lua-5.1.4/src -ansi
-pedantic -Wal
l -O2    -c -o lrandom.o lrandom.c
gcc -o random.so -shared lrandom.o
lrandom.o:lrandom.c:(.text+0x197): undefined reference to
`_luaL_checkudata'
lrandom.o:lrandom.c:(.text+0x1bb): undefined reference to
`_lua_newuserdata'
lrandom.o:lrandom.c:(.text+0x1d7): undefined reference to
`_lua_getfield'
lrandom.o:lrandom.c:(.text+0x1e8): undefined reference to
`_lua_setmetatable'
lrandom.o:lrandom.c:(.text+0x225): undefined reference to
`_luaL_optinteger'
lrandom.o:lrandom.c:(.text+0x2d3): undefined reference to
`_luaL_optinteger'
lrandom.o:lrandom.c:(.text+0x34b): undefined reference to `_lua_gettop'
lrandom.o:lrandom.c:(.text+0x366): undefined reference to
`_luaL_checkinteger'
lrandom.o:lrandom.c:(.text+0x379): undefined reference to
`_luaL_checkinteger'
lrandom.o:lrandom.c:(.text+0x3a8): undefined reference to
`_lua_pushnumber'
lrandom.o:lrandom.c:(.text+0x3cd): undefined reference to
`_luaL_checkinteger'
lrandom.o:lrandom.c:(.text+0x420): undefined reference to
`_lua_pushfstring'
lrandom.o:lrandom.c:(.text+0x447): undefined reference to
`_luaL_newmetatable'
lrandom.o:lrandom.c:(.text+0x458): undefined reference to
`_lua_pushvalue'
lrandom.o:lrandom.c:(.text+0x475): undefined reference to
`_luaL_openlib'
lrandom.o:lrandom.c:(.text+0x48f): undefined reference to
`_lua_pushlstring'
lrandom.o:lrandom.c:(.text+0x4a9): undefined reference to
`_lua_pushlstring'
lrandom.o:lrandom.c:(.text+0x4ba): undefined reference to
`_lua_settable'
lrandom.o:lrandom.c:(.text+0x4d4): undefined reference to
`_lua_pushlstring'
lrandom.o:lrandom.c:(.text+0x4e5): undefined reference to
`_lua_pushvalue'
lrandom.o:lrandom.c:(.text+0x4f6): undefined reference to
`_lua_settable'
lrandom.o:lrandom.c:(.text+0x510): undefined reference to
`_lua_pushlstring'
lrandom.o:lrandom.c:(.text+0x52a): undefined reference to
`_lua_pushlstring'
lrandom.o:lrandom.c:(.text+0x53b): undefined reference to
`_lua_gettable'
lrandom.o:lrandom.c:(.text+0x54c): undefined reference to
`_lua_settable'
lrandom.o:lrandom.c:(.text+0x566): undefined reference to
`_lua_setfield'
collect2: ld returned 1 exit status
make: *** [random.so] Error 1




The Makefile:

# makefile for random library for Lua

# change these to reflect your Lua installation
# LUA= /tmp/lhf/lua-5.1.4
LUA= /cygdrive/j/bsmlab/LuaWindows/Lua-5.1.4/lua-5.1.4
LUAINC= $(LUA)/src
LUALIB= $(LUA)/src
LUABIN= $(LUA)/src

# these will probably work if Lua has been installed globally
#LUA= /usr/local
#LUAINC= $(LUA)/include
#LUALIB= $(LUA)/lib
#LUABIN= $(LUA)/bin

# probably no need to change anything below here
CC= gcc
CFLAGS= $(INCS) $(WARN) -O2 $G
WARN= -ansi -pedantic -Wall
INCS= -I$(LUAINC)

MYNAME= random
MYLIB= l$(MYNAME)
T= $(MYNAME).so
OBJS= $(MYLIB).o
TEST= test.lua

all:    test

test:   $T
        $(LUABIN)/lua $(TEST)

o:      $(MYLIB).o

so:     $T

$T:     $(OBJS)
        $(CC) -o $@ -shared $(OBJS)

$(OBJS): random.c

clean:
        rm -f $(OBJS) $T core core.*

doc:
        @echo "$(MYNAME) library:"
        @fgrep '/**' $(MYLIB).c | cut -f2 -d/ | tr -d '*' | sort |
column

# distribution

FTP= $(HOME)/public/ftp/lua/5.1
D= $(MYNAME)
A= $(MYLIB).tar.gz
TOTAR= Makefile,README,$(MYLIB).c,test.lua,random.c

tar:    clean
        tar zcvf $A -C .. $D/{$(TOTAR)}

distr:  tar
        touch -r $A .stamp
        mv $A $(FTP)

diff:   clean
        tar zxf $(FTP)/$A
        diff $D .

# eof