lua-users home
lua-l archive

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

On Mon, Jan 19, 2009 at 5:17 PM, Wesley Smith <> wrote:
> Hi list,
> I'm having some trouble getting a module I've made to load on Ubuntu
> 8.04.  the module links against a shared library itself, which I've
> placed in /usr/local/lib.  I've set my ldconfig environment to pull
> libs from there and it works when running an app from the command line
> that links against libs in /usr/local/lib, but when I go to load my
> Lua module, I get can't find library errors.  These errors are for
> exactly the libraries in /usr/local/lib.  As soon as I move them to
> /usr/lib, it works.

Probably your package.cpath doesn't include /usr/local/lib.

> so, what gives?  Why would my setting of ldconfig work for app
> binaries,

app binaries say what they depend on in the ELF headers, and ld uses
ldconfig to find them

> but not for binary lua modules?

lua module's names aren't known until you do require, and lua (not ld)
has to be able to find the file so it can dlopen() it.

Libraries meant to be required maybe shouldn't be in /usr/local/lib.

Anyhow, check your package.cpath:

% lua
Lua 5.1.4  Copyright (C) 1994-2008, PUC-Rio
> print(package.cpath)

Put your modules in a place lua can find them, or modify the cpath to
include your place.


Ars longa, vita brevis, occasio praeceps, experimentum periculosum,
iudicium difficile.