lua-users home
lua-l archive

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


Here's what I'm seeing if I install the whole thing from scratch for lua 5.3 specifically. The include directories for the lua headers are correctly versioned to 5.3, but I'm not seeing it linked explicitly with any particular liblua at build time, so it should use the default for the interpreter that loads it (5.3).

What I would guess is happening, based on the -L and -rpath options that get set, is it's finding the system default /usr/lib/libreadline.dylib before the one under /opt/local/lib, and it doesn't match what libhistory is expecting (which isn't installed at all under /usr). But what I don't understand is why it works under 5.2, which uses the same -L and -rpath directives. Thoughts?


$ sudo luarocks-5.3 install luaprompt HISTORY_DIR=/opt/local
Installing https://rocks.moonscript.org/luaprompt-0.6-1.src.rock...
Using https://rocks.moonscript.org/luaprompt-0.6-1.src.rock... switching to 'build' mode
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -O2 -fPIC -I/usr/local/include/lua5.3 -c prompt.c -o prompt.o -DHAVE_LIBREADLINE -DHAVE_READLINE_HISTORY -DHAVE_IOCTL -DCOMPLETE_KEYWORDS -DCOMPLETE_TABLE_KEYS -DCOMPLETE_FILE_NAMES -DCOMPLETE_MODULES -DSAVE_RESULTS -DRESULTS_TABLE_NAME="_" -I/usr/include -I/opt/local/include
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -O2 -fPIC -I/usr/local/include/lua5.3 -c module.c -o module.o -DHAVE_LIBREADLINE -DHAVE_READLINE_HISTORY -DHAVE_IOCTL -DCOMPLETE_KEYWORDS -DCOMPLETE_TABLE_KEYS -DCOMPLETE_FILE_NAMES -DCOMPLETE_MODULES -DSAVE_RESULTS -DRESULTS_TABLE_NAME="_" -I/usr/include -I/opt/local/include
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -bundle -undefined dynamic_lookup -all_load -o prompt.so -L/usr/local/lib prompt.o module.o -L/usr/lib -L/opt/local/lib -Wl,-rpath,/usr/lib: -Wl,-rpath,/opt/local/lib: -lreadline -lhistory
Updating manifest for /usr/local/lib/luarocks/rocks-5.3
luaprompt 0.6-1 is now built and installed in /usr/local (license: MIT/X11)



$ cat (which luap)
#!/bin/sh

exec '/usr/local/bin/lua5.3' -e 'package.path="/Users/prime/.luarocks/share/lua/5.3/?.lua;/Users/prime/.luarocks/share/lua/5.3/?/init.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;"..package.path; package.cpath="/Users/prime/.luarocks/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("luaprompt","0.6-1")' '/usr/local/lib/luarocks/rocks-5.3/luaprompt/0.6-1/bin/luap' "$@"


$ luap
/usr/local/bin/lua5.3: /usr/local/share/lua/5.3/luarocks/loader.lua:117: error loading module 'prompt' from file '/usr/local/lib/lua/5.3/prompt.so':
dlopen(/usr/local/lib/lua/5.3/prompt.so, 6): Symbol not found: _rl_completion_suppress_append
  Referenced from: /usr/local/lib/lua/5.3/prompt.so
  Expected in: dynamic lookup

stack traceback:
[C]: in local 'a_loader'
/usr/local/share/lua/5.3/luarocks/loader.lua:117: in function </usr/local/share/lua/5.3/luarocks/loader.lua:114>
(...tail calls...)
[C]: in function 'require'
/usr/local/lib/luarocks/rocks-5.3/luaprompt/0.6-1/bin/luap:29: in main chunk
[C]: in ?

On Fri, Jun 12, 2015 at 11:09 AM, Brigham Toskin <brighamtoskin@gmail.com> wrote:
I compiled it for 5.1, 5.2, and 5.3. Only works under 5.2. Note the different installed directories. Your point is taken re luajit, though.

On Fri, Jun 12, 2015 at 10:46 AM, Coda Highland <chighland@gmail.com> wrote:
On Fri, Jun 12, 2015 at 10:15 AM, Brigham Toskin
<brighamtoskin@gmail.com> wrote:
> This is most excellent. The version of Lua that my package manager installs
> doesn't even include the basic readline support Lua ships with.
>
> I'm having trouble loading it as a module, though, from the lua standalone
> repl. I installed from rocks, and luap works. But whenever I try to just
> directly load the module from any version of lua besides 5.2, I get error
> messages, which are different depending on which lua I'm using.
>
> Thusly:
>
> $ lua5.1 -l prompt -i
> Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> lua5.1: error loading module 'prompt' from file
> '/usr/local/lib/lua/5.1/prompt.so':
> dlopen(/usr/local/lib/lua/5.1/prompt.so, 2): Symbol not found:
> _luaL_loadbufferx
>   Referenced from: /usr/local/lib/lua/5.1/prompt.so
>   Expected in: dynamic lookup
>
> stack traceback:
> [C]: ?
> [C]: ?
> [C]: ?
>
> $ lua5.3 -l prompt -i
> Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> lua5.3: error loading module 'prompt' from file
> '/usr/local/lib/lua/5.3/prompt.so':
> dlopen(/usr/local/lib/lua/5.3/prompt.so, 6): Symbol not found:
> _rl_completion_suppress_append
>   Referenced from: /usr/local/lib/lua/5.3/prompt.so
>   Expected in: dynamic lookup
>
> stack traceback:
> [C]: in ?
> [C]: in function 'require'
> [C]: in ?
>
> $ luajit -l prompt -i
> LuaJIT 2.0.2 -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/
> luajit: error loading module 'prompt' from file
> '/usr/local/lib/lua/5.1/prompt.so':
> dlopen(/usr/local/lib/lua/5.1/prompt.so, 6): Symbol not found:
> _luaL_setfuncs
>   Referenced from: /usr/local/lib/lua/5.1/prompt.so
>   Expected in: dynamic lookup
>
> stack traceback:
> [C]: at 0x010001e14e
> [C]: at 0x010001ddbb
> [C]: at 0x0100001166
>
> Based on what I'm seeing here, I'd guess that 5.1 (and by extension, jit)
> aren't supported, but you did explicitly mention that 5.3 is supported.
>
> Under 5.3, it appears not to be loading readline; I manually passed the
> location to that library when I installed lauprompt (otherwise it just
> fails). Is this information not cached for runtime use?
>
> On Fri, Jun 12, 2015 at 7:58 AM, Dimitris Papavasiliou <dpapavas@gmail.com>
> wrote:
>>
>> luaprompt is both an interactive Lua prompt that can be used instead
>> of the official interpreter, as well as a module that provides a Lua
>> command prompt that can be embedded in a host application.  As a
>> standalone interpreter it provides many conveniences that are missing
>> from the official Lua interpreter.  As an embedded prompt, it's meant
>> for applications that use Lua as a configuration or interface language
>> and can therefore benefit from an interactive prompt for debugging or
>> regular use.
>>
>> luaprompt features:
>>
>> * Readline-based input with history and completion: In particular all
>>   keywords, global variables and table accesses (with string or
>>   integer keys) can be completed in addition to readline's standard
>>   file completion.  Module names are also completed, for modules
>>   installed in the standard directories, and completed modules can
>>   optionally be loaded.
>>
>> * Persistent command history (retained across sessions).
>>
>> * Proper value pretty-printing for interactive use: When an _expression_
>>   is entered at the prompt, all returned values are printed
>>   (prepending with an equal sign is not required).  Values are printed
>>   in a descriptive way that tries to be as readable as possible.  The
>>   formatting tries to mimic Lua code (this is done to minimize
>>   ambiguities and no guarantees are made that it is valid code).
>>   Additionally, each value is stored in a table for future reference.
>>
>> * Color highlighting of error messages and variable printouts.
>>
>> This release includes a couple of improvements:
>>
>> * luaprompt is now available as a module as well as a standalone
>> executable and can be installed via luarocks.  Just type
>>
>>     luarocks install luaprompt
>>
>> to get both the module and the standalone interpreter.
>>
>> * Some completion-related improvements include the support for __index
>> tables and better filename completion.
>>
>> * luaprompt now saves the results of each command in a table, which by
>> default is named "_".  The use of the feature can most easily be explained
>> by the following excerpt from a luap session:
>>
>> >  io.open "/tmp/hello"
>> _[1] = file (0x113b110)
>> >  _[1]:read("*a")
>> _[2] = "Hello World\n"
>> >  _[1]:close()
>> _[3] = true
>> >  _
>> _[4] = { file (closed), "Hello World\n", true,  }
>> >
>>
>> * luaprompt also works with Lua 5.3!  Well, no actual change was required
>> to get it to work, I just thought I'd mention it.
>>
>> For more information, see the README at luaprompt's GitHub page, which you
>> can find at the URL below:
>>
>> https://github.com/dpapavas/luaprompt
>>
>
>
>
> --
> Brigham Toskin

The Lua API isn't ABI-compatible across versions. You can't expect a
5.2 module to work in 5.1, 5.3, or LuaJIT without recompilation.

/s/ Adam




--
Brigham Toskin



--
Brigham Toskin