Trouble compiling Celestia, and how to add Lua function

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
paulooch1958
Posts: 11
Joined: 26.05.2005
With us: 19 years 1 month
Location: Cal

Trouble compiling Celestia, and how to add Lua function

Post #1by paulooch1958 » 25.02.2006, 02:25

I'm having trouble compiling Celestia. I am running WinXP with Microsoft Visual Studio 2003.

I have downloaded the Celestia source in the past and been able to compile and run it, but when I recently updated the source from sourceforge, I lost the ability to compile without errors.

It wasn't completely smooth the first time, but this time I can't figure out what is wrong.

The modules I am having problems with are:
celengine, celutil and celestia.

I get this message on all of these modules:
fatal error C1083: Cannot open include file: 'libintl.h': No such file or directory


and this error only with celengine:
c1xx : fatal error C1083: Cannot open source file: '.\octree.cpp': No such file or directory

octree.cpp is in the project makefile, but it isn't on the server anymore. Is it not used now? Can I just delete it from the build?

libintl.h seems to be tied to a language translator utility called "gettext".

How do I either get around using gettext, or install it (for just english)?


The whole reason for me even wanting to recompile, is that I wanted to use the CELEX Lua scripting interface to load a dll called LuaCLIPS. With this dll, I hope to include some AI into the scripts I make for Celestia.

However, when I call the loadlib() function in a CELEX script in Celestia, I get the following error:
Fatal Error:
Attempt to call global "loadlib' (a nil value)

I can run the exact same lua file in standalone Lua(5.02) and the luaCLIPS dll works fine.

So my questions are:
How can I get Celestia to compile?
How can I get the loadlib() function installed in the Lua engine in Celestia?


Thanks
Paul
:cry:
Paul

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 18 years 8 months

Post #2by GlobeMaker » 25.02.2006, 11:49

Hello Paul,

I also failed to compile the latest CVS source code. I obtained the libintl.h file
as described here :
http://www.celestiaproject.net/forum/viewtopic ... 8983864ea9

But the compilation still failed. It seems the octree related code has errors:
see errors messages in excerpts from compile.txt :

dsodb.cpp
dsoname.cpp
dsooctree.cpp
dsooctree.cpp(101) : error C2371: 'i' : redefinition; different basic types
dsooctree.cpp(81) : see declaration of 'i'
execution.cpp
fragmentprog.cpp
frame.cpp
regcombine.cpp
render.cpp
render.cpp(6815) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(583) : error C2784: 'bool __cdecl std::operator <(const class std::multimap<_K,_Ty,_Pr,_A> &,const class std::multimap<_K,_Ty,_Pr,_A> &)' : could not deduce template argument for 'const class std::multimap<_K,_Ty,_Pr,_A> &' from 'Renderer::Label'
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(548) : see reference to function template instantiation 'void __cdecl std::_Unguarded_insert(Renderer::Label *,Renderer::Label)' being compiled
C:\Program Files\Microsoft
.
.
.
selection.cpp
shadermanager.cpp
shadermanager.cpp(1057) : error C2374: 'i' : redefinition; multiple initialization
shadermanager.cpp(1021) : see declaration of 'i'
simulation.cpp
solarsys.cpp
spheremesh.cpp
star.cpp
starcolors.cpp
stardb.cpp
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(856) : error C2784: 'bool __cdecl std::operator <(const class std::multimap<_K,_Ty,_Pr,_A> &,const class std::multimap<_K,_Ty,_Pr,_A> &)' : could not deduce template argument for 'const class std::multimap<_K,_Ty,_Pr,_A> &' from 'struct StarDatabase::CrossIndexEntry'
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(847) : see reference to function template instantiation 'struct StarDatabase::CrossIndexEntry *__cdecl std::_Lower_bound(struct StarDatabase::CrossIndexEntry *,struct StarDatabase::CrossIndexEntry *,const struct StarDatabase::CrossIndexEntry &,int *)' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(856) : error C2784: 'bool __cdecl std::operator <(const class std::map<_K,_Ty,_Pr,_A> &,const class std::map<_K,_Ty,_Pr,_A> &)' : could not deduce template argument for 'const class std::map<_K,_Ty,_Pr,_A> &' from 'struct StarDatabase::CrossIndexEntry'
C:\Program Files\Microsoft Visual Studio\VC98\include\algorithm(847) : see reference to function template instantiation 'struct StarDatabase::CrossIndexEntry *__cdecl std::_Lower_bound(struct StarDatabase::CrossIndexEntry *,struct StarDatabase::CrossIndexEntry *,const struct StarDatabase::CrossIndexEntry &,int *)' being compiled
C:\Program Files\Mic
.
.
.
staroctree.cpp
staroctree.cpp(106) : error C2371: 'i' : redefinition; different basic types
staroctree.cpp(88) : see declaration of 'i'
stellarclass.cpp
texmanager.cpp
texture.cpp
../../inc/libjpeg\jmorecfg.h(215) : warning C4005: 'FAR' : macro redefinition
C:\Program Files\Microsoft Visual Studio\VC98\include\windef.h(135) : see previous definition of 'FAR'
tokenizer.cpp
trajmanager.cpp
univcoord.cpp
universe.cpp
vertexlist.cpp
vertexprog.cpp
virtualtex.cpp
vsop87.cpp


I have tried it with octree.cpp copied from an old directory, but got the
same error messages about staroctree, dsooctree.cpp . I tried it without
octree.cpp and it failed the same way. So that file makes no difference.

Here is my makerelease.bat :
cd src
nmake /f winbuild.mak CFG=Release %1 > c:\CVS4\celestia\compile.txt
cd ..
copy src\celestia\Release\celestia.exe .
Your wish is my command line.

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Post #3by selden » 25.02.2006, 13:41

The developers are in the middle of internationalizing Celestia. I suspect that someone forgot to upload that include file. Hopefully it'll be uploaded soon.

You'll need to download a modified version of Celestia's Windows libraries, too. Unfortunately, that has not been updated yet, either.
http://shatters.net/celestia/files/?C=M;O=D
should show it at the top of the directory listing when winlibs-new.zip has been updated.

It seems likely that Celestia will not run under Win98 when Unicode support is finished.
Selden

Topic author
paulooch1958
Posts: 11
Joined: 26.05.2005
With us: 19 years 1 month
Location: Cal

Thanks for the info.

Post #4by paulooch1958 » 26.02.2006, 00:20

Ok, well that explains not being able to compil.

I have a backup of the earlier version of source from about a year ago. I could start working with that I suppose.

I still have the main problem I was trying to overcome of not being able to get the Lua function loadlib() to work in celestia. Ive seen some other posts about loading other libraries and dlls into Celestia, and at least one other person has tried the Lua loadlib function as well, with the same error that I got. One of his replies was that not all Lua functiions were compiled into Celestia and that the function I want may have to be added to the build and recompiled.

Any thought on this? How can I find out what Lua functions are supported, and how can I add to them?

Thanks,
Paul
Paul

Topic author
paulooch1958
Posts: 11
Joined: 26.05.2005
With us: 19 years 1 month
Location: Cal

Here is the post about needing to add the loadlib function..

Post #5by paulooch1958 » 26.02.2006, 00:24

Harry wrote:
marc wrote:I havn't tried it yet but lua also has the ability to use dll's, I'm not sure if it needs the os library however. Perhaps there is already a security hole?
You are thinking of "loadlib", right? This would be a problem if it was actually there, but it isn't. It looks like you have to specifially add it while compiling lua (at least for Linux) and then activate it just like the io&os libraries. Blame the Lua-manual for not mentioning this ;)

On an unrelated note: I don't think it makes sense to enable io and os seperately - if a script can write files, it probably can start a program (autorun etc.), and once it can execute programs writing isn't a problem anymore.

Harald
Paul

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Post #6by selden » 26.02.2006, 00:35

You can download the sources used for v1.4.1 final, you don't need to go a year back. They're available on the same SourceForge page as the binaries:
http://sourceforge.net/project/showfile ... p_id=21302

You'll need tar and gunzip.
I use Cygwin under Windows, which includes both (and a lot more stuff).

Sorry, I can't help with Lua. Harald's the expert.
Selden

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 5 months
Location: Seattle, WA USA

Re: Here is the post about needing to add the loadlib functi

Post #7by hank » 26.02.2006, 02:28

paulooch1958 wrote:
Harry wrote:
marc wrote:I havn't tried it yet but lua also has the ability to use dll's, I'm not sure if it needs the os library however. Perhaps there is already a security hole?
You are thinking of "loadlib", right? This would be a problem if it was actually there, but it isn't. It looks like you have to specifially add it while compiling lua (at least for Linux) and then activate it just like the io&os libraries. Blame the Lua-manual for not mentioning this ;)
Harald


Paul,

As a work around for the problem that loadlib wasn't built into Lua for Celestia, you can just add the code for loadlib to celx.cpp to make it available to your celx scripts. The following worked for me on MacOS X:

Code: Select all

extern "C" {
#include <lualib.h>
/* #include <lauxlib.h.h> */
#include <dlfcn.h>
}

static int x_loadlib(lua_State *L)
{
/* temp -- don't have lauxlib
 const char *path=luaL_checkstring(L,1);
 const char *init=luaL_checkstring(L,2);
*/

 const char *path=lua_tostring(L,1);
 const char *init=lua_tostring(L,2);
 
 void *lib=dlopen(path,RTLD_NOW);
 if (lib!=NULL)
 {
  lua_CFunction f=(lua_CFunction) dlsym(lib,init);
  if (f!=NULL)
  {
   lua_pushlightuserdata(L,lib);
   lua_pushcclosure(L,f,1);
   return 1;
  }
 }
 /* else return appropriate error messages */
 lua_pushnil(L);
 lua_pushstring(L,dlerror());
 lua_pushstring(L,(lib!=NULL) ? "init" : "open");
 if (lib!=NULL) dlclose(lib);
 return 3;
}

bool LuaState::init(CelestiaCore* appCore)
{
...
    lua_pushstring(state, "loadlib");
    lua_pushcfunction(state, x_loadlib);
    lua_settable(state, LUA_GLOBALSINDEX);
...
}


I think something slightly different is required for Windows, but you should be able to find the necessary code at lua.org.

- Hank

Topic author
paulooch1958
Posts: 11
Joined: 26.05.2005
With us: 19 years 1 month
Location: Cal

Got it!

Post #8by paulooch1958 » 26.02.2006, 18:29

Thanks Guys!

I downloaded Celestia v1.4.1 source and inserted the code for loadlib and some supporting calls into celx.cpp, recompiled and I got my luaCLIPS dll running CLIPS code in Celestia!

Thanks for all he help, I really appreciate it!


Paul
Paul

georgiouk
Posts: 47
Joined: 02.05.2005
With us: 19 years 2 months
Location: Greece

Post #9by georgiouk » 27.02.2006, 09:45

Hi to all celestians.
I had the same problem as GlobeMaker.
So I have download the libintl from this website:

http://prdownloads.sourceforge.net/gnuw ... p?download


and added this code to the celvars.bat


Code:
@echo off
Set PATH=C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;%PATH%
Set INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;%LIB%

Set INCLUDE=C:\Program Files\Microsoft Platform SDK\Include;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Platform SDK\Lib;%LIB%
Set INCLUDE=C:\Program Files\Microsoft Platform SDK\Include\mfc;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Platform SDK\Lib\IA64\mfc;%LIB%

Set PATH=C:\Program Files\GnuWin32\bin;%PATH%
Set LIB=C:\Program Files\GnuWin32\lib;%LIB%

and compiled without any problem.


georgiouk. :)

tec
Posts: 51
Joined: 14.03.2006
With us: 18 years 3 months
Location: Huntsville, AL

compiler stating octree.cpp is missing

Post #10by tec » 16.03.2006, 14:25

Has the octree.cpp issue been resolved, yet? It has been a month since paulooch1958's post. I got the same problem. Are there any work arounds?

Tim

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Post #11by selden » 16.03.2006, 17:34

Tim,

In order to build v1.4.1, you need to download the updated set of Windows-specific shared libraries. These libraries (and their predecessors) have never been included with Celestia on SourceForge. They're available at
http://www.celestiaproject.net/celestia/files/winlibs-new.zip
Selden

tec
Posts: 51
Joined: 14.03.2006
With us: 18 years 3 months
Location: Huntsville, AL

octree.cpp

Post #12by tec » 16.03.2006, 19:38

I already have this zip file. My issue is the fact that octree.cpp does not exist but it is in the solution file. I remove the dependancy to it, but when I link I get 45 unresolved errors. It looks like I have the same issues as GlobeMaker. Here are a few errors.

Celestia error LNK2001: unresolved external symbol _wglChoosePixelFormatARB

Celestia error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall DSODatabase::getDSOName(class DeepSkyObject const * const &)const " (?getDSOName@DSODatabase@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABQBVDeepSkyObject@@@Z)

Celestia error LNK2019: unresolved external symbol "public: __thiscall DSODatabase::~DSODatabase(void)" (??1DSODatabase@@QAE@XZ) referenced in function "public: void * __thiscall DSODatabase::`scalar deleting destructor'(unsigned int)" (??_GDSODatabase@@QAEPAXI@Z)

Celestia error LNK2019: unresolved external symbol "public: bool __thiscall DSODatabase::load(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?load@DSODatabase@@QAE_NAAV?$basic_istream@DU?$char_traits@D@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) referenced in function "public: bool __thiscall CelestiaCore::initSimulation(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const *,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const *,class ProgressNotifier *)" (?initSimulation@CelestiaCore@@QAE_NPBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@PAVProgressNotifier@@@Z)

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 10 months
Location: NY, USA

Post #13by selden » 16.03.2006, 20:37

I'm guessing that you may be trying to use VisualStudio's GUI to build Celestia. I've never done that, so I can't help if you are. Others have, though. My understanding is that the project files are not up to date.

The "supported" method for building Celestia under Windows is to use one of the scripts makerelease.bat or makedebug.bat. I've never used makedebug.bat. My understanding is that Chris uses VisualStudio's GUI only for editing, not for building the program.

If you haven't already, please read the sticky threads at the top of the Development forum. They discuss the various things people have done to create build environments for Celestia.

p.s. Just to make it clear: I have VS2003 installed, but don't use any of its GUI functionality. I seldom edit anything, but when I do, I use emacs. I build the software using makerelease.bat. I've never seen any error messages related to a file named octree.cpp.
Selden

Avatar
HB M
Posts: 132
Joined: 26.11.2002
With us: 21 years 7 months
Location: Eindhoven, The Netherlands

Post #14by HB » 20.03.2006, 12:19

selden wrote:
I'm guessing that you may be trying to use VisualStudio's GUI to build Celestia. I've never done that, so I can't help if you are. Others have, though. My understanding is that the project files are not up to date.

The "supported" method for building Celestia under Windows is to use one of the scripts makerelease.bat or makedebug.bat. I've never used makedebug.bat. My understanding is that Chris uses VisualStudio's GUI only for editing, not for building the program.

If you haven't already, please read the sticky threads at the top of the Development forum. They discuss the various things people have done to create build environments for Celestia.


Well, building Celestia with GUI of Visual Studio works fine to me.
First I've used VS6.0 with VC++6.0 but for a year or more ago the code has changed in such a way that VC++ 6.0 can't be used anylonger.
So I was forced to use VS.net (7.0) which was working fine as well. But after a while I've got problems with the GUI which I couldn't repair without reinstalling XP. I uninstalled it so I continue to build with the commandline tools only.(Microsoft Visual C++ Toolkit 2003)
In case of problems or experiments the VS GUI is very handy in faultfinding and editing. So I was in a desperate need of a proper working GUI.
This is what I've done to satisfy my needs:
I"ve installed VS 6.0 again and replace all the BIN, INCLUDE, and LIB files with those from the Microsoft Visual C++ Toolkit 2003.
The Environmental settings has to be changed of coarse and VS6.0 use, simple saying, Workspace-files instead Solutions-files.
For building Celestia it works. For other kind of builds I'm not certain.

I'll read read the sticky threads at the top of the Development forum and see if there is someting more I can contribute to create build environments for Celestia.
HB

Avatar
John Van Vliet
Posts: 2940
Joined: 28.08.2002
With us: 21 years 10 months

re

Post #15by John Van Vliet » 15.04.2006, 01:58

there is an old vc++.net .snl posted on my site it is for 1.4.0.FT1 but should work fine
there are 2 downloades one is all the .h and .dll files along with the visual stiodo project
the other is just the project files

Topic author
paulooch1958
Posts: 11
Joined: 26.05.2005
With us: 19 years 1 month
Location: Cal

test

Post #16by paulooch1958 » 16.04.2006, 06:39

test
Paul


Return to “Development”