Game Development Community

Compiling TGB 1.5.1 (at least trying to)

by David Janssens · in Torque Game Builder · 11/15/2007 (3:31 pm) · 18 replies

I am trying to get TGB 1.5.1 (current latest version to be found in the wild) compiling on a OpenSuSE 10.3 system (which implies also a GCC 4.2 compiler - deadly combination it seems).

These are the steps I have taken until now :
- get the source code from a windows machine to linux
- make sure nasm, sdl-devel, openal-devel are installed
- in ./engine/lib/openal/LINUX/al/alc_func.h change the appearance of ALCvoid into a simple void
- in ./engine/lib/openal/LINUX/al/al_func.h change the appearance of ALvoid into a simple void
- in ./engine/source/console/consoleObject.h : remove the 'AbstractClasRep::' on line 274
- in .engine/compilers/make/targets.torque.mk : change scriptObject.cc to scriptObjects.cc on line 33
- in ./engine/compilers/make/targets.torque.mk: change the lines around line 73 talking about zip files into these 3:
core/zipCryptStream.cc \
core/zipObject.cc \
core/zipSubStream.cc

...
and then I'm stuck. My compiler gives this warning :
dgl/dgl.cc: In function 'U32 dglDrawTextN(GFont*, const Point2I&, const UTF16*, U32, const ColorI*, U32, F32)':
dgl/dgl.cc:343: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
./core/frameAllocator.h:259: note: candidate 1: T& FrameTemp::operator[](U32) [with T = TextVertex]

I have looked on the internet, but no clear explanation is available. My C++ is too rusty to be able to find a way out it seems. Any help would be appreciated.

Thanks

#1
11/26/2007 (5:17 pm)
I got past that part by commenting out lines 258, 259, 260, and 261 in engine/source/core/frameAllocator.h.

The next problem is in engine/compilers/make/targets.torque.mk. The SOURCE.T2D section needs to be updated to match the new file structure. I'll post the changes when I get them working, but it may take a little time, my C++ is a bit rusty also.
#2
11/26/2007 (5:26 pm)
Well, compared to you, I guess my C++ is all but eaten by the rust. You got past that error message, and i didn't :-)

Thank you VERY much. This should get me a bit further. I'll have a look too, that way we can benefit from the other's work.
#3
11/27/2007 (5:53 pm)
Here are the changes I've made so far:

In the engine/compilers/make/targets.torque.mk file:

1. SOURCE.PLATFORMX86UNIX : The first line needs to be changed from
platform/platformNetAsync.cc \
to
platform/platformNetAsync.unix.cc \

2. SOURCE.PLATFORMX86UNIXDEDICATED : same change as before
platform/platformNetAsync.cc \
to
platform/platformNetAsync.unix.cc \

3. Here's the complete SOURCE.T2D section
SOURCE.T2D=\
	T2D/t2dActiveTile.cc \
        T2D/t2dAnimatedSprite.cc \
        T2D/t2dAnimationController.cc \
        T2D/t2dBaseDatablock.cc \
        T2D/t2dChunkedImageDatablock.cc \
        T2D/t2dChunkedSprite.cc \
        T2D/t2dGraphField.cc \
        T2D/t2dImageMapDatablock.cc \
        T2D/t2dParticleEffect.cc \
        T2D/t2dParticleEmitter.cc \
        T2D/t2dPath.cc \
        T2D/t2dPhysics.cc \
        T2D/t2dSceneContainer.cc \
        T2D/t2dSceneGraph.cc \
        T2D/t2dSceneObject.cc \
        T2D/t2dSceneObjectGroup.cc \
        T2D/t2dSceneObjectSet.cc \
        T2D/t2dSceneWindow.cc \
        T2D/t2dScroller.cc \
        T2D/t2dShape3D.cc \
        T2D/t2dShapeVector.cc \
        T2D/t2dStaticSprite.cc \
        T2D/t2dTextObject.cc\
        T2D/t2dTileMap.cc \
        T2D/t2dTrigger.cc \
        T2D/t2dUtility.cc \
        T2D/t2dVector.cc \
	T2D/t2dQuadBatch.cpp \
        T2D/activeTiles/t2dGunTurret.cc \
        T2D/activeTiles/t2dTestTile.cc \
        TGB/gui2DDatablockDropDown.cc \
        TGB/guiParticleGraphCtrl.cc \
        TGB/guiT2DObjectCtrl.cc \
        TGB/levelBuilder3DShapeTool.cc \
        TGB/levelBuilderAnimatedSpriteTool.cc \
        TGB/levelBuilderBaseEditTool.cc \
        TGB/levelBuilderBaseTool.cc \
        TGB/levelBuilderCameraTool.cc \
        TGB/levelBuilderChunkedSpriteTool.cc \
        TGB/levelBuilderCreateTool.cc \
        TGB/levelBuilderLinkPointTool.cc \
        TGB/levelBuilderMountTool.cc \
        TGB/levelBuilderParticleTool.cc \
        TGB/levelBuilderPathEditTool.cc \
        TGB/levelBuilderPathTool.cc \
        TGB/levelBuilderPolyTool.cc \
        TGB/levelBuilderSceneEdit.cc \
        TGB/levelBuilderSceneObjectTool.cc \
        TGB/levelBuilderSceneWindow.cc \
        TGB/levelBuilderScrollerTool.cc \
        TGB/levelBuilderSelectionTool.cc \
	TGB/levelBuilderSortPointTool.cc \
        TGB/levelBuilderStaticSpriteTool.cc \
        TGB/levelBuilderTextEditTool.cc \
        TGB/levelBuilderTextObjectTool.cc\
        TGB/levelBuilderTileMapEditTool.cc \
        TGB/levelBuilderTileMapTool.cc \
	TGB/levelBuilderTriggerTool.cc \
        TGB/levelBuilderWorldLimitTool.cc \
        TGB/preferencesManager.cc

In the TGB/levelBuilderTextEditTool.cc file change Line 8 from
#include "TGB/LevelBuilderTextEditTool.h"
to
#include "TGB/LevelBuilderTextEditTool.h"

That should be all the changes for now, hopefully I haven't missed something. Here's the next error:

platformX86UNIX/x86UNIXFileio.cc:887: error: no 'const char* Platform::getWorkingDirectory()' member function declared in class 'Platform'
#4
11/28/2007 (8:45 pm)
Here's the next set of fixes. I hope I'm not royally screwing this thing up (good thing I made a backup before starting).

In platform/platform.h, after line 448 add the following lines
// Missing, needed to fix platformX86UNIX/x86UNIXFileio.cc
static const char* getWorkingDirectory();


platformX86UNIX/x86UNIXFileio.cc generates an error caused by the platform/platformMutex.h file missing. After about 1 1/2 hours trying to fix it I simply copied the one from TGE 1.5.2.

Last fix for tonight

In platformX86UNIX/x86UNIXNet.cc change line 12 from
#include "platform/platformNetAsync.h"
to
#include "platform/platformNetAsync.unix.h"

The next set of errors has to do with platformX86UNIX/x86UNIXSemaphore.cc redefining functions that are defined in platform/threads/semaphore.h. The quick fix appears to copy platform/threads/semaphore.h into a platform/threads/semaphore.unix.h file and clean up the code there. I'll look at it tomorrow.
#5
12/09/2007 (6:02 am)
Thanks Jon, this is great. There is a thread discussing the new version of TGB, and I asked what the changes will be. It might be interesting to wait for the new version, but I'll try to get this one working anyway, as the newer version will be based on the 1.5.1 codebase.

I've been away from my linux machine lately, so I've been quiet. But I have access again, so things should get better now.

Cheers.
#6
12/09/2007 (2:18 pm)
Hey dudes
I really want to help with this. I want to drop windows completely and move to Linux but giving up TGB is really tought. Don't know THAT much about linux, but I'm expert with TGB and will help however I can.

I want to ask you about two main issues I see in the port and what your strategy is:
1) Platform specific menu in the editor
2) User folders that are used for strange stuff right now (compiled scripts, .uft files etc.)
#7
12/09/2007 (8:55 pm)
Here's what I've done next:
I made a threads directory under platformX86UNIX as I figure we should mimic what GG has done with the Mac and Win32 platforms.

I copied the platform/threads/semaphore.h to platformX86UNIX/threads/platformSemafore.unix.h and modified it to the below.
//-----------------------------------------------------------------------------

// Torque Game Engine

// Copyright (C) GarageGames.com, Inc.

//-----------------------------------------------------------------------------



#ifndef _PLATFORMSEMAPHORE_H_

#define _PLATFORMSEMAPHORE_H_



//-----------------------------------------------------------------------------
// Copied from platform/threads/semaphore.h
//-----------------------------------------------------------------------------



#ifndef _PLATFORM_THREAD_SEMAPHORE_H_

#define _PLATFORM_THREAD_SEMAPHORE_H_



#ifndef _TORQUE_TYPES_H_

#include "platform/types.h"

#endif



// Forward ref used by platform code

class PlatformSemaphore;



class Semaphore

{

protected:

   PlatformSemaphore *mData;

public:

   Semaphore(S32 initialCount = 1);

   ~Semaphore();

   bool acquire(bool block = true);

   void release();

   static void* createSemaphore(U32 initialCount = 1);

   static void destroySemaphore(void * semaphore);

   static bool acquireSemaphore(void * semaphore, bool block = true);

   static void releaseSemaphore(void * semaphore);

};



#endif


//-----------------------------------------------------------------------------

#endif

I then modified line 7 in platformX86UNIX/x86UNIXSemaphore.cc from
#include "platform/platformSemaphore.h"
to
#include "platformX86UNIX/threads/platformSemaphore.unix.h"

And the fix in this post will need to be done: TGB Linux Recursion Fix

That's all for tonight.
#8
12/09/2007 (9:01 pm)
Spider

To be perfectly honest I really hadn't thought that far out. Right now I'm just trying to get it to compile.
#9
02/02/2008 (3:29 am)
Exactly my 'strategy' at the moment. But you have a point Spider. It's something that needs to be looked into. The issue will come around when we try to build the editors.

It builds a great deal further now, but the number of 'No Newline at end of file' messages is really impressive :-) GCC 4.2 really is annoyingly precise on that account.
#10
02/02/2008 (1:58 pm)
I gave up on Torque at the end of last year. I am currently writing an editor for pygame using wx. Watch out for pygame to be as good as TGB by 2010. And free. And open source.
#11
02/02/2008 (3:43 pm)
I (finally) got TGB almost compiled now. I just need to install the library that gives me libGLU and I'm done. It has taken me through some hurdles and I've been learning loads of stuff about how the engine is structured. I'm not an expert, but I start to understand what I'm using, which is a good thing.

The last step is that you need to add platformThread.h from the TGE 1.5.2 distribution to the source. That takes care of the last error in the compiling using GCC 4.2.1 on OpenSuSE 10.3 in my case.

I do know that that only takes care of the runtime engine, and not the specific editors and stuff. But that's a first step. When TGB games can be distributed for Linux. Following step is to get the content generating onto the Linux platform, but that's still a way of I'm afraid.

@Spider : I'm sad to read that. Any reasons you would like to share why you gave up? That implies some expectations that weren't fulfilled. I'm interested to know about yours. One never knows.

Cheers,

The TGB secion on my blog
#12
02/02/2008 (3:45 pm)
Ahh pygame is very nice you should check out python-ogre . I believe someone from pygame is trying to combine the two. Very fun to play with.

I still think that TGB is great. But when you play with the latest version. Hard to go back to the linux version. I got as far as having the GCC compile to were it should kick out a DEBUG.bin then it just shoots out a TON of errors that are way above programming ability.
#13
02/03/2008 (2:27 pm)
Hmm. I agree that there is some work to be done to get TGB on Linux in a almost-playable state. I've tried and I need to find a libGLU for SuSE, and also a way that is portable to fix the last hurdle. Then I'll have a DEBUG.bin (I hope)

I'll keep you updated here.

Cheers,
David

The TGB section on my blog
#14
02/08/2008 (5:36 am)
A quick update : I have been looking at alternatives for the vanilla Glut libraries, and have come up with freeglut and openglut. Both have seen their last update a few years ago, so I'm not really comfortable using them. However, OpenSuSE distributes freeglut at the moment, so it shouldn't be that bad. I'll have a look this weekend (tonight) if I get this to compile.

It might be cool if GarageGames would add the missing files mentioned in this thread to the standard source distribution. At the current state, you need to own TGE as well just to be able to compile something, which is not cool.

Cheers,
David

The TGB section on my blog
#15
04/14/2008 (6:05 pm)
Thanks David Janssens and Jon Jones. I also did all what you have done.
and compile is ok. link error occur. i'll try more to get a bin.

good luck,
Eros
#16
04/15/2008 (1:58 am)
@Szzy,
I sadly didn't find a way of getting TGB to compile without resorting to a new compilation of the Glut libraries. Time constraints (AKA 'Real Life (tm)') has come in the way, but I'm determined to get this to work someday in the near future.

Next step : TGB 1.7.x
#17
08/18/2008 (12:46 pm)
Did anyone have any success with TGB 1.7.x? I'm trying to convert people here, and a lack of Linux support is a hindrance.
#18
07/14/2009 (2:12 am)
The TGB discussion is also here.