lua-users home
lua-l archive

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


On 22.11.2013 10:47, Philipp Janda wrote:
Am 22.11.2013 11:39 schröbte Bernd Eggink:
On 22.11.2013 09:13, Rob Hoelz wrote:
On 11/22/13 11:06 AM, Bernd Eggink wrote:
Hi all,
I compiled Vim with Lua support and am quite happy now that I can
write Vim procedures in my favourite language. Most things work, but
there is one problem I couldn't solve. Whenever I try to require a
module (after setting package.path and package.cpath right), I get an
error message like this:

  error loading module 'posix_c' from file
'/usr/lib/lua/5.2/posix_c.so':
  /usr/lib/lua/5.2/posix_c.so: undefined symbol: lua_gettop

It seems that Lua has found the required module, but the module can't
access liblua.a. No idea why. Posix is just an example, the same
happens with other modules as well.

Any ideas what could be the reason and how to get around this?

package.path =
"/local/bernd/lui/?.lua;./?.lua;/local/bernd/lua/lib/?.lua;/usr/lib/lua/5.2/?.lua;/usr/share/lua/5.2/?.lua"


package.cpath="/usr/lib/lua/5.2/?.so;/usr/lib/lua/5.2/?.la;/usr/lib/lua/5.2/?.a"


You can't load static libraries (`*.a`) using `require` in Lua, so the
last entry (and probably the one before that) is useless.


Chances are
that you built Vim against Lua 5.1, and you're asking it to load 5.2
modules, which it gets upset about.

Certainly not, the only Lua I have is 5.2.

The next most likely reason is that the vim executable doesn't re-export
the Lua API functions because liblua was linked statically, and the
`-Wl,-E` flag was missing. AFAICT, linking dynamically
(`--enable-luainterp=dynamic`) should work because `RTLD_GLOBAL` is used
when loading liblua in this case ...

With --enable-luainterp=dynamic I get:

  E370: Could not load library liblua.so
  Lua library cannot be loaded.

Which isn't really suprising as I don't have a liblua.so. Unfortunately my C knowledge has vastly faded away, so let me ask a stupid question: The Linux Makefiles provided with the Lua sources automatically create a static liblua.a on Linux, is that correct? If it is correct, I wonder why the readme says:

"We strongly recommend that you enable dynamic loading in src/luaconf.h. This is done automatically for all platforms listed..."

Anyway, if a liblua.so would solve my problem, can anybody tell me where I can get a Makefile that creates such a library?

Thanks in advance,
Bernd

--
http://sudrala.de