[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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
<gilles.ganault@free.fr> wrote:
>/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.
==========
CC= gcc
CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
LIBS= -lm $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
generic:
$(MAKE) all MYCFLAGS=
linux:
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline
-lhistory -lncurses"
==========
"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."
http://compgroups.net/comp.unix.programmer/dlopen-calling-functions-other-way-round
Is it because modules loaded in Lua require extra information in the
Lua interpreter?
Thank you.