How to Compile on Linux
by Rodney Rindels - Torqued · in Torque Game Builder · 10/13/2006 (7:38 am) · 25 replies
While its been said in other places, this being the new linux forum. I wanted to start throwing down some topics that are going to be frequently asked going forwards for new users.
First you need to get a copy of the Linux download or Windows download, get them onto your linux box as effectively as you can. While not a big fan of SAMBA, it works really well for this process.
Here you need to make a decision about which compilers, which targets, and such.
If you run make you'll get some instructions if things are not already set
run make -f configure.mk
Get more instructions
Here you'll need to decide a few things about your system.
1. Which OS you'll be using "WIN32 BEOS LINUX OpenBSD FreeBSD Solaris"
For my system I have LINUX
2. Which Compiler your using. "CW6 VC6 GCC2 GCC3 GCC3.4 GCC4"
For my systems I have both GCC3 and GCC4 But Im testing GCC3 right now so I'm going to use it.
3. Build Type. "DEBUG or RELEASE"
I always attempt DEBUG releases first. So thats what I'll use here.
Redo your make command with the following based on your choices
Once this is ran, it will echo your responses back to you and show you if they are valid or not.
at this point your ready to attempt a build.
just run make
Now keep an eye on things.. you'll see some warnings about the extra line GCC likes not being on alot of files with a message like warning: no newline at end of file. This is a safe warning to ignore in most cases.
If you get through the compile, your binary will get linked and tossed into games directory at the top of the tree.
here I simply run my binary... and enjoy..
I know there are some other things to consider. If I missed any due diligence steps , please feel free to add them in, correct me, or flame me as is expected of a good linux community.
--Rod
First you need to get a copy of the Linux download or Windows download, get them onto your linux box as effectively as you can. While not a big fan of SAMBA, it works really well for this process.
cd engine/compilers/make
Here you need to make a decision about which compilers, which targets, and such.
If you run make you'll get some instructions if things are not already set
Makefile:5: *** Configuration file not defined. Please run make -f configure.mk
run make -f configure.mk
make -f configure.mk
Get more instructions
ERROR: OS variable not set or is an illegal value
ERROR: COMPILER variable not set or is an illegal value
ERROR: BUILD variable not set or is an illegal value
Current Configuration: this config is INVALID
OS:
COMPILER:
BUILD:
DIR.OBJ: out
To change the current configuration type:
make -f 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.Here you'll need to decide a few things about your system.
1. Which OS you'll be using "WIN32 BEOS LINUX OpenBSD FreeBSD Solaris"
For my system I have LINUX
2. Which Compiler your using. "CW6 VC6 GCC2 GCC3 GCC3.4 GCC4"
For my systems I have both GCC3 and GCC4 But Im testing GCC3 right now so I'm going to use it.
3. Build Type. "DEBUG or RELEASE"
I always attempt DEBUG releases first. So thats what I'll use here.
Redo your make command with the following based on your choices
make -f configure.mk OS=LINUX COMPILER=GCC3 BUILD=DEBUG
Once this is ran, it will echo your responses back to you and show you if they are valid or not.
Current Configuration: this config is VALID
OS: LINUX
COMPILER: GCC3
BUILD: DEBUG
DIR.OBJ: outat this point your ready to attempt a build.
just run make
make
Now keep an eye on things.. you'll see some warnings about the extra line GCC likes not being on alot of files with a message like warning: no newline at end of file. This is a safe warning to ignore in most cases.
If you get through the compile, your binary will get linked and tossed into games directory at the top of the tree.
cd /home/rrindels/tgb/games
here I simply run my binary... and enjoy..
./TGB_DEBUG.bin
I know there are some other things to consider. If I missed any due diligence steps , please feel free to add them in, correct me, or flame me as is expected of a good linux community.
--Rod
#2
A static version of Mesa's GLU library is required. If your system does not have a libGLU.a file, you will need to install Mesa from source to get it.
and
Torque has problems linking with GLU on some S.U.S.E. distributions. Reinstalling mesa may help.
10/15/2006 (4:20 pm)
According to the TGE linux compiling instructions:A static version of Mesa's GLU library is required. If your system does not have a libGLU.a file, you will need to install Mesa from source to get it.
and
Torque has problems linking with GLU on some S.U.S.E. distributions. Reinstalling mesa may help.
#3
I downloaded it and did the following to resolve the build dependancy:
wget http://superb-east.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-6.5.1.tar.gz
# tar -zxvf MesaLib-6.5.1.tar.gz
# cd Mesa-6.5.1
# make linux-x86-static
# make install
To get past this issue.
Thank you Jerry.
10/15/2006 (5:49 pm)
I tried to install the Mesa-devel-static, but that did not include the libGLU.a file.I downloaded it and did the following to resolve the build dependancy:
wget http://superb-east.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-6.5.1.tar.gz
# tar -zxvf MesaLib-6.5.1.tar.gz
# cd Mesa-6.5.1
# make linux-x86-static
# make install
To get past this issue.
Thank you Jerry.
#4
https://bugzilla.novell.com/show_bug.cgi?id=212532
I'll just comment it here, to see if anything becomes of it.
10/15/2006 (8:27 pm)
I added a feature request via Bugzilla for opensuse to address adding this library to Mesa-devel-static so it would work out of the box via rpm.https://bugzilla.novell.com/show_bug.cgi?id=212532
I'll just comment it here, to see if anything becomes of it.
#5
I would suggest *trying* dynamically linking it and seeing what happens, despite the dire warnings. Change the line to:
And if it does bomb, personally I'd lean towards fixing that rather than hunting down a static libGLU, but maybe that's just me :-)
Gary (-;
10/16/2006 (10:57 am)
From the pertinent piece of makefile [conf.UNIX.mk]:# GLU must be statically linked, otherwise torque will crash. # JMQNOTE: aside from gluProject/unProject, GLU doesn't work. # calling a GLU function that calls a GL function will cause a # crash. let me know if you have a fix :) LINK.LIBS.GENERAL = $(LINK.LIBS.VORBIS) -Wl,-static -Wl,-lGLU -Wl,-dy -L/usr/X11R6/lib -lSDL -lpthread -ldl # -lefence
I would suggest *trying* dynamically linking it and seeing what happens, despite the dire warnings. Change the line to:
LINK.LIBS.GENERAL = $(LINK.LIBS.VORBIS) -Wl,-dy -L/usr/X11R6/lib -lGLU -lSDL -lpthread -ldl # -lefence
And if it does bomb, personally I'd lean towards fixing that rather than hunting down a static libGLU, but maybe that's just me :-)
Gary (-;
#6
I had good success with the dynamic linking so far. No crashes yet. I can't open any projects to test, but the fallingPlanes.t2d worked.
10/16/2006 (5:10 pm)
Gary,I had good success with the dynamic linking so far. No crashes yet. I can't open any projects to test, but the fallingPlanes.t2d worked.
#7
- Dennis
10/18/2006 (7:38 am)
As a side note, Suse is going to add LibGLU.a to Mesa-devel-static for the next beta build. Just got word back on the ticket.- Dennis
#8
Okay, I'm not sure what that means, or what I can do to fix it.
^.^;
Any help would be greatly appreciated.
uname -a output, just in case it provides any useful info at all
11/11/2006 (6:08 pm)
--> Linking out.GCC3.RELEASE/TGB.bin out.GCC3.RELEASE/platformX86UNIX/x86UNIXInputManager.obj: In function 'MapKey(unsigned short, unsigned char, unsigned long)': x86UNIXInputManager.cc:(.text+0x1aaa): undefined reference to 'X11_KeyToUnicode' x86UNIXInputManager.cc:(.text+0x1acf): undefined reference to 'X11_KeyToUnicode' x86UNIXInputManager.cc:(.text+0x1ae7): undefined reference to 'X11_KeyToUnicode' collect2: ld returned 1 exit status make[1]: *** [out.GCC3.RELEASE/TGB.bin] Error 1 make: *** [default] Error 2
Okay, I'm not sure what that means, or what I can do to fix it.
^.^;
Any help would be greatly appreciated.
uname -a output, just in case it provides any useful info at all
Linux renolc-arch 2.6.18-ARCH #1 SMP PREEMPT Sat Nov 4 10:54:10 CET 2006 i686 Intel(R) Celeron(R) CPU 2.93GHz GenuineIntel GNU/Linux
#9
If you open up x86UNIXInputManager.cc and find the MapKey function, you should see a short version using X11_KeyToUnicode, and a disabled older version below it. Simply comment out the upper 'new' version of the code, and remove the #if 0/#endif pair disabling the old version.
11/11/2006 (6:40 pm)
I've ran into the X11_KeyToUnicode issue myself just recently after upgrading SDL here, and have tracked down the cause. Apparently, X11_KeyToUnicode was an 'unofficial' SDL utility function that is no longer available from the SDL libraries. If you open up x86UNIXInputManager.cc and find the MapKey function, you should see a short version using X11_KeyToUnicode, and a disabled older version below it. Simply comment out the upper 'new' version of the code, and remove the #if 0/#endif pair disabling the old version.
#10
Much thanks to ya!
It's been a while since I've played with Torque, so I have a lot to relearn.
^_^
11/11/2006 (9:29 pm)
Sweet. That fixed it.Much thanks to ya!
It's been a while since I've played with Torque, so I have a lot to relearn.
^_^
#11
11/21/2006 (2:19 pm)
Is this only for the TGB Pro? I have the Indie TGB and no C++ source code can be found. Is there a Linux download for it hidden somewhere? Or a Linux version? Or has someone been successful running it on Linux via Wine or Cedega?
#12
11/21/2006 (2:23 pm)
To port to Linux, you would need the Pro license. Unless you had mad binary hacking skizzilz. You might, but I don't.
#13
11/27/2006 (9:54 am)
Jack download the latest TGB Pro windows version. You can use wine to install it then copy the TGB directory where you want. The source is in there with the files for compiling the linux version. Although it may not be useful to you since I haven't seen any fixes for the empty new project dialog among other things.
#14
Just click on the image of the other platforms on that page [IIRC it's on the left hand side under the product logo], and thar! linux download.
I'm not sure why you'd need a pro license for this, or why you'd need to use wine.
Gary (-;
11/28/2006 (10:38 am)
If you have a TBG license, that's for all platforms. When you try to download it, GG's site shows you the download for the platform you're coming from.Just click on the image of the other platforms on that page [IIRC it's on the left hand side under the product logo], and thar! linux download.
I'm not sure why you'd need a pro license for this, or why you'd need to use wine.
Gary (-;
#15
You need a pro license to get access to the source code, otherwise you only get a precompiled binary and the whole how-to-compile issue is moot. :) As for the reason to use wine, it's to get the newest version of the source code - the Windows version (and the OSX version) is 1.1.2 while the Linux download is still 1.1.1. The only way to get the 1.1.2 source at the moment is to extract it from one of the non-Linux versions, with wine likely being the easiest way. I'm not at all sure how much difference there is, but the 1.1.2 source does compile on Linux as well as the 1.1.1 source does, and the resulting binary runs just as well as 1.1.1's, possibly even a bit faster (at least for me).
11/29/2006 (4:35 am)
Quote:I'm not sure why you'd need a pro license for this, or why you'd need to use wine.
You need a pro license to get access to the source code, otherwise you only get a precompiled binary and the whole how-to-compile issue is moot. :) As for the reason to use wine, it's to get the newest version of the source code - the Windows version (and the OSX version) is 1.1.2 while the Linux download is still 1.1.1. The only way to get the 1.1.2 source at the moment is to extract it from one of the non-Linux versions, with wine likely being the easiest way. I'm not at all sure how much difference there is, but the 1.1.2 source does compile on Linux as well as the 1.1.1 source does, and the resulting binary runs just as well as 1.1.1's, possibly even a bit faster (at least for me).
#16
If that's the case, I doubt you'd need to work too hard to find a nice Linux user who could provide you a Linux version compiled from the latest code, thereby mitigating pretty much all of these here problems?
TGB-1.1.2.bin.gz. I compiled that on FC6 with GCC4, it's the latest OSX release.
Only changes from stock latest source download is the fix I put in this thread, the X11_KeyToUnicode fix listed above by Pacula, and linking dynamically against libGLU.
This doesn't qualify as an official GG release, I'm sure it won't run in half the places where it matters, never trust random executable code sent to you by people you don't know on forums, yada yada, but... well, there you have it.
Gary (-;
EDIT: Tpyo Fixes
11/29/2006 (11:24 am)
So, uh, I understand your concern as being that the Linux official release is a minor version behind the most recently available source?If that's the case, I doubt you'd need to work too hard to find a nice Linux user who could provide you a Linux version compiled from the latest code, thereby mitigating pretty much all of these here problems?
TGB-1.1.2.bin.gz. I compiled that on FC6 with GCC4, it's the latest OSX release.
Only changes from stock latest source download is the fix I put in this thread, the X11_KeyToUnicode fix listed above by Pacula, and linking dynamically against libGLU.
This doesn't qualify as an official GG release, I'm sure it won't run in half the places where it matters, never trust random executable code sent to you by people you don't know on forums, yada yada, but... well, there you have it.
Gary (-;
EDIT: Tpyo Fixes
#17
11/30/2006 (12:53 am)
I would like to put a huge CAUTION sign here : don't provide this randomly to other people. If you want to provide the compiled code, make sure you put it on a site where people can get authenticated using the remote authentication feature, and make sure you get the approval of GarageGames before you do.
#18
Since the 'indy' license does say one can only release 'game' projects, perhaps if the binary was included as part of a game demo it would be ok to distribute - even to the public.
OK, I -am- mostly joking here, but unless I missed something, it does sound to me like a legitimate way to give out any updated/fixed binaries. (If I AM missing something, please correct me.)
11/30/2006 (5:58 am)
I was thinking about that myself, but then realized something - doesn't the binary get distributed with any games one makes, and hence would be something that can be publicly released? Unless I misunderstand something of the process, isn't making a release version basically packaging up the binary along with just the scripts and resources needed for the game? Since the 'indy' license does say one can only release 'game' projects, perhaps if the binary was included as part of a game demo it would be ok to distribute - even to the public.
OK, I -am- mostly joking here, but unless I missed something, it does sound to me like a legitimate way to give out any updated/fixed binaries. (If I AM missing something, please correct me.)
#19
Providing "compiled code" is pretty much what having a license for any of GG's game engine products lets me do. I've also complied with every single restriction they have there; the *only* thing in the file I made available is a compiled binary.
I guess I could go walk through a tutorial and release a "game" so that other people [yourselves] could extract it and use the binary on your own, but why go through the effort?
Gary (-;
11/30/2006 (11:18 am)
www.garagegames.com/pg/product/eula.php?id=62Providing "compiled code" is pretty much what having a license for any of GG's game engine products lets me do. I've also complied with every single restriction they have there; the *only* thing in the file I made available is a compiled binary.
I guess I could go walk through a tutorial and release a "game" so that other people [yourselves] could extract it and use the binary on your own, but why go through the effort?
Gary (-;
#20
TGB-1.1.3.bin.gz
Gary (-;
11/30/2006 (11:36 am)
And, uh, I'm sure that this is totally taunting someone or something.TGB-1.1.3.bin.gz
Gary (-;
Torque Owner Dennis De Marco
SDL-devel-1.2.9-19
SDL_image-1.2.4-16
SDL_mixer-1.2.6-17
SDL-1.2.9-19.5
nasm-0.98.39-10 * You need this in addition to gcc
gcc-c++-4.1.0-25
libgcc-4.1.0-25
gcc-4.1.0-25
I get pretty far, before I am missing a library:
--> Linking out.GCC4.DEBUG/TGB_DEBUG.bin
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
make[1]: *** [out.GCC4.DEBUG/TGB_DEBUG.bin] Error 1
make: *** [default] Error 2
I am not sure why it's failing, I have the following libs
u4m@igloo:~/tgb/engine/compilers/make> ls -l /usr/lib/libG*
lrwxrwxrwx 1 root root 21 2006-08-25 20:57 /usr/lib/libGLcore.so.1 -> libGLcore.so.1.0.8774
-rwxr-xr-x 1 root root 8161228 2006-08-25 20:57 /usr/lib/libGLcore.so.1.0.8774
-rw-r--r-- 1 root root 653 2006-08-25 20:57 /usr/lib/libGL.la
lrwxrwxrwx 1 root root 10 2006-08-25 20:57 /usr/lib/libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root 17 2006-08-25 20:57 /usr/lib/libGL.so.1 -> libGL.so.1.0.8774
-rwxr-xr-x 1 root root 543724 2006-08-25 20:57 /usr/lib/libGL.so.1.0.8774
lrwxrwxrwx 1 root root 11 2006-10-15 18:22 /usr/lib/libGLU.so -> libGLU.so.1
lrwxrwxrwx 1 root root 20 2006-08-25 10:01 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.060402
-rwxr-xr-x 1 root root 483152 2006-07-19 21:09 /usr/lib/libGLU.so.1.3.060402
lrwxrwxrwx 1 root root 11 2006-10-15 18:22 /usr/lib/libGLw.so -> libGLw.so.1
lrwxrwxrwx 1 root root 15 2006-08-25 10:01 /usr/lib/libGLw.so.1 -> libGLw.so.1.0.0
-rwxr-xr-x 1 root root 16912 2006-07-19 21:09 /usr/lib/libGLw.so.1.0.0