Compiling the CMOD tools on a non-Windows platform

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Compiling the CMOD tools on a non-Windows platform

Post #1by ajtribick » 09.02.2009, 21:29

Is it just me or is the makefile provided in the src/tools/cmod directory a Windows-only file? I'm attempting to compile the CMOD tools on Ubuntu and not getting very far. :(

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 18 years 9 months
Location: Seattle, Washington, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #2by chris » 09.02.2009, 22:29

ajtribick wrote:Is it just me or is the makefile provided in the src/tools/cmod directory a Windows-only file? I'm attempting to compile the CMOD tools on Ubuntu and not getting very far. :(

Yes, it's Windows only. I don't know enough about automake, etc. to do a Linux makefile. The cmod tools use the celengine library for loading and writing cmod problems--may this dependency is what's causing troubles?

--Chris

Avatar
cartrite
Posts: 1794
Joined: 15.09.2005
With us: 15 years 2 months
Location: Pocono Mountains, Pennsylvania, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #3by cartrite » 09.02.2009, 23:07

I tried to compile 1 program on Linux and I don't think it found any headers. I got a ton of errors. So you may need to gather up all the headers the programs need or edit their paths in the cpp files.
cartrite
Toshiba Satellite P875=S7200 laptop, Intel i5 processor 2.5 ghz 6 gb ram, Graphics Intel(R) HD Graphics 4000 openSUSE Leap 15.1 and soon to be 15.2

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 18
With us: 18 years 7 months
Location: Hamburg, Germany

Re: Compiling the CMOD tools on a non-Windows platform

Post #4by t00fri » 09.02.2009, 23:22

I remember that I compiled the programs in the cmod directory under (SuSE)Linux a long long time ago, yet without any particular difficulties. I seem to remember that at first I was fiddling with quite a few symbolic links to get the header tree right.

But all this is really vanishing in the "fog" meanwhile ;-)

Fridger
Image

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 18 years 9 months
Location: Seattle, Washington, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #5by chris » 10.02.2009, 00:39

I committed a small change to cmodfix that will help it build with modern compilers. There was one place in the code that assumed old style for loop scoping rules (MSVC 2003 is the only widely used compiler that still had this as the default.) The fixed code will work compilers that use either old or modern for loop scoping.

--Chris

Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Re: Compiling the CMOD tools on a non-Windows platform

Post #6by ajtribick » 10.02.2009, 20:31

Well I'm trying compiling cmodfix directly using the g++ command rather than the makefile, getting the following errors:

Code: Select all

cmodfix.cpp:80: error: expected unqualified-id before ‘public’
cmodfix.cpp:84: error: expected class-name before ‘{’ token
cmodfix.cpp:112: error: expected class-name before ‘{’ token
cmodfix.cpp:148: error: expected class-name before ‘{’ token
cmodfix.cpp: In function ‘bool uniquifyVertices(Mesh&)’:
cmodfix.cpp:386: warning: deleting ‘const void*’ is undefined
cmodfix.cpp: In function ‘Mesh* generateNormals(Mesh&, float, bool)’:
cmodfix.cpp:719: error: no matching function for call to ‘joinVertices(std::vector<Face, std::allocator<Face> >&, const void*&, const Mesh::VertexDescription&, PointComparator)’
cmodfix.cpp:519: note: candidates are: void joinVertices(std::vector<Face, std::allocator<Face> >&, const void*, const Mesh::VertexDescription&, T&) [with T = PointComparator]
cmodfix.cpp: In function ‘Mesh* generateTangents(Mesh&, bool)’:
cmodfix.cpp:977: error: no matching function for call to ‘joinVertices(std::vector<Face, std::allocator<Face> >&, const void*&, const Mesh::VertexDescription&, PointTexCoordComparator)’
cmodfix.cpp:519: note: candidates are: void joinVertices(std::vector<Face, std::allocator<Face> >&, const void*, const Mesh::VertexDescription&, T&) [with T = PointTexCoordComparator]
cmodfix.cpp: In function ‘int main(int, char**)’:
cmodfix.cpp:1511: error: invalid conversion from ‘int’ to ‘std::_Ios_Openmode’
cmodfix.cpp:1511: error:   initializing argument 2 of ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]’

Is this gcc 4.3 being picky again?
Last edited by ajtribick on 10.02.2009, 23:02, edited 1 time in total.

Avatar
cartrite
Posts: 1794
Joined: 15.09.2005
With us: 15 years 2 months
Location: Pocono Mountains, Pennsylvania, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #7by cartrite » 10.02.2009, 20:47

Gcc43 depreciated a lot of system headers. Sometimes all that will be needed is an extra #include. You may want to check this and see. http://gcc.gnu.org/gcc-4.3/porting_to.html
cartrite
Toshiba Satellite P875=S7200 laptop, Intel i5 processor 2.5 ghz 6 gb ram, Graphics Intel(R) HD Graphics 4000 openSUSE Leap 15.1 and soon to be 15.2

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 18 years 9 months
Location: Seattle, Washington, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #8by chris » 10.02.2009, 23:17

I just committed fixes for some of the errors that you're seeing from gcc. I tried building cmodfix on my Mac and hit some of the same problems (with gcc 4.0.1).

--Chris

Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Re: Compiling the CMOD tools on a non-Windows platform

Post #9by ajtribick » 10.02.2009, 23:25

So what options should I be using to compile it with?

I'm using g++ -I../.. -o cmodfix cmodfix.cpp

but I am pretty certain that I need to put more in there, because

Code: Select all

cmodfix.cpp: In function ‘bool uniquifyVertices(Mesh&)’:
cmodfix.cpp:386: warning: deleting ‘const void*’ is undefined
/tmp/ccogZMNl.o: In function `addGroupWithOffset(Mesh&, Mesh::PrimitiveGroup const&, unsigned int)':
cmodfix.cpp:(.text+0xa42): undefined reference to `Mesh::addGroup(Mesh::PrimitiveGroupType, unsigned int, unsigned int, unsigned int*)'
/tmp/ccogZMNl.o: In function `mergeModelMeshes(Model const&)':
cmodfix.cpp:(.text+0xa7a): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0xa9e): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0xaf1): undefined reference to `Model::Model()'
cmodfix.cpp:(.text+0xb52): undefined reference to `Model::getMaterial(unsigned int) const'
cmodfix.cpp:(.text+0xb5e): undefined reference to `Model::addMaterial(Mesh::Material const*)'
cmodfix.cpp:(.text+0xb71): undefined reference to `Model::getMaterial(unsigned int) const'
cmodfix.cpp:(.text+0xb9b): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text+0xbc3): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text+0xc61): undefined reference to `Mesh::Mesh()'
cmodfix.cpp:(.text+0xc79): undefined reference to `Mesh::setVertexDescription(Mesh::VertexDescription const&)'
cmodfix.cpp:(.text+0xcc9): undefined reference to `Mesh::setVertices(unsigned int, void*)'
cmodfix.cpp:(.text+0xd40): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0xd5f): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0xdb9): undefined reference to `Model::addMesh(Mesh*)'
/tmp/ccogZMNl.o: In function `copyVertex(void*, Mesh::VertexDescription const&, void const*, Mesh::VertexDescription const&, unsigned int, unsigned int const*)':
cmodfix.cpp:(.text+0xeb2): undefined reference to `Mesh::getVertexAttributeSize(Mesh::VertexAttributeFormat)'
/tmp/ccogZMNl.o: In function `augmentVertexDescription(Mesh::VertexDescription&, Mesh::VertexAttributeSemantic, Mesh::VertexAttributeFormat)':
cmodfix.cpp:(.text+0x108f): undefined reference to `Mesh::getVertexAttributeSize(Mesh::VertexAttributeFormat)'
cmodfix.cpp:(.text+0x10f9): undefined reference to `Mesh::getVertexAttributeSize(Mesh::VertexAttributeFormat)'
/tmp/ccogZMNl.o: In function `generateTangents(Mesh&, bool)':
cmodfix.cpp:(.text+0x1287): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text+0x1395): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x1458): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x1531): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x164d): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x1e4d): undefined reference to `Mesh::VertexDescription::VertexDescription(Mesh::VertexDescription const&)'
cmodfix.cpp:(.text+0x208f): undefined reference to `Mesh::getVertexAttributeSize(Mesh::VertexAttributeFormat)'
cmodfix.cpp:(.text+0x20fe): undefined reference to `Mesh::Mesh()'
cmodfix.cpp:(.text+0x211f): undefined reference to `Mesh::setVertexDescription(Mesh::VertexDescription const&)'
cmodfix.cpp:(.text+0x217c): undefined reference to `Mesh::setVertices(unsigned int, void*)'
cmodfix.cpp:(.text+0x21de): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x220c): undefined reference to `Mesh::addGroup(Mesh::PrimitiveGroupType, unsigned int, unsigned int, unsigned int*)'
cmodfix.cpp:(.text+0x22a9): undefined reference to `Mesh::VertexDescription::~VertexDescription()'
cmodfix.cpp:(.text+0x22d3): undefined reference to `Mesh::VertexDescription::~VertexDescription()'
/tmp/ccogZMNl.o: In function `generateNormals(Mesh&, float, bool)':
cmodfix.cpp:(.text+0x23dd): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text+0x2451): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x2589): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x2662): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x29ed): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x3025): undefined reference to `Mesh::VertexDescription::VertexDescription(Mesh::VertexDescription const&)'
cmodfix.cpp:(.text+0x3267): undefined reference to `Mesh::getVertexAttributeSize(Mesh::VertexAttributeFormat)'
cmodfix.cpp:(.text+0x32d6): undefined reference to `Mesh::Mesh()'
cmodfix.cpp:(.text+0x32f7): undefined reference to `Mesh::setVertexDescription(Mesh::VertexDescription const&)'
cmodfix.cpp:(.text+0x3354): undefined reference to `Mesh::setVertices(unsigned int, void*)'
cmodfix.cpp:(.text+0x33b6): undefined reference to `Mesh::getGroup(unsigned int) const'
cmodfix.cpp:(.text+0x33e4): undefined reference to `Mesh::addGroup(Mesh::PrimitiveGroupType, unsigned int, unsigned int, unsigned int*)'
cmodfix.cpp:(.text+0x3481): undefined reference to `Mesh::VertexDescription::~VertexDescription()'
cmodfix.cpp:(.text+0x34ab): undefined reference to `Mesh::VertexDescription::~VertexDescription()'
/tmp/ccogZMNl.o: In function `uniquifyVertices(Mesh&)':
cmodfix.cpp:(.text+0x3594): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text+0x3935): undefined reference to `Mesh::setVertices(unsigned int, void*)'
cmodfix.cpp:(.text+0x3948): undefined reference to `Mesh::remapIndices(std::vector<unsigned int, std::allocator<unsigned int> > const&)'
/tmp/ccogZMNl.o: In function `main':
cmodfix.cpp:(.text+0x3afd): undefined reference to `LoadModel(std::basic_istream<char, std::char_traits<char> >&)'
cmodfix.cpp:(.text+0x3b73): undefined reference to `LoadModel(std::basic_istream<char, std::char_traits<char> >&)'
cmodfix.cpp:(.text+0x3bca): undefined reference to `Model::Model()'
cmodfix.cpp:(.text+0x3c34): undefined reference to `Model::getMaterial(unsigned int) const'
cmodfix.cpp:(.text+0x3c43): undefined reference to `Model::addMaterial(Mesh::Material const*)'
cmodfix.cpp:(.text+0x3c5c): undefined reference to `Model::getMaterial(unsigned int) const'
cmodfix.cpp:(.text+0x3c87): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0x3d77): undefined reference to `Model::addMesh(Mesh*)'
cmodfix.cpp:(.text+0x3d90): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0x3df3): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0x3e1f): undefined reference to `Model::getMesh(unsigned int) const'
cmodfix.cpp:(.text+0x3e53): undefined reference to `SaveModelBinary(Model const*, std::basic_ostream<char, std::char_traits<char> >&)'
cmodfix.cpp:(.text+0x3e69): undefined reference to `SaveModelAscii(Model const*, std::basic_ostream<char, std::char_traits<char> >&)'
cmodfix.cpp:(.text+0x3f30): undefined reference to `SaveModelBinary(Model const*, std::basic_ostream<char, std::char_traits<char> >&)'
cmodfix.cpp:(.text+0x3f45): undefined reference to `SaveModelAscii(Model const*, std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccogZMNl.o: In function `MeshVertexDescComparator::operator()(Mesh const*, Mesh const*) const':
cmodfix.cpp:(.text._ZNK24MeshVertexDescComparatorclEPK4MeshS2_[MeshVertexDescComparator::operator()(Mesh const*, Mesh const*) const]+0x1a): undefined reference to `Mesh::getVertexDescription() const'
cmodfix.cpp:(.text._ZNK24MeshVertexDescComparatorclEPK4MeshS2_[MeshVertexDescComparator::operator()(Mesh const*, Mesh const*) const]+0x26): undefined reference to `Mesh::getVertexDescription() const'
collect2: ld returned 1 exit status

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 18 years 9 months
Location: Seattle, Washington, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #10by chris » 11.02.2009, 01:42

ajtribick wrote:So what options should I be using to compile it with?

I'm using g++ -I../.. -o cmodfix cmodfix.cpp

but I am pretty certain that I need to put more in there, because

Right... You need to link with the Celestia libraries: celutil.a, celmath.a, cel3ds.a, celtxf.a, celengine.a

This long list of dependencies is unfortunate. We should really be able to isolate the cmod code into a single package, perhaps called libcmod.

--Chris

Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Re: Compiling the CMOD tools on a non-Windows platform

Post #11by ajtribick » 11.02.2009, 19:49

Ok where would I get those? I'm building the Qt4 version of Celestia, and it doesn't look like it builds the libraries...

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 18 years 9 months
Location: Seattle, Washington, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #12by chris » 11.02.2009, 20:01

ajtribick wrote:Ok where would I get those? I'm building the Qt4 version of Celestia, and it doesn't look like it builds the libraries...

You're right... I wasn't able to get qmake to build them as separate libraries. I'll try and come up with some sort of workaround for you.

--Chris

Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Re: Compiling the CMOD tools on a non-Windows platform

Post #13by ajtribick » 15.02.2009, 22:10

Ok, now I'm really frustrated. Can't even get it to work on Windows XP. Building using the Visual Studio project doesn't seem to build the libraries, using makerelease.bat does but the build doesn't complete, and after doing that using nmake /f cmodtools.mak throws a "fatal error libc.lib not found" error. I'm guessing this is to do with the fact that I've got the 2008 version of Visual Studio.

The version of cmodfix.exe I downloaded from http://www.celestiaproject.net/~claurel/celestia/cmodtools/ doesn't work either - every time I run it it just immediately exits without so much as a message. I guess it's an obsolete version?

:evil:

Avatar
selden
Developer
Posts: 10138
Joined: 04.09.2002
With us: 18 years 2 months
Location: NY, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #14by selden » 16.02.2009, 00:33

The cmod utilities available for downloading from Shatters require two graphics dlls which were distributed with Celestia v1.4.1:
libpng1.dll
zlib.dll
Put them in the same directory where you've put the utilities.
Selden

Topic author
ajtribick
Developer
Posts: 1810
Joined: 11.08.2003
With us: 17 years 3 months
Location: Switzerland

Re: Compiling the CMOD tools on a non-Windows platform

Post #15by ajtribick » 21.02.2009, 12:19

selden wrote:The cmod utilities available for downloading from Shatters require two graphics dlls which were distributed with Celestia v1.4.1:
libpng1.dll
zlib.dll
Put them in the same directory where you've put the utilities.
Thanks for the info, that's reduced the size of my upcoming W UMa binaries add-on quite a bit! :)

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 18
With us: 18 years 7 months
Location: Hamburg, Germany

Re: Compiling the CMOD tools on a non-Windows platform

Post #16by t00fri » 18.09.2009, 17:06

Since this thread seemed to have ended in the void, let me give you the commands that I use to compile cmodfix under Linux (OpenSuse 10.3 and OpenSuse 11.1) and latest SVN (1.6+).

Of course it implies already the conversion to thirdparty libs (Eigen...)

Doing a Makefile for all the CMOD tools in the tools/ directory is trivial, but I didn't want to spend my time with this, since the Makefile also needs to make sure that all the required libs etc are available, else they must also be compiled etc...That's also straightforward, but certainly a bit time consuming when it comes to these gory details.

Code: Select all

compile
========
g++ -c -I../..  -I ../../../thirdparty/Eigen  cmodfix.cpp

link
=====
g++ -o cmodfix cmodfix.o ../../celengine/libcelengine.a ../../celutil/libcelutil.a ../../celmath/libcelmath.a ../../cel3ds/libcel3ds.a ../../celtxf/libceltxf.a -lGL -lGLU -llua /usr/local/cspice/lib/cspice.a -lpng -ljpeg



There is only one compiler warning (gcc version 4.2.1 (OpenSuse 10.3) & gcc version 4.3.2 (OpenSuse 11.1) )

Code: Select all

cmodfix.cpp: In function ‘bool uniquifyVertices(Mesh&)’:
cmodfix.cpp:386: warning: deleting ‘const void*’ is undefined


So far, I have tested cmodfix by converting the binary phobos.cmod into the ascii version.
Further tests would be valuable.

Fridger
Image

Avatar
cartrite
Posts: 1794
Joined: 15.09.2005
With us: 15 years 2 months
Location: Pocono Mountains, Pennsylvania, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #17by cartrite » 18.09.2009, 18:25

Hi Fridger,
Tried your line and it failed to find Gl/glew.h.
Needed this too.

Code: Select all

-I ../../../thirdparty/glew/include

The line I had to use.

Code: Select all

g++ -c -I../.. -I ../../../thirdparty -I ../../../thirdparty/Eigen -I ../../../thirdparty/glew/include cmodfix.cpp

The link line worked fine.
cartrite
Toshiba Satellite P875=S7200 laptop, Intel i5 processor 2.5 ghz 6 gb ram, Graphics Intel(R) HD Graphics 4000 openSUSE Leap 15.1 and soon to be 15.2

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 18
With us: 18 years 7 months
Location: Hamburg, Germany

Re: Compiling the CMOD tools on a non-Windows platform

Post #18by t00fri » 18.09.2009, 18:45

cartrite wrote:Hi Fridger,
Tried your line and it failed to find Gl/glew.h.
Needed this too.

Code: Select all

-I ../../../thirdparty/glew/include

The line I had to use.

Code: Select all

g++ -c -I../.. -I ../../../thirdparty -I ../../../thirdparty/Eigen -I ../../../thirdparty/glew/include cmodfix.cpp

The link line worked fine.
cartrite

Well you don't have glew, glew-devel and libGLEW from OpenSuSE 11.1 installed. Then you clearly need that internal reference. But under Linux glew is a standard library!?

Fridger
Image

Avatar
cartrite
Posts: 1794
Joined: 15.09.2005
With us: 15 years 2 months
Location: Pocono Mountains, Pennsylvania, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #19by cartrite » 18.09.2009, 19:13

Your right. I don't have them installed. I think I did at one point but I uninstalled them when I had trouble compiling Celestia when Glew was first enabled. I thought there may have been conflicts. Maybe I'll install them again since they don't cause any problems on your system.
cartrite
Toshiba Satellite P875=S7200 laptop, Intel i5 processor 2.5 ghz 6 gb ram, Graphics Intel(R) HD Graphics 4000 openSUSE Leap 15.1 and soon to be 15.2

Avatar
cartrite
Posts: 1794
Joined: 15.09.2005
With us: 15 years 2 months
Location: Pocono Mountains, Pennsylvania, USA

Re: Compiling the CMOD tools on a non-Windows platform

Post #20by cartrite » 18.09.2009, 19:22

Right after I built cmodfix, I tried to build 3dstocmod. That still needs some Eigen conversions. Got a few build errors. It builds great on 1.6.1. I wanted to build that last week when I was playing around with that Blender export script. Seems that specpower is being exported with 3dstocmod. Just seen that. But I can't figure out what Material variable to use with Blender to get specpower to be exported. I can export diffuse and specular color but specpower???????
cartrite
Toshiba Satellite P875=S7200 laptop, Intel i5 processor 2.5 ghz 6 gb ram, Graphics Intel(R) HD Graphics 4000 openSUSE Leap 15.1 and soon to be 15.2


Return to “Development”

Who is online