Compiling in LINUX -- with Fedora 64bit
by Jeff Yaskus · in RTS Starter Kit · 03/28/2010 (4:49 pm) · 6 replies
Please tell me I am wrong, but it appears the TGE "linux" code is only compatible with INTEL and not AMD CPUs.
This is a new build environment (Fedora 12, patched) ... and I have resolved all the dependencies (?)
The make kicks off and fails right away due to i686 CPU specified in make file, so I tried manually removing it;
and then try to recompile
and types.gcc.h shows where it kicks out if not intel ...
NOTE: I am using the MAC 1.5.2 release (since the Linux build is still version1) and patched it as per;
http://www.torquepowered.com/community/forums/viewthread/76645
This is a new build environment (Fedora 12, patched) ... and I have resolved all the dependencies (?)
The make kicks off and fails right away due to i686 CPU specified in make file, so I tried manually removing it;
[root@localhost RTS Starter Kit 1.5.2 SDK]# make --> Compiling lpng/png.c `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. lpng/png.c:1: error: CPU you selected does not support x86-64 instruction set make[1]: *** [out.GCC4.DEBUG/lpng/png.obj] Error 1 make: *** [default] Error 2 [root@localhost RTS Starter Kit 1.5.2 SDK]# cd mk [root@localhost mk]# grep mcpu * conf.GCC2.FreeBSD.mk: -mcpu=i686 -ffast-math -fno-exceptions #-fno-check-new conf.UNIX.mk: `freetype-config --cflags` -mcpu=i686 -ffast-math -pipe
and then try to recompile
[root@localhost RTS Starter Kit 1.5.2 SDK]# make -f mk/configure.mk OS=LINUX COMPILER=GCC4 BUILD=DEBUG
Current Configuration: this config is VALID
OS: LINUX
COMPILER: GCC4
BUILD: DEBUG
DIR.OBJ: out
To change the current configuration type:
make -f mk/configure.mk {arguments, ...}
required arguments:
OS={WIN32 BEOS LINUX OpenBSD FreeBSD Solaris}
COMPILER={CW6 VC6 GCC2 GCC3 GCC3.4 GCC4}
BUILD={DEBUG RELEASE}
optional arguments:
DIR.OBJ={path to store intermediate obj files}
Note: all arguments are case sensitive.
[root@localhost RTS Starter Kit 1.5.2 SDK]# make
--> Compiling lpng/png.c
...
Creating library out.GCC4.DEBUG/lungif_DEBUG.a
--> Compiling audio/audio.cc
In file included from ./platform/types.h:70,
from ./platform/platform.h:14,
from ./platform/platformAudio.h:10,
from ./audio/audio.h:10,
from audio/audio.cc:6:
./platform/types.gcc.h:92:4: error: #error "GCC: Unsupported Target CPU"
In file included from ./platform/platformAudio.h:10,
from ./audio/audio.h:10,
from audio/audio.cc:6:
./platform/platform.h:204:2: error: #error "Endian define not set"
In file included from ./platform/platformAudio.h:10,
from ./audio/audio.h:10,
from audio/audio.cc:6:
./platform/platform.h:556: error: ‘operator new’ takes type ‘size_t’ (‘long unsigned int’) as first parameter
./platform/platform.h:577: error: ‘operator new’ takes type ‘size_t’ (‘long unsigned int’) as first parameter
./platform/platform.h:578: error: ‘operator new’ takes type ‘size_t’ (‘long unsigned int’) as first parameter
In file included from ./platform/platformAL.h:25,
from ./platform/platformAudio.h:16,
from ./audio/audio.h:10,
from audio/audio.cc:6:
../lib/openal/LINUX/al/al_func.h:18: error: ‘<anonymous>’ has incomplete type
../lib/openal/LINUX/al/al_func.h:18: error: invalid use of ‘ALvoid’
In file included from ./platform/platformAL.h:26,
from ./platform/platformAudio.h:16,
from ./audio/audio.h:10,
from audio/audio.cc:6:
../lib/openal/LINUX/al/alc_func.h:11: error: ‘<anonymous>’ has incomplete type
../lib/openal/LINUX/al/alc_func.h:11: error: invalid use of ‘ALCvoid’
In file included from ./core/fileStream.h:13,
from ./core/resManager.h:20,
from ./audio/audioBuffer.h:16,
from ./audio/audioDataBlock.h:13,
from ./audio/audio.h:13,
from audio/audio.cc:6:
./core/stream.h: In member function ‘bool Stream::write(S16)’:
./core/stream.h:147: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::write(S32)’:
./core/stream.h:148: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::write(U16)’:
./core/stream.h:149: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::write(U32)’:
./core/stream.h:150: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::write(F32)’:
./core/stream.h:151: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::write(F64)’:
./core/stream.h:152: error: ‘convertHostToLEndian’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(S16*)’:
./core/stream.h:157: error: ‘convertLEndianToHost’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(S32*)’:
./core/stream.h:158: error: ‘convertLEndianToHost’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(U16*)’:
./core/stream.h:159: error: ‘convertLEndianToHost’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(U32*)’:
./core/stream.h:160: error: ‘convertLEndianToHost’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(F32*)’:
./core/stream.h:161: error: ‘convertLEndianToHost’ was not declared in this scope
./core/stream.h: In member function ‘bool Stream::read(F64*)’:
./core/stream.h:162: error: ‘convertLEndianToHost’ was not declared in this scope
In file included from ./sim/sceneObject.h:31,
from ./game/gameBase.h:10,
from ./game/shapeBase.h:10,
from ./game/gameConnection.h:13,
from audio/audio.cc:11:
./lightingSystem/sgLightManager.h: In static member function ‘static hash_multimap<unsigned int, sgInteriorDynamicLightingCache::data>* sgInteriorDynamicLightingCache::sgFindCacheEntry(void*, void*, LightInfo*)’:
./lightingSystem/sgLightManager.h:334: error: cast from ‘void*’ to ‘U32’ loses precision
./lightingSystem/sgLightManager.h:336: error: cast from ‘LightInfo*’ to ‘U32’ loses precision
./lightingSystem/sgLightManager.h: In static member function ‘static hash_multimap<unsigned int, sgDTSDynamicLightingCache::data>* sgDTSDynamicLightingCache::sgFindCacheEntry(void*, LightInfo*)’:
./lightingSystem/sgLightManager.h:374: error: cast from ‘void*’ to ‘U32’ loses precision
./lightingSystem/sgLightManager.h:376: error: cast from ‘LightInfo*’ to ‘U32’ loses precision
In file included from ./game/shapeBase.h:35,
from ./game/gameConnection.h:13,
from audio/audio.cc:11:
./lightingSystem/sgObjectShadows.h: In member function ‘U32 sgObjectShadows::sgLightToHash(LightInfo*)’:
./lightingSystem/sgObjectShadows.h:49: error: cast from ‘LightInfo*’ to ‘U32’ loses precision
audio/audio.cc: In function ‘bool cullSource(U32*, F32)’:
audio/audio.cc:252: error: too few arguments to function
audio/audio.cc: In function ‘AUDIOHANDLE alxCreateSource(const Audio::Description*, const char*, const MatrixF*, AudioSampleEnvironment*)’:
audio/audio.cc:731: error: too few arguments to function
audio/audio.cc: In function ‘void alxLoopingUpdate()’:
audio/audio.cc:1732: error: too few arguments to function
audio/audio.cc: In function ‘void alxStreamingUpdate()’:
audio/audio.cc:1833: error: too few arguments to function
audio/audio.cc: In function ‘bool Audio::OpenALInit()’:
audio/audio.cc:2414: error: too few arguments to function
audio/audio.cc:2419: error: too few arguments to function
audio/audio.cc:2441: error: too few arguments to function
make[1]: *** [out.GCC4.DEBUG/audio/audio.obj] Error 1
make: *** [default] Error 2and types.gcc.h shows where it kicks out if not intel ...
// Identify the CPU #if defined(i386) # define TORQUE_CPU_STRING "Intel x86" # define TORQUE_CPU_X86 # define TORQUE_LITTLE_ENDIAN #elif defined(__ppc__) # define TORQUE_CPU_STRING "PowerPC" # define TORQUE_CPU_PPC # define TORQUE_BIG_ENDIAN #else # error "GCC: Unsupported Target CPU" #endif
NOTE: I am using the MAC 1.5.2 release (since the Linux build is still version1) and patched it as per;
http://www.torquepowered.com/community/forums/viewthread/76645
About the author
Long time gamer, hacker and programmer. With dreams of making video games -
#2
then install the x86_64 and i686 packages (both) ...
got this far (so far):
[root@localhost RTS_152_MAC]# make
--> Compiling platformX86UNIX/x86UNIXGL.cc
--> Compiling platformX86UNIX/x86UNIXInput.cc
In file included from platformX86UNIX/x86UNIXInput.cc:15:
./platformX86UNIX/x86UNIXInputManager.h:33: warning: ‘typedef’ was ignored in this declaration
--> Compiling platformX86UNIX/x86UNIXInputManager.cc
In file included from platformX86UNIX/x86UNIXInputManager.cc:13:
./platformX86UNIX/x86UNIXInputManager.h:33: warning: ‘typedef’ was ignored in this declaration
--> Compiling platformX86UNIX/x86UNIXIO.cc
--> Compiling platformX86UNIX/x86UNIXMath.cc
--> Compiling platformX86UNIX/x86UNIXMath_ASM.cc
--> Compiling platformX86UNIX/x86UNIXMemory.cc
--> Compiling platformX86UNIX/x86UNIXMessageBox.cc
--> Compiling platformX86UNIX/x86UNIXMutex.cc
--> Compiling platformX86UNIX/x86UNIXNet.cc
--> Compiling platformX86UNIX/x86UNIXOGLVideo.cc
--> Compiling platformX86UNIX/x86UNIXOpenAL.cc
platformX86UNIX/x86UNIXOpenAL.cc:46: warning: deprecated conversion from string constant to ‘char*’
--> Compiling platformX86UNIX/x86UNIXProcessControl.cc
--> Compiling platformX86UNIX/x86UNIXRedbook.cc
--> Compiling platformX86UNIX/x86UNIXSemaphore.cc
--> Compiling platformX86UNIX/x86UNIXStrings.cc
platformX86UNIX x86UNIXStrings.cc: In function ‘char* dStrstr(const char*, const char*)’:
platformX86UNIX x86UNIXStrings.cc:279: error: invalid conversion from ‘const char*’ to ‘char*’
make[1]: *** out.GCC4.DEBUG/platformX86UNIX/x86UNIXStrings.obj Error 1
make: *** default Error 2
Here is the offender ... hmm
03/29/2010 (8:33 pm)
more missing 32 bit libraries ... here is a good trick to use:# yum whatprovides *X11/Xft/Xft.h
then install the x86_64 and i686 packages (both) ...
got this far (so far):
[root@localhost RTS_152_MAC]# make
--> Compiling platformX86UNIX/x86UNIXGL.cc
--> Compiling platformX86UNIX/x86UNIXInput.cc
In file included from platformX86UNIX/x86UNIXInput.cc:15:
./platformX86UNIX/x86UNIXInputManager.h:33: warning: ‘typedef’ was ignored in this declaration
--> Compiling platformX86UNIX/x86UNIXInputManager.cc
In file included from platformX86UNIX/x86UNIXInputManager.cc:13:
./platformX86UNIX/x86UNIXInputManager.h:33: warning: ‘typedef’ was ignored in this declaration
--> Compiling platformX86UNIX/x86UNIXIO.cc
--> Compiling platformX86UNIX/x86UNIXMath.cc
--> Compiling platformX86UNIX/x86UNIXMath_ASM.cc
--> Compiling platformX86UNIX/x86UNIXMemory.cc
--> Compiling platformX86UNIX/x86UNIXMessageBox.cc
--> Compiling platformX86UNIX/x86UNIXMutex.cc
--> Compiling platformX86UNIX/x86UNIXNet.cc
--> Compiling platformX86UNIX/x86UNIXOGLVideo.cc
--> Compiling platformX86UNIX/x86UNIXOpenAL.cc
platformX86UNIX/x86UNIXOpenAL.cc:46: warning: deprecated conversion from string constant to ‘char*’
--> Compiling platformX86UNIX/x86UNIXProcessControl.cc
--> Compiling platformX86UNIX/x86UNIXRedbook.cc
--> Compiling platformX86UNIX/x86UNIXSemaphore.cc
--> Compiling platformX86UNIX/x86UNIXStrings.cc
platformX86UNIX x86UNIXStrings.cc: In function ‘char* dStrstr(const char*, const char*)’:
platformX86UNIX x86UNIXStrings.cc:279: error: invalid conversion from ‘const char*’ to ‘char*’
make[1]: *** out.GCC4.DEBUG/platformX86UNIX/x86UNIXStrings.obj Error 1
make: *** default Error 2
Here is the offender ... hmm
char* dStrstr(const char *str1, const char *str2)
{
return strstr(str1,str2);
}
#3
here is a work around, line ~280
... further progress, now searching for more missing libraries;
[root@localhost RTS_152_MAC]# make
--> Compiling platformX86UNIX/x86UNIXStrings.cc
--> Linking out.GCC4.DEBUG/torqueDemo_DEBUG.bin
/usr/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
make[1]: *** [out.GCC4.DEBUG/torqueDemo_DEBUG.bin] Error 1
make: *** [default] Error 2
[root@localhost RTS_152_MAC]# yum whatprovides *GLU
03/29/2010 (9:47 pm)
It appears its an issue with the multiple version of strstr and gcc4+here is a work around, line ~280
return const_cast<char *>( strstr( str1 , str2 ) );
... further progress, now searching for more missing libraries;
[root@localhost RTS_152_MAC]# make
--> Compiling platformX86UNIX/x86UNIXStrings.cc
--> Linking out.GCC4.DEBUG/torqueDemo_DEBUG.bin
/usr/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
make[1]: *** [out.GCC4.DEBUG/torqueDemo_DEBUG.bin] Error 1
make: *** [default] Error 2
[root@localhost RTS_152_MAC]# yum whatprovides *GLU
#4
replace;
-Wl,-static -Wl,-lGLU -Wl,-dy
with
-lGLU
...
added the location of libvorbis.so.0 to path ...
export LD_LIBRARY_PATH="/usr/lib64:/home/jyaskus/Source/RTS_152_LINUX/lib/xiph/linux/:$LD_LIBRARY_PATH"
and then was able to start and run the game
... but it says I need to download and instal OpenAL drivers, because it failed to initialize.
tried this "fix" but made no difference;
http://www.torquepowered.com/community/forums/viewthread/110733
03/29/2010 (11:05 pm)
Changed linking of GLU from STATIC to dynamic in conf.UNIX.mk:replace;
-Wl,-static -Wl,-lGLU -Wl,-dy
with
-lGLU
...
added the location of libvorbis.so.0 to path ...
export LD_LIBRARY_PATH="/usr/lib64:/home/jyaskus/Source/RTS_152_LINUX/lib/xiph/linux/:$LD_LIBRARY_PATH"
and then was able to start and run the game
... but it says I need to download and instal OpenAL drivers, because it failed to initialize.
tried this "fix" but made no difference;
http://www.torquepowered.com/community/forums/viewthread/110733
#5
But oddly enough, when I copy over my windows code base ... and install it, it seems OK. But when I run it, its showing me the mainMenuGui.gui from the "stock" game ... but with my modified .BMP images in the background.
very very odd ... think I'll need to sleep on this one.
EDIT:
this helped;
03/30/2010 (9:15 pm)
ODD and Confusing ... the stock RTS kit compiles and runs OK ... just (1) issue noticed so far ; the "ALT" + mouse wheel is not working.But oddly enough, when I copy over my windows code base ... and install it, it seems OK. But when I run it, its showing me the mainMenuGui.gui from the "stock" game ... but with my modified .BMP images in the background.
very very odd ... think I'll need to sleep on this one.
EDIT:
this helped;
for file in `find . -name "*.cs" -print`; do dos2unix $file done
#6
1) make sure to use the "dos2unix" command on ALL the scripts, mission files and gui files (*.cs, *.mis, *.gui). You can also do it for the C source (*.cc,*.h) but the compiler ignores them anyhow, so not required.
2) for simplicity -- if you are building a "dev" environment -- just stick with a 32bit OS install like Unbuntu ... saves all the trouble of install both x64 and 32 bit versions of everything.
3) use UNBUNTU ... all I had to do was use the GUI to install the necessary stuff (openal, sdl, nvidia drivers,etc.) ... piece of cake.
4) make a script to set the LIBRARY variable prior to running the binary ...
good luck!
04/02/2010 (11:52 pm)
OK - for the next person who attempts this, here are some suggestions.1) make sure to use the "dos2unix" command on ALL the scripts, mission files and gui files (*.cs, *.mis, *.gui). You can also do it for the C source (*.cc,*.h) but the compiler ignores them anyhow, so not required.
2) for simplicity -- if you are building a "dev" environment -- just stick with a 32bit OS install like Unbuntu ... saves all the trouble of install both x64 and 32 bit versions of everything.
3) use UNBUNTU ... all I had to do was use the GUI to install the necessary stuff (openal, sdl, nvidia drivers,etc.) ... piece of cake.
4) make a script to set the LIBRARY variable prior to running the binary ...
good luck!
Torque Owner Jeff Yaskus
jy games
a) remove the i686 from the UNIX mk conf file and add -m32 (compile in32 bits)
b) add the 32 bit libraries for Fedora ... (google)
c) then capitalized rts to RTS on files under game/RTS/*
Now its compiling ... but more errors to come.