Upgrading Celestia with Lua 5.2

Description: The place to discuss creating, porting and modifying Celestia's source code.

Joe
Topic author
Avatar
Joe
Topic author
Posts: 152
With us: 13 years 6 months
Location: United Kingdom

#1by Joe » 06.10.2013, 10:21

Hi,

Anyone has been successful in making Celestia work with Lua 5.2 (currently Celestia 1.6.1 is based on Lua 5.1)?

I came across this site http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/source/SRPMS/c/?C=M;O=A

where the download contain a patch file: celestia-1.6.1-lua-5.2.patch. This patch makes Celestia src compile well, but the executable does not work because of the code

Code: Select all

@@ -3604,7 +3603,7 @@
 void LuaState::setLuaPath(const string& s)
 {
 #if LUA_VER >= 0x050100
-    lua_getfield(state, LUA_GLOBALSINDEX, "package");
+    lua_getglobal(state, "package");
     lua_pushstring(state, s.c_str());
     lua_setfield(state, -2, "path");
     lua_pop(state, 1);
@@ -4118,7 +4117,7 @@
     openLuaLibrary(state, LUA_LOADLIBNAME, luaopen_package);
 
     // Disallow loadlib
-    lua_getfield(state, LUA_GLOBALSINDEX, "package");
+    lua_getglobal(state, "package");
     lua_pushnil(state);
     lua_setfield(state, -2, "loadlib");
     lua_pop(state, 1);


It seems Lua 5.2's lua_setfield function fails to work.

Strangely enough, the patch went through well with Lua 5.1 and ran well too, but crashed at lua_setfield under Lua 5.2

Joe
Joe
8O

John Van Vliet
Avatar
John Van Vliet
Posts: 2639
With us: 15 years

Re: Upgrading Celestia with Lua 5.2

#2by John Van Vliet » 07.10.2013, 23:18

--- edit ---
Last edited by John Van Vliet on 19.10.2013, 03:46, edited 1 time in total.

Joe
Topic author
Avatar
Joe
Topic author
Posts: 152
With us: 13 years 6 months
Location: United Kingdom

Re: Upgrading Celestia with Lua 5.2

#3by Joe » 08.10.2013, 09:32

Hi, John

My OS is Windows XP, Win32 with Compiler VS2008 (also tried with VS2005 and VS2010).

The svn code under the version number 1.7 is really the same as Celestia 1.6.1 and SVN 5229.

Joe
Joe

8O

John Van Vliet
Avatar
John Van Vliet
Posts: 2639
With us: 15 years

Re: Upgrading Celestia with Lua 5.2

#4by John Van Vliet » 08.10.2013, 18:57

--- edit ---

Joe
Topic author
Avatar
Joe
Topic author
Posts: 152
With us: 13 years 6 months
Location: United Kingdom

Re: Upgrading Celestia with Lua 5.2

#5by Joe » 22.10.2013, 09:38

It seems that Celestia will be ankered with Lua 5.1 forever or there are something buggy with Lua 5.2. Anyhow Celestia and Lua 5.2 do not work together :( .
Joe

8O

John Van Vliet
Avatar
John Van Vliet
Posts: 2639
With us: 15 years

Re: Upgrading Celestia with Lua 5.2

#6by John Van Vliet » 23.10.2013, 23:35

well it builds on Linux just fine with 5.2

did you remake the MS visual studio project and solution files
likely you would have to hack that config and point it to the 5.2 install
should be fairly easy in the current visual studio

a question are you truing to use the"celestia.vcproj" &"celestia.sln"
those area visual studio 8 EXPRESS
and mostly can only be used in express 8

the vcproj file has this coded into it
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\src;.\windows\inc;.\windows\inc\libintl;.\windows\inc\libpng;.\windows\inc\libz;.\windows\inc\spice;".\windows\inc\lua-5.1";.\windows\inc\libjpeg;.\thirdparty\Eigen;.\thirdparty\glew\include;.\thirdparty\curveplot\include"

-- and ---
Name="VCLinkerTool"
AdditionalDependencies="intl.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib vfw32.lib opengl32.lib glu32.lib libjpeg.lib zlibd.lib libpngd.lib lua5.1.lib cspice.lib"

--- and ---
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\src;.\windows\inc;.\windows\inc\libintl;.\windows\inc\libpng;.\windows\inc\libz;.\windows\inc\spice;".\windows\inc\lua-5.1";.\windows\inc\libjpeg;.\thirdparty\Eigen;.\thirdparty\glew\include;.\thirdparty\curveplot\include"

-- and --
Name="VCLinkerTool"
AdditionalDependencies="intl.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib vfw32.lib opengl32.lib glu32.lib libjpeg.lib zlibd.lib libpngd.lib lua5.1.lib cspice.lib"


---- and so on ......................
pointing to 5.1 !!!!

did you hack the project file?


i would use the QT creator ( windows version !!)
and build with the "celestia.pro"

you will need QT4 installed instead of the GULT / GTK2 for the VS project

rankincj
rankincj
Posts: 1
With us: 1 year 1 month

#7by rankincj » 12.08.2016, 09:17

Fedora 24 contains working RPMs for Celestia 1.6.1 built against Lua 5.3:
http://mirror.bytemark.co.uk/fedora/linux//releases/24/Everything/source/tree/Packages/c/celestia-1.6.1-22.fc24.src.rpm

There is an extra patch in there that fixes the initial port to Lua 5.2.

chrisjr
chrisjr
Posts: 12
With us: 11 years
Location: UK

#8by chrisjr » 12.08.2016, 11:22

It's probably also worth pointing out that Fedora has started to delete any and every texture from its Celestia RPM that cannot be proved to be distributable under the GPL. You might therefore find some of the planets to be (err) curiously featureless... :zombie:

If anyone knows the lawful provenance of any of the deleted textures then I'm sure that Fedora would love to know...

Joe
Topic author
Avatar
Joe
Topic author
Posts: 152
With us: 13 years 6 months
Location: United Kingdom

#9by Joe » 23.05.2017, 00:46

rankincj wrote:
Fedora 24 contains working RPMs for Celestia 1.6.1 built against Lua 5.3:
http://mirror.bytemark.co.uk/fedora/linux//releas ... celestia-1.6.1-22.fc24.src.rpm

There is an extra patch in there that fixes the initial port to Lua 5.2.
I double checked the above link and the contents, I couldn't see Lua 5.2 or 5.3. It is still in Lua 5.1.
Joe

8O

Joe
Topic author
Avatar
Joe
Topic author
Posts: 152
With us: 13 years 6 months
Location: United Kingdom

#10by Joe » 14.07.2017, 10:23

Having been struggling for the past few weekends to investigate and make Lua 5.2 (or 5.3) works in Celestia, the following are what I have so far found out:
1. The "upgrade celestia-1.6.1-alt-lua5.2.patch" (or under any other naming) could take Celestia through compilation, but beyond it crashed on running.
2. I fixed the crash by modifying openLuaLibrary() into:

Code: Select all

void openLuaLibrary(lua_State* l, const char* name, lua_CFunction func)
{
#if LUA_VER >= 0x050200                           //Lua-5.2.4
   // https://bugzilla.redhat.com/show_bug.cgi?id=1045632#c18
   luaL_requiref(l, name, func, 1);
   lua_pop(l, 1);  // Remove lib
#else                                       //Lua-5.1.5
   lua_pushcfunction(l, func);
   lua_pushstring(l, name);
   lua_call(l, 1, 0);
#endif
}

and

Code: Select all

bool LuaState::init(TdsCore* appCore)
{
    TdsxLua::initMaps();

    // Import the base, table, string, and math libraries
#if LUA_VER >= 0x050100
    openLuaLibrary(state, "_G", luaopen_base);  // Using "_G" or ""
    openLuaLibrary(state, LUA_MATHLIBNAME, luaopen_math);
    openLuaLibrary(state, LUA_TABLIBNAME, luaopen_table);
    openLuaLibrary(state, LUA_STRLIBNAME, luaopen_string);
#if LUA_VER >= 0x050200                                          //Lua-5.2.4
   openLuaLibrary(state, LUA_COLIBNAME, luaopen_coroutine);
#endif
   // Make the package library, except the loadlib function, available
   // for tdsx regardless of script system access policy.
   allowLuaPackageAccess();
... ... ...
}

3. However the effort, Celestia with Lua 5.2 cannot run ScriptObit and ScriptRotation, neither can it work for Celxx add-on.

I wonder if there is anyone out there has already been successful in making Celestia fully work with Lua 5.2 and above?
Joe

8O

K.A.V M
Avatar
K.A.V M
Age: 27
Posts: 15
With us: 1 year 1 month
Location: Marseille

#11by K.A.V » 15.07.2017, 19:49

I'm interested too.


Return to “Development”

Who is online (over the past 5 minutes)

Users browsing this forum: 2 guests