Porting to Lua5.2

For discussion of the code running behind the game

Moderator: Staff

User avatar
Jormuny
Newbie
Posts: 10
Joined: Mon Aug 22, 2016 8:37 pm

Porting to Lua5.2

Postby Jormuny » Tue Aug 23, 2016 3:53 am

Hey, I'm the feller that posted on reddit.

So I finally got the sources to download from bitbucket (mercurial was painfully slow) and tried to compile - and failed. Checked the wiki for specific instructions in case I missed anything. Still failed.
No matter what I did, the thing was erroring out because something was trying to access lua5.2 regardless of anything else.
(I'm running Linux Mint 18 in case you're wondering)

So I've just started porting it to lua5.2 ,annnnd... I got it to compile and start o_o

It segfaults shortly after showing me which buttons do what, but it compiles and starts. Editor, too.
I have an idea regarding where to proceed from here if I want to get it to work, but I thought I should stop while I'm ahead and ask if I should keep going or take a step back and try to get it working with Lua5.1 anyway, since I've no idea if sticking to 5.1 was some design choice or the main dev's preference.
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Tue Aug 23, 2016 4:51 am

I'm also running Linux Mint, but the Debian Edition. First let me lay out a few facts
- We compile Luabind ourselves (its at src/luabind) in our builds. Reason is because Luabind used to be a real PITA to get working on people's systems and often wasn't in source repositories.
- AFAIK, the Luabind version we have installed only works with Lua 5.1, hence why the requirement of Lua at that version.


If we can go to Lua 5.2 without an issue, that would be great. But I think we might need to update the luabind source, or remove compiling luabind from our build process completely.

Here's the Lua/luabind packages I have installed on my machine currently. Not sure which of these is actually used by the build process, but I think it should be pulling it Lua 5.1 only.

liblua5.1-0
liblua5.1-0-dev
liblua5.2-0
liblua5.2-dev
libluabind0.2.1
lua5.1
lua5.2

If you want to get it working with Lua 5.2, go for it. But it might be easier for you to get 5.1 working, and right now I just want you to get it working ASAP. Can you post the compilation error output? Hopefully I can provide more help if I can see what exactly is failing.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Tue Aug 23, 2016 5:22 am

Also I'm hoping your mercurial issues were a one-time thing. When I do updates mercurial is very fast for me. Maybe it just has to pull in so much data and history when you do a full sync? :shrug:
Image
User avatar
Jormuny
Newbie
Posts: 10
Joined: Mon Aug 22, 2016 8:37 pm

Re: Porting to Lua5.2

Postby Jormuny » Tue Aug 23, 2016 2:19 pm

This is the sort of errors I'm getting:

Code: Select all

./src/luabind/luabind/object.hpp:553:37: error: no matching function for call to ‘operator!=(const luabind::detail::basic_iterator<luabind::detail::raw_access>&, const luabind::detail::basic_iterator<luabind::detail::raw_access>&)’
       return boost::operator op(x, y); \


Here's a link to the full make output

So yeah, it looked to me like it is failing to work with luabind. One of the steps I've taken when 'porting' was use the sources from the debian source package provided in mint 18 (from ubuntu xenial I bet) - which only work with lua 5.2

As for mercurial - yeah, probably a one time thing, trying to pull down the whole change history. I'll just duplicate the folder and keep a spare as a backup in case I ever need to clone again - updating couldn't be as long, right?

Oh, I'm going to hang out on your IRC channel now. Probably would be faster to communicate over that than the forum.
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Tue Aug 23, 2016 7:13 pm

Yeah, that error message is from compiling the luabind source. It's not code that we wrote, so its kind of hard to support (especially because Luabind is some sort of crazy dark magic template wizardry). Hard to give you a firm suggestion to go one way or the other at this point. If you want to remove luabind from our compilation process by editing the build files and looking for the luabind library installed on the system, you have approval to do so. But I don't know how much you know about automake/autotools (I know just enough to get by).

I'm usually only on IRC in the evenings (US time), but am usually on at least every other day or so. I'll login tonight and see if we can work things out.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Thu Aug 25, 2016 5:10 am

Jormuny and I have been working on this tonight and found out some useful information about Allacrost and Lua 5.2. Even though Jormuny was able to compile Allacrost fine with Lua 5.2, it did not run as expected. There are some backwards incompatible changes made in 5.2 from 5.1 that we rely on. Specifically, the use of "setfenv" in nearly all our Lua scripts to avoid polluting the global tablespace is no longer allowed. There may be other issues as well that we don't know about yet.

So if we do move to Lua 5.2 in the future, we're going to need to find an alternative to those setfenv calls and update all our Lua scripts to use it.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Thu Aug 25, 2016 2:11 pm

Jormuny, I had another idea this morning. Try to see if you can compile Valyria Tear. Its a fork of Allacrost and its codebase has diverged significantly from us. More importantly, I know that they've been making updates to their Luabind code, so there's a chance it might work. If it does, we can integrate their luabind source into our own as long as everything works properly in Allacrost.
Image
User avatar
Jormuny
Newbie
Posts: 10
Joined: Mon Aug 22, 2016 8:37 pm

Re: Porting to Lua5.2

Postby Jormuny » Mon Aug 29, 2016 5:33 pm

I got it to compile with Lua 5.1 by using this git repository fir luabind, so I guess I'll stash my "porting" efforts for now
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Porting to Lua5.2

Postby Roots » Mon Aug 29, 2016 6:04 pm

Awesome! :approve: Glad you finally got it to work. For your first pull request why don't you submit all of the changes to the luabind files?
Image

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 3 guests