Game Development Community

Linux Collaboration

by Ben Garney · in Torque Game Engine · 11/24/2005 (1:18 am) · 490 replies

Hey guys,

Based on the discussion happening at Jeff's .plan, I'm starting a thread here in the private forums so that Linux Torque developers who are interested in seeing stronger Linux support can get more involved in the development process.

This is also a chance to help get more Torque projects onto Linux. There's a bit of a shortage of reliable Linux-enabled developers that are willing to do builds, help port, etc.

So if you want to see across-the-board Linux support happen, you're a good dev, and you're willing to donate a little time to the cause, consider volunteering. :)

(And don't think this is a thankless job, either - of the four Linux guys I've worked with, one now works at GG doing XBox 360 development, one does builds for many games, one is able to make money doing contract work, and another is working on a kick ass RTS with a now-GG-employee... This is a great opportunity to get more involved in professional game dev, get some nice perks, or just earn the respect & adulation of your peers.)

Having a list of people who are interested in this sort of thing will be a big boost to anyone trying to get their product on Linux, including things like GG getting future Torque releases out. :) Instead of scouring the web, people can just check here. Fast, quick, easy.

Thanks for taking the time to get involved!
Ben
#361
01/21/2006 (1:17 pm)
What about freetype, am I the only one who has had this error, I have reinstalled a few times, 5.10 ubuntu, but still needing to compile freetype to get it to even kickoff past the beginning, can easily get it, then I need the other libs before it will compile to the end, then it seg faults when I run the game.

I tried linking a few of the required libs like it says earlier in the forum, but no luck, says "The file is already there"
#362
01/21/2006 (1:23 pm)
@Tristan: Can you put an "ldd $EXENAME" command in runtorque.sh right before it runs the executable so we can see which libraries are being loaded? Do you have /usr/lib/libtheora.a on your system? Does "./runtorque.sh -game starter.fps" or "./runtorque.sh -game starter.racing" segfault? Also, we're still having problems with the build - it can be using a mismatched set of libraries and/or headers unless everything is set correctly, so bear with us.

@Ron: Here's the culprit:

[ed@toaster torque]$ egrep include lib/xiph/include/ogg/os_types.h
#    include <_G_config.h>
#  include <sys/types.h>
#  include <sys/types.h>
#  include <inttypes.h>
#  include <sys/types.h>
[b]#  include <ogg/config_types.h>[/b]
#363
01/21/2006 (1:33 pm)
@Eddie: /usr/lib/libtheora.a, no, I have libtheora.so.0.
#364
01/21/2006 (2:33 pm)
Have a look at config_types.h, it is os specific. that is if you build ogg it will gen a new config_types.h for yah. I went down this long winding road a month or so ago and had the same mindset you currently have...


my copy of config_types.h would not work on Mandriva/fedora etc...

-Ron
#365
01/21/2006 (2:35 pm)
IIRC freetype-config is installed with Xft....

-Ron
#366
01/21/2006 (2:42 pm)
@Tristan: Is /usr/lib/libtheora.so.0 being used instead of lib/xiph/linux/libtheora.so.0? What does ldd report...?

@Ron: It doesn't really seem distribution/OS/architecture dependent - I would expect that these types are defined on many/all flavors of LINUX/UNIX with gcc...

[ed@toaster ed]$ cat /usr/include/ogg_renamed/config_types.h
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__

/* these are filled in by configure */
typedef int16_t ogg_int16_t;
typedef u_int16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef u_int32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;

#endif
#367
01/21/2006 (3:19 pm)
@Ron: Those types are mapped in /usr/include/sys/types.h on Linux, and other OSes (I checked on Solaris) have the same typedefs defined (in various places)... so I don't think there's any problem with including the "config_types.h" in the TGE Linux distribution unless someone can verify that int64_t and friends aren't defined on particular distributions (and I'd be very suprised if that were the case).
#368
01/22/2006 (8:16 am)
Well,

we could include the config_types.h, but (could be sadly mistaken) we would need to modify a few other .h files to properly include os_types.h which needs to point to the proper location of config_types.h

right now ogg.h looks to the system (/usr/include) for ogg/os_types.h (#include ). I am not sure what the legalities are surrounding such changes as well as packaging for distribution. I know we have basterized other header files in the past.

I have a working local copy with the header changes mentioned above and all seems to work, granted I am still unable init openal (freaking arts is a POS)


-Ron
#369
01/22/2006 (9:57 am)
@Ron: I think you're a bit confused about how gcc looks for header files. ;-) From the gcc man page:

-I dir
           Add the directory dir to the list of directories to be searched for
           header files.  Directories named by -I are searched before the
           standard system include directories.  If the directory dir is a
           standard system include directory, the option is ignored to ensure
           that the default search order for system directories and the spe-
           cial treatment of system headers are not defeated .

The only (additional) affect that #include "blah.h" (with quotes instead of ) has on this is that the current working directory is searched first for the include file, followed by the -I directories, followed by the gcc-configured directories (/usr/lib/gcc-blah/blah/blah/...) and the system directories (/usr/include). #include means "don't look in the current directory for this include file".

You can verify this by inserting some garbage like #this is the wrong ogg.h header ahead of the first line of /usr/include/ogg/ogg.h (and similar lines in the other /usr/include/ogg header files), and putting a copy of config_types.h in lib/xiph/include/ogg. gcc will then use the lib/xiph/include/ogg copies in preference to the /usr/include/ogg version - assuming that config_types is there (otherwise it will use /usr/include/ogg/config_types.h since that's the only copy of the file).

EDIT:
#370
01/22/2006 (10:01 am)
Yah I read the man page numerous times..

when I removed libogg-dev compilation failed trying to find /usr/include/ogg/config_types.h, could have been something else *shrug* but after changing the header files to use "" vice <> (yah tell me its strange) all compiled

-Ron
#371
01/22/2006 (10:17 am)
Think my medication is talking to me again... I know what the problem is (I think)
I removed libogg-dev etc.. and tried to re-compile the binary without a make clean.. so I think the old obj files were looking for the header in /usr/include/ogg

so I should be arrested for CWD (Coding While Drugged)

-Ron
#372
01/22/2006 (11:21 am)
LOL! Well, that's not technically a crime AFAIK, so you're okay if the cops come... :-)

Okay, so we can include the proper header files that match the included libraries and we should be good to go. We just need to double-check everything and make sure it includes the correct headers (in lib/xiph/include) and links against the correct libraries (compile-time and run-time - with the lib/xiph/linux versions).

And we need to collect a list of all the require runtime/devel packages that are expected to be present (like freetype).

We're gettin' pretty close, don't you think?
#373
01/23/2006 (12:31 pm)
@EddieRay,

fedora core 3 now has audio working in starter.fps after i setup yum and got smpeg***.rpm from the web.
So definately one thing required is libsmpeg*so

Demo is still seg faulting on start.
The console.log shows ( I get an error when running starter.fps because it can't find a font but it still continues) :

...
Loading OpenAL from system (dlopen) path
Setting OpenAL output frequency to 22050
Vendor: J. Valenzuela
Version: 0.0.7
Renderer: Software
Extensions: AL_EXT_capture AL_EXT_vorbis AL_EXT_MP3 AL_LOKI_quadriphonic AL_LOKI_play_position AL_LOKI_WAVE_format AL_LOKI_IMA_ADPCM_format AL_LOKI_buffer_data_callback ALC_LOKI_audio_channel

Loading compiled script demo/client/scripts/audioProfiles.cs.
Loading compiled script demo/client/ui/defaultGameProfiles.cs.
Loading compiled script demo/client/ui/PlayGui.gui.
Loading compiled script demo/client/ui/FpsGui.gui.
Loading compiled script demo/client/ui/RacingGui.gui.
Loading compiled script demo/client/ui/SceneGui.gui.
Missing file: demo/client/ui/PageGui.gui!
Loading compiled script demo/client/ui/ChatHud.gui.
Loading compiled script demo/client/ui/playerList.gui.
Loading compiled script demo/client/ui/overlayDlg.gui.
Error: Could not load font -Arial Bold-

^SEG FAULT - Nothing after that
#374
01/23/2006 (12:37 pm)
@Charles: Can you build a DEBUG version, and then run it under "gdb" and give us the "where" output after it crashes? If the DEBUG version doesn't crash, you can do a "make clean" and change CFLAGS.RELEASE to "-g" in mk/conf.UNIX.mk, then do a "make" to get a RELEASE version that still has symbols in it.
#375
01/23/2006 (12:41 pm)
@Charles: Also, we probably need to verify the "ldd" output (via the hack to runtorque.sh) so we can make sure we know which libs are linking in at run-time. Have you checked which libs are getting used at compile-time (i.e. via the updated -L switch, tricky renaming of any /usr/lib/libogg.so.x.y.z stuff to keep them from getting used, etc.)?
#376
01/23/2006 (12:52 pm)
Did another round of testing yesterday evening

OS = Ubuntu 5.10
Ogg/vorbis/theora - NOT INSTALLED
BUILD = Release and Debug

ld reported using ../lib/xiph/linux for ogg/vorbis and theora (there is a compile time setting you can set to display what headers are being used and another to list the libs being used)

ldd reported (via runtorque.sh hack) using ../lib/xiph/linux for ogg/vorbis and theora

Need to find a OS that has the font issue, the ubunut installs I have done appear to have the ms fonts.

I did have to install libXft and freetype (which gives access to font-config), maybe freetype installed the msfontts? will look this evening


-Ron
#377
01/24/2006 (5:25 am)
All,

Here is what I have come up with

1) add LN= ln -sf (force symbolic link) to conf.UNIX.mk
2) add a LN for each of the files in lib/xiph/linux (see that we have a .so and a .so.0 for ogg/vorbis and theora)

I'll work out the mk/* mess this evening and more than likely will put the LN usage in targets.torque.mk


-Ron
#378
01/24/2006 (3:42 pm)
@EddieRay & Ron

fedora core 3 demo works now.

Fedora doesn't like the font picking code in gNewFont.cc - GFont::create(), so if I force courier it works.
helvetica isn't on a "only from dvd download iso" fedora core 3.

char* fontName = "courier";
/*** //fake fix to get it to work...
char* fontName = "helvetica";
// Couldn't load the requested font. This probably will be common
// since many unix boxes don't have arial or lucida console installed.
// Attempt to map the font name into a font we're pretty sure exist
if (dStrcmp(dStrlwr(const_cast(faceName)), "arial") != 0)
fontName = "helvetica";
else if (dStrcmp(dStrlwr(const_cast(faceName)), "lucida console") != 0)
fontName = "courier";
^^^ end fix to get it to work... */

return create(fontName, size, cacheDirectory, charset);
}



##################################################
gdb backtrace:
(gdb) file /ccb2/copy2/t140-2006-0119/torque/example/torqueDemo.bin
(no debugging symbols found)...Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) file /ccb2/copy2/t140-2006-0119/torque/example/torqueDemo_DEBUG.bin
(gdb) run
[Thread debugging using libthread_db enabled]
[New Thread -151226688 (LWP 13193)]
[New Thread -159622224 (LWP 13196)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -151226688 (LWP 13193)]
0x08369d13 in __strtolwr (str=0x83caa41 "helvetica") at platformX86UNIX/x86UNIXStrings.cc:38
/home/ccb/t140-2006-0119/torque/engine/platformX86UNIX/x86UNIXStrings.cc:38:805:beg:0x8369d13
(gdb) bt
#0 0x08369d13 in __strtolwr (str=0x83caa41 "helvetica") at platformX86UNIX/x86UNIXStrings.cc:38
#1 0x0836a0db in dStrlwr (str=0x83caa41 "helvetica") at platformX86UNIX/x86UNIXStrings.cc:222
#2 0x080cbacc in GFont::create (faceName=0x83caa41 "helvetica", size=32, cacheDirectory=0xf6c3a418 "common/ui/cache", charset=0) at dgl/gNewFont.cc:351
#3 0x080cbb3f in GFont::create (faceName=0xf6c1f2cc "arial bold", size=32, cacheDirectory=0xf6c3a418 "common/ui/cache", charset=0) at dgl/gNewFont.cc:356
#4 0x08154b80 in GuiControlProfile::incRefCount (this=0xf6c38e08) at gui/core/guiTypes.cc:315
#5 0x08154e92 in ConsoleTypeTypeGuiProfile::setData (this=0x84f9e00, dptr=0xf6de6318, argc=1, argv=0xfeffc8bc, tbl=0x0) at gui/core/guiTypes.cc:361
#6 0x08088ae7 in Con::setData (type=21, dptr=0xf6de6318, index=0, argc=1, argv=0xfeffc8bc, tbl=0x0, flag={mbits = 0}) at console/console.cc:1034
#7 0x0809bb0a in SimObject::setDataField (this=0xf6de62c8, slotName=0xf6b5d524 "Profile", array=0x84dffc0 "", value=0xf683a348 "GuiTitleProfile") at console/simBase.cc:711
#8 0x08083cf9 in CodeBlock::exec (this=0xf6dd9108, ip=1027, functionName=0xf6d0ba38 "demo/client/ui/overlayDlg.gui", thisNamespace=0x0, argc=0, argv=0x0, noCalls=false, packageName=0x0, setFrame=0) at console/compiledEval.cc:823
#9 0x0808c45f in cexec (argc=2, argv=0x84ddb48) at console/consoleFunctions.cc:1027
#10 0x08084808 in CodeBlock::exec (this=0xf68381c8, ip=217, functionName=0xf6c06c44 "initClient", thisNamespace=0xf6b5fea4, argc=0, argv=0x84ddb48, noCalls=false, packageName=0x0, setFrame=-1) at console/compiledEval.cc:1066
#11 0x0808440f in CodeBlock::exec (this=0xf6bfabe8, ip=429, functionName=0xf6b985e0 "onStart", thisNamespace=0xf6b60138, argc=0, argv=0x84ddb48, noCalls=false, packageName=0xf6c06510 "demo", setFrame=-1) at console/compiledEval.cc:991
#12 0x0808440f in CodeBlock::exec (this=0xf6838178, ip=21, functionName=0xf6b985e0 "onStart", thisNamespace=0xf682e268, argc=0, argv=0x84ddb48, noCalls=false, packageName=0xf6c06214 "creator", setFrame=-1) at console/compiledEval.cc:991
#13 0x0808440f in CodeBlock::exec (this=0xf6bf4e18, ip=1407, functionName=0xf6b98498 "main.cs", thisNamespace=0x0, argc=0, argv=0x0, noCalls=false, packageName=0x0, setFrame=-1) at console/compiledEval.cc:991
#14 0x08082317 in CodeBlock::compileExec (this=0xf6bf4e18, fileName=0xf6b98498 "main.cs", string=0xf6bf2ee8 "//", '-' , "\n// Torque Game Engine \n// Copyright (C) GarageGames.com, Inc.\n//", '-' ..., noCalls=false, setFrame=-1) at console/codeBlock.cc:544
#15 0x0808845a in Con::evaluate (string=0xf6bf2ee8 "//", '-' , "\n// Torque Game Engine \n// Copyright (C) GarageGames.com, Inc.\n//", '-' ..., echo=false, fileName=0xf6b98498 "main.cs") at console/console.cc:866
#16 0x081aaded in runEntryScript (argc=1, argv=0xf6847498) at game/main.cc:256
#17 0x081ab318 in initGame (argc=1, argv=0xf6847498) at game/main.cc:340
#18 0x081ab511 in DemoGame::main (this=0x8500060, argc=1, argv=0xf6847498) at game/main.cc:419
#19 0x0836cd91 in main (argc=1, argv=0xfefff834) at platformX86UNIX/x86UNIXWindow.cc:886

##################################################
sh runt*sh debug
libogg.so.0 => ../lib/xiph/linux/libogg.so.0 (0xf6ffb000)
libvorbis.so.0 => ../lib/xiph/linux/libvorbis.so.0 (0xf6fd3000)
libtheora.so.0 => ../lib/xiph/linux/libtheora.so.0 (0xf6fb7000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x0596a000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00d85000)
libdl.so.2 => /lib/libdl.so.2 (0x00d5d000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x0025b000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x04268000)
libm.so.6 => /lib/tls/libm.so.6 (0x00d38000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00302000)
libc.so.6 => /lib/tls/libc.so.6 (0x00c0f000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00101000)
libasound.so.2 => /lib/libasound.so.2 (0x05047000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x00d75000)
/lib/ld-linux.so.2 (0x003db000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x00dde000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00233000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00dbd000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x001ca000)
libz.so.1 => /usr/lib/libz.so.1 (0x00d63000)
Segmentation fault
#379
01/24/2006 (5:00 pm)
Charles,

interesting how courier is but not helvetica ;) they are both MS fonts (last I checked)
I'll have to make another pass through that code shortly, Gregorey mentioned the usage of a base linux font
that all linux versions with xwindows has to have ...

All,

working the linking issue with the ogg/vorbis and theora files I have created the following script (to live in the xiph/linux dir and called from targets.torque.mk)

#! /bin/bash

FILES="libogg.so
libvorbis.so
libtheora.so"

DIR='dirname [[4fc3827d01acb]]'
for file in $FILES
do
  # Check if library file and its shared counter part exists.
  if [ -e ${DIR}/${file} -a ! -e ${DIR}/${file}.0 ]
  then
    echo "creating shard library from ${DIR}/${file}->${DIR}/${file}.0";
        ln -sf ${file} ${file}.0
    continue                # On to next.
   fi

done

exit 0

works fine on my system with dedicated, tools, engine and normal game builds (in debug and release)

let me know what you think


-Ron
#380
02/03/2006 (6:59 am)
Folks,

Sorry for not keeping the community up to snuff with 1.4 goings on. I have been working with a couple of community members to resolve the library and font issues. Also spoke with Matt Fairfax to run my proposal by him before I embarked on pushing items to SVN and getting a CVS sync.

So, what has been going on?

1) Shortly before (maybe a tad after) Gregory sent me a new x86UNIXFont.cc, I was reluctant to use the new file. Wanted to stay with the stock LoadFont method, but after much fighting, kicking and swearing I gave in and went with it. Made a minor modification to load a default font (which is installed with X11) "6x10" incase we are unable to find any of the fonts asked for.

2) lib/xiph/linux now includes the required ogg/vorbis and theora libraries with a checkLinks.sh (bash script) that is ran after compilation but before linking to ensure the ogg/vorbis and theora libs have an associated .so.0 file.

The above new features are what I have been working on sense my last post with a couple (well 4 ;) ) community members.

What's next? before I ask for the CVS sync I want some help getting a TDN doc up that gives a linux novice step by step instructions to install msttfcorefonts (Microsoft TTF Core Fonts) on the popular linux distros (that is distros that use DEB, RPM, EMERGE etc..). So, if you know of a decent step by step guide for your distro, or have done it before and cane write up a guide please do so.

Again, thanks for all of the help and support you have provided to get TGE 1.4 were it is now! Without the communities support this endeavor would have taken much longer. Keep up the support so we can keep linux TGE!!

-Ron