lua-users home
lua-l archive

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


On 06/13/2015 04:46 PM, Dimitris Papavasiliou wrote:
See what happens when you pass READLINE_DIR=/opt/local.  If the module
still gets linked against /usr/lib/* libraries, then I'm afraid LuaRocks
doesn't handle the case where you have multiple libraries with the same
name installed, correctly.  It probably should pass the explicitly
specified library paths before the default paths, but from what I see,
it doesn't.  I'll try to set up a similar case in my system and see what
happens.

I tried compiling readline from source and installing it in /opt. If I install luaprompt with the usual command

$ sudo luarocks install luaprompt

then the resulting module is linked against the packaged readline, installed in /usr/lib/:

dimitris@debian:~/source/luaprompt$ ldd /usr/local/lib/lua/5.1/prompt.so
	linux-vdso.so.1 (0x00007ffe6186c000)
libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f3f0910b000) libhistory.so.6 => /lib/x86_64-linux-gnu/libhistory.so.6 (0x00007f3f08f02000)
	...

If I set, either just HISTORY_DIR or both HISTORY_DIR and READLINE_DIR to /opt with:

$ sudo luarocks install luaprompt  HISTORY_DIR=/opt READLINE_DIR=/opt

I get a module linked correctly against my self-compiled libraries:

dimitris@debian:~/source/luaprompt$ ldd /usr/local/lib/lua/5.1/prompt.so
	linux-vdso.so.1 (0x00007ffea9ca9000)
	libreadline.so.6 => /opt/lib/libreadline.so.6 (0x00007f7056810000)
	libhistory.so.6 => /opt/lib/libhistory.so.6 (0x00007f7056608000)
	...

I'm running Debian though, perhaps something is wrong with LuaRocks on OSX. In particular, I notice that when LuaRocks links the module, it doesn't pass the default library directory /usr/lib/ through -rpath, only what I've explicitly specified for readline:

gcc -shared -o prompt.so -L/usr/local/lib prompt.o module.o -L/usr/lib/x86_64-linux-gnu -L/opt/lib -Wl,-rpath,/usr/lib/x86_64-linux-gnu: -Wl,-rpath,/opt/lib: -lreadline -lhistory