[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Investigating "can't resolve symbol"?
- From: Gilles Ganault <gilles.ganault@...>
- Date: Fri, 28 Jan 2011 00:43:47 +0100
On Tue, 25 Jan 2011 23:24:34 +0100, Gilles Ganault
>/var/tmp> ./lua -lluasql.sqlite3
>./lua: can't resolve symbol '_luaL_ref'
Out of curiosity, I'd like to know why including "-Wl,-E" when
compiling Lua with "make generic" solved the issue.
CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RM= rm -f
LIBS= -lm $(MYLIBS)
$(MAKE) all MYCFLAGS=
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline
"You must tell the linker that your main program exports symbols. If
you're e.g. the gcc and ld combination you need to do
gcc -Wl,-E -o load load.c -ldl
where the -Wl,-E tells gcc to invoke the linker with the -E option,
which in turn will make ld add all symbols to the dynamic symbol
table, so that they can be found by the dlopen'ed library. Of
course, you may need some other flags when you're using a different
compiler and linker."
Is it because modules loaded in Lua require extra information in the