Game Development Community

Building T3D (dedicated server) on 64 bit Ubuntu 12.10

by Chris Calef · in Torque 3D Professional · 12/22/2012 (11:37 am) · 17 replies

Hey everybody,

This should be a relatively easy one, and I'm _sure_ I'm not the first one to run into it, but I got 99% of the way through a dedicated server build last night, and got hung up at the linker stage.

For those who didn't get as far as me, first if you don't know where to start at all go here first:

github.com/GarageGames/Torque3D/pull/19

You do need to install a few packages on your raw Ubuntu install, namely nasm, libsdl1.2-dev, and libogg-dev.

If you got through that but had problems with this error:

/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory

then that leads you to the last package I had to install: libc6-dev-i386

However, at the end of all that, I'm still getting an issue with the linker, having to do with my 64 bit version of gcc I think... and then also something about STL. Anything here ring any bells for anyone?

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status
cannot find -lstdc++
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status

Thanks!


#1
12/22/2012 (11:57 am)
Be sure you install 32-bit versions of libs.
like so:
sudo apt-get install gcc-multilib libsdl1.2-dev-i386 libogg-dev-i386
and any other
edit: don't have ubuntu at hands, so not sure how it should be called, may be libsdl1.2-i386
#2
12/22/2012 (1:53 pm)
ah interesting, thanks, will try that!

EDIT: hm, I already have gcc-multilib installed, and the others don't have i386 versions available (using apt-cache search, anyway). I'll keep looking, in the meantime I think I'll go ahead and install a 32 bit Ubuntu virtualbox, probably should have just done that right off the bat when I went for 64 bit. :-)
#3
12/23/2012 (3:39 pm)
Okay, I've just got time to install the ubuntu 12.10 on virtual machine, here's what I added to stock desktop installation for building T3D:
sudo apt-get install git php5-cli make gcc g++ g++-multilib nasm libogg-dev libogg-dev:i386 libsdl1.2-dev:i386
That grabs/installs hell-a-lot of different packages, including required "mesa" and a few others.

Notice the "g++-multilib" package, it is needed for 32bit version of stdc++.

This works fine for the "Ubuntu Server", but installing libsdl1.2-dev:i386 on Ubuntu Desktop x64 gives problems, like it wants to uninstall a lot of stuff (compiz, some gnome components) and recommends to replace lots of libs to 32-bit versions (as I was unable to install both - the libsdl1.2-dev package and libsdl1.2-dev:i386).

So, I would like to recommend to use server edition, or, if UI really needed, 32-bit "Desktop" edition.

After forcing install of libsdl1.2-dev:i386 and switching to shell mode, I was able to build latest T3D and run Full template.

Edit: I don't have this problem on openSUSE 12.2 x64, so not sure whats wrong with Ubuntu Desktop. I've worked only with server editions.
#4
12/23/2012 (4:53 pm)
Wow, thanks for going to all that effort! I've installed a 32 bit 12.10 Desktop in a virtual box now, but haven't figured out all the settings apparently because it runs slower than I can imagine anyone being okay with... gave it seemingly adequate system RAM and video RAM, will do a little more research to see if there's something I missed.

If that doesn't work I will try a 32 bit server in a VB next. Don't think I want to dump all my 64 bit versions of everything in my main system just to compile Torque.

Thanks again for the help!!

#5
12/24/2012 (6:00 am)
Btw, you can apply this commit: Removal of SDL dependency for linux dedicated server to your codebase.
With this you don't need SDL at all, so there should not be any problems on building dedicated t3d server on x64 desktop.

I'm running some tests with those changes applied on our project, so far (half an hour passed), don't see any side effects.
#6
12/24/2012 (10:38 am)
Well that sounds useful... and, sigh, it's time to display my ignorance again. While I'm googling around and around on the subject it wouldn't hurt to just ask:

How exactly do I pull just that one commit from that one fork into my local git repo?

Gave it a fair amount of googling already and my head is spinning. I know I'll love git sooner or later. :-)
#7
12/24/2012 (11:05 am)
Oh also Fyodor, while I'm at it, do you have any input on the following error I got while trying to run your current repo, as well as timmgt's repo (giving up on merging for the moment, I just downloaded the whole thing). But with both of your builds (but not in the T3D development branch) when I try to run generateProjects.command I get the following:

PHP Fatal error:  Call-time pass-by-reference has been removed in (...)/Tools/ProjectGenerator/classes/FileUtil.php on line 84.

Looks like a php version issue, maybe... php --version for me reports:

PHP 5.4.6-1ubuntu1.1 (cli)

Thanks again, your help is much appreciated! I build TGE on linux back in the day but have been looking forward to putting a T3D server online for a long time. :-)

EDIT: heh, probably should have googled this one first, but I'll leave this up here for anyone else who's interested, looks like a little update to the code is necessary:

stackoverflow.com/questions/8971261/php-5-4-call-time-pass-by-reference-easy-fix...
#8
12/24/2012 (11:15 am)
First, GIT:

Lets say you have my-works (marked "M" below) with lots of commits in it and is originated from development ("D" below) branch.
The commit marked as "X" is the one you want to push to official repo.

...
        /*-*-*-X-*-M
*-*-*-*-D

Checkout to the development branch:
$ git checkout development
Create new branch "coolfeature" from development:
$ git branch coolfeature
Now, "cherry-pick" needed commit:
$ git cherry-pick 94a585b913
where "94a585b913" is hash/id of your "X" commit in "M" branch.
After that you will have
...
        /-*-*-*-X-*-M
*-*-*-*-D
        \-X
Where "X" will be your "coolfeature" branch with the only one commit from "my-works". And that commit will not include any other changes from the "M" branch.

Re: PHP issue.
Use latest dev or master branch from official repo (merge or fast-forward your changes). There was a commit which fixes that. Its included in dev and master branch of official T3D repo, but my "linux" branch does not have it, as I've started my branch before it was merged.
#9
12/24/2012 (12:08 pm)
Hmm, okay, trying that but I feel like I'm missing out on a large body of assumed knowledge... above you describe this process as if I'm pulling this commit from my own work, but I'm trying to pull a commit from somebody else's fork of T3D Development. Does that work, or do I need to do something on github first to merge those changes into my own fork of T3D development? (wallowing in the muck of complete Git confusion...)

I see your commit hash there, and I tried just putting in the hash that appears under timmgt's commit, but I just get "bad revision". I also tried the full github path to timmgt's fork, with commits/44003e... hash included, with same result.

I swear I will figure out this tool SOMEDAY. :-}
#10
12/24/2012 (12:29 pm)
Before you can pickup a commit from someones repo, you need to have it in your repo.

I've done it this way:
J:DevelopmentGitHubTorque3D>git remote -v
origin  git@github.com:just-bank/Torque3D.git (fetch)
origin  git@github.com:just-bank/Torque3D.git (push)
torque  https://github.com/GarageGames/Torque3D.git (fetch)
torque  https://github.com/GarageGames/Torque3D.git (push)
pegasus ssh://bank@pegasus/srv/git/t3dmit.git (fetch)
pegasus ssh://bank@pegasus/srv/git/t3dmit.git (push)
ce      https://github.com/T3DCE/CE-OSLab.git (fetch)
ce      https://github.com/T3DCE/CE-OSLab.git (push)
jamesu  https://github.com/jamesu/Torque3D.git (fetch)
jamesu  https://github.com/jamesu/Torque3D.git (push)
After I've added all repos, I just do:
$ git remote -v update
and it will grab everything from all repos you have setup.
After that you should be able to find the commit you are looking for, like:
$ git show abcdef0123
will give out info about that commit no matter it is in your repo or someones else (it just have to be sure you fetched all branches from remotes).

Edit:

To add repo, kick this command:
$ git remote add <name> <url>
#11
12/24/2012 (12:45 pm)
Aha, okay wonderful, that all made sense and it actually worked! =-)

So that resolved my STL difficulty, but unfortunately I still have a GCC version problem, apparently. (?) Here is the remaining error message:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make: *** [../../game/Full] Error 1

I have to run out for a bit but will be back on this in an hour or so, thank you so much for everything!

EDIT: oh yeah, that was the part that needed replacing all those libraries with 32 bit versions, now I remember... anyway, will be back on it in a while. At least the world of shared Git repos is now open to me! =-)
#12
12/24/2012 (1:01 pm)
Replacing lib was a need if you use SDL, but for stdc++ its simple:
sudo apt-get install g++-multilib
Thats g++-multilib, not the gcc-multilib!
#13
12/24/2012 (2:42 pm)
And, with that... aha!! You, sir, are a scholar and a gentleman! Linux server builds and windows client can join!

Now, on to the other million and one things on the to do list...
#14
12/24/2012 (2:46 pm)
hehe, glad it worked out finally!

have fun :)
#15
12/28/2012 (3:28 pm)
So, things are going fairly well, but I have an new issue... when you hook up a client to your dedicated linux build, are you getting all the datablocks? I'm not sure if I'm getting some or none of them, but my DefaultPlayerData datablock definitely does not make it, hence I am left with only a free camera, no player, when I log in to that server from a client.

When I run the same project as a dedicated server on windows, the datablocks do fine and I have a player.

Checking for existence of this datablock via the console, eg "echo(DefaultPlayerData.cameraMaxDist)" yields results on the windows server, none on the linux servers.

Could this be related in any way to the STL thing? Or, the one variable I can't test is whether connecting across a network instead of on the same machine makes any difference, all my linux servers are across the network and my only windows test server is on the same machine.

EDIT: update on this, I think it is failing on the collada loads... count of my DataBlockGroup reveals I'm only missing the last five, which appear to correspond to the player and Cheetah related blocks. Will try committing the cached dts models next.


RESULT: yup, that was it. I probably need to install the collada library separately, eh?
#16
12/28/2012 (5:05 pm)
Also, if Fyodor or anyone else happens along this way in the near future and feels like enlightening a poor hapless git-n00b... I seem to be finding myself confused once again on the normal flow of operations.

I'm doing fine so far as adding, committing, and pushing changes goes, but on the pulling down to another repo I'm having trouble finding the correct way to go about it. Now I have "cherry-pick" in my arsenal and it's working great, but what is the normal command for updating to the most recent HEAD state, if I don't want to cherry pick one commit? Is it "git merge"? I thought I had this figured out but my poor remaining brain cells keep dropping it somehow...

EDIT: ARgh... I think I have it sorted now. Turns out what I was trying to do was actually working, except I have some messed up windows bug that committed my files on a path that was all lower-case, which meant in linux of course it was an entirely different path... >:-\ wtf...
#17
11/23/2013 (2:02 pm)
This still works, although this is what fixed it for me:
sudo apt-get install g++-multilib

Thanks again Fyodor