[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [SOLVED] Re: Building LPeg for Lua 5.3.0
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 16 Apr 2014 05:27:58 +0200
2014-04-15 20:25 GMT+02:00 Dirk Laurie <dirk.laurie@gmail.com>:
> 2014-04-15 20:18 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>>> The `lpeg.so` made for Lua 5.2 by `luarocks install lpeg` under Ubuntu 12.04
>>> is loaded without error by Lua 5.3.
>>>
>>> However, the result of running it is not as expected in the case
>>> of position matches.
>>>
>>> [...]
>>>
>>> If instead I build lpeg from source, obtained by `luarocks download lpeg`
>>> and `luarocks unpack lpeg`, changing LUADIR to the
>>> 5.3.0-work2 directory, and doing `luarocks --local make`,
>>> the same thing happens.
>>>
>>> If instead of `luarocks --local make` I just say `make`,
>>> after `make clean` of course, the same thing happens.
>>
>> I have been using LPeg with Lua 5.3 for some time, and I did not have
>> any of these problems. Your example runs just fine here. As you
>> are having the same results as when you ran Lua 5.3 with LPeg for 5.2
>> (where those wrong results were expected), it seems that somehow
>> your compilation of LPeg is still using the 5.2 header files.
>>
>>
>>> The result seems to be the concatenation of an address and
>>> the correct value 4. That address has the same relationship
>>> to the address of _G as shown above: last 3 hex digits 008
>>> where G has last 3 hex digits 3c0.
>>
>> This seems a mismatch between the lua_Integer seen by Lua and the one
>> seen by LPeg. (LPeg pushes a result with 4 bytes where Lua expects an
>> argument with 8.) Another indication that LPeg is not seeing the correct
>> header files.
I made quite sure that LPeg is seeing the correct header files, as
detailed in "changing LUADIR ..." in my original post.
However, the LPeg source code that I used, which is available from
luarocks and also directly from
http://www.inf.puc-rio.br/~roberto/lpeg/#download,
may be slightly older than the one which works without problems.
After changing line 32 in lptypes.h from:
#if (LUA_VERSION_NUM == 502)
to
#if (LUA_VERSION_NUM >= 502)
'make' succeeded in building a version of lpeg.so that gives the correct
result.
For the build to look really neat, I added the line
-Wno-long-long \
under CWARNS in the makefile.