Running OpenTTD as dedicated server on my NAS (ARM)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Running OpenTTD as dedicated server on my NAS (ARM)

Post by Valentijn »

EDIT: I succeeded in running the dedicated server on my NAS. More info below original FP.

Hello,

Apart from the fact that I need to compile OpenTTD for my NAS, I first have another question.

Will it be posible to run it on my NAS as dedicated server? The NAS has only a basic Linux 2.6.6.

I think I will be able to get in all the dependencies, but I am not sure if the Dedicated server can run entirely ''headless''.

Any thoughts?

BTW it's a D-Link DNS-323 NAS.

EDIT: Mission accomplished:

I managed to setup a Debian chroot on my NAS (following: http://wiki.dns323.info/howto:chroot_debian - The Easy Way).

In the chroot I could compile openttd 0.7.5, with one minor patch that is now in trunk).
patch_arm_fix_screenshot_cpp_0.7.5.patch
(928 Bytes) Downloaded 237 times
Here's the Debian package, compiled against arm (not armel!):
openttd_0.7.5_arm.deb
(3.39 MiB) Downloaded 227 times
To install:

Code: Select all

dkpg -i openttd_0.7.5_arm.deb
For users on an armel architecture, you can just install OpenTTD with apt-get:

Code: Select all

apt-get install openttd
EDIT: After running a week on 256x256 succesfully, I now switched to 512x512 maps. Unfortunately the game now stutters every once in a while. On my NAS I see high cpu usage at those times. Guess my NAS isn't quick enough for bigger maps.
Last edited by Valentijn on 07 Jan 2010 21:55, edited 10 times in total.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Running OpenTTD as dedicated server on my NAS

Post by Zuu »

Is having a detached screen session headless enough for you?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

For me it is, I don't care. It's just that I don't know enough about Linux and OpenTTD to know whether it will run at all without a GUI.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Running OpenTTD as dedicated server on my NAS

Post by Zuu »

Please note that 'screen' is a specific program: http://en.wikipedia.org/wiki/GNU_Screen

OpenTTD can run from a terminal, but if you login on a remote machine using ssh, you probably want to use screen and then deattach from the screen session, so that you can attach to it later. It should still be possible to run openttd with an '&' afterwards to make it stay alive after the ssh-connection has been broken. (IIRC you had to use also a ! in z-shell. Not sure if that also applies to bach which is the more common shell)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

Thanks.

I did know Screen, but didn't know openttd was capable of running in a terminal only.

Next step is to compile the thing on the NAS, I think I'm still missing some libs. I'll give it a go.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Running OpenTTD as dedicated server on my NAS

Post by Zuu »

When you compile, you can specify that you want to compile a dedicated build. That will not require the SDL/Allegro/DirectX libraries and will only run in a terminal. You can run a normal build in dedicated mode, but since you are going to build from scratch, then you can just omit the GUI part at compile time.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

Thanks, I only ever compiled it on windows so good to know.

Is it obvious how to omit the GUI part? Probably just some parameter to Make?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Running OpenTTD as dedicated server on my NAS

Post by planetmaker »

It's decided by configure:

./configure --enable-dedicated

call ./configure --help to see all available options

After calling ./configure you call make.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

ah, right. I remember! First configure.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

Configure is running ok, except for missing zlib library (which I do have installed).

Code: Select all

checking zlib... not found
WARNING: zlib was not detected or disabled
WARNING: OpenTTD doesn't require zlib, but it does mean many features (like
WARNING: loading most savegames/scenarios, joining most servers, loading
WARNING: heightmaps, using PNG or using fonts, ...) will be disabled.
configure: error: no zlib detected
 If you want to compile without zlib use --without-zlib as parameter
If I run configure without zlib, it runs ok.

Code: Select all

./configure --enable-dedicated --without-zlib
But compilation fails:

Code: Select all

[SRC] Compiling saveload/afterload.cpp
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp: In function 'bool AfterLoadGame()':
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp:1811: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [saveload/afterload.o] Error 1
make[1]: Leaving directory `/mnt/usb/ffp/openttd/objs/release'
make: *** [all] Error 2
Since it fails on aferload, might it still have something to do with the zlib missing?

line 1811 from afterload.cpp is just a simple statement:

Code: Select all

                if (_settings_game.economy.town_layout == 0) { // was TL_NO_ROA
 
It could also be an out of memory problem. My NAS has 64MB of memoy, don't know if that's enough to compile openttd.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

Second run of make fails with similar error, but on different line number:

Code: Select all

[SRC] Compiling saveload/afterload.cpp
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp: In function 'bool AfterLoadGam  ()':
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp:385: internal compiler error: I  legal instruction
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [saveload/afterload.o] Error 1
make[1]: Leaving directory `/mnt/usb/ffp/openttd/objs/release'
make: *** [all] Error 2
Line:

Code: Select all

bool AfterLoadGame()
Nothing wrong with the code I think.

One thing I noticed is that configure completes, but along the way there are some errors:

Code: Select all

checking host c++... g++
checking host strip... strip
makedepend: No such file or directory
checking makedepend... not found
detecting cpu-type... 32 bits
makedepend command is unkown. No idea where to find it.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

After multiple tries it keeps failing consistently on the problem mentioned in the first post:

Code: Select all

[SRC] Compiling saveload/afterload.cpp
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp: In function 'bool AfterLoadGame()':
/mnt/usb/ffp/openttd/src/saveload/afterload.cpp:1811: internal compiler error: Illegal instruction
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [saveload/afterload.o] Error 1
make[1]: Leaving directory `/mnt/usb/ffp/openttd/objs/release'
make: *** [all] Error 2
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Running OpenTTD as dedicated server on my NAS

Post by Rubidium »

Valentijn wrote:makedepend command is unkown. No idea where to find it.
You don't need; it's nothing to worry about. The compiler crashing is something to worry about. Sounds like a buggy/broken compiler to me, although illegal instructions might show that the binary is 'just' corrupted. How did you make/acquire the compiler?
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

Rubidium wrote:You don't need; it's nothing to worry about. The compiler crashing is something to worry about. Sounds like a buggy/broken compiler to me, although illegal instructions might show that the binary is 'just' corrupted. How did you make/acquire the compiler?
Thanks for the answer.

The compiler is just the gcc compiler from the well known fun_plug package. Lots of people are using is, so it should be ok.

Community site: http://forum.dsmg600.info/viewforum.php?id=3

Site of creator of fun_plug: http://www.inreto.de/dns323/fun-plug/0.5/

Some compile instructions: http://nas-tweaks.net/CH3SNAS:Tutorials ... g_software

In the past I have been able to compile nzbget with (an earlier version) of this gcc package.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Running OpenTTD as dedicated server on my NAS

Post by Rubidium »

Sadly enough the fact that the compiler compiles program X just fine doesn't mean program Y compiles just fine too. Maybe it's because of some of the tricks we do; it's still valid C++, just not very common and thus more prone to unresolved compiler bugs.

For example GCC's LTO feature was added to trunk and after that it took a few months before it kind-of works for OpenTTD and still it's not 100% working for OpenTTD.

I suggest upgrading the compiler or if that's not possible downgrading to see whether it's fixed/a new bug.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

I understand, I am already (trying) to get to the latest gcc compiler.

I am compiling from tag 0.7.5, just t o let you know.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

The compiler (GCC) hase been compiled with the following options supplied to configure:

Code: Select all

--enable-languages=c,c++ --enable-__cxa_atexit
--with-local-prefix=$CPREFIX
--disable-multilib
--disable-libssp --disable-libgomp --disable-libmudflap
--disable-tls
--with-float=soft
--disable-bootstrap
Does anyone know if these options will result in the correct compiler.

BTW These are the options used to compile GCC, not to compile openttd.
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

ok, I managed to install a Debian chroot on my NAS and try to compile it in there. It should have better support for libraries and stable compilers, etc.

Result is that it now gets a bit further, but still fails. This time on a more genuine error (failed assertion):

Code: Select all

[SRC] Compiling screenshot.cpp
/mnt/HD_a2/openttd/src/screenshot.cpp:76: error: size of array '__ct_assert__' is negative
make[1]: *** [screenshot.o] Error 1
make[1]: Leaving directory `/mnt/HD_a2/openttd/objs/release'
make: *** [all] Error 2
NAS:/mnt/HD_a2/openttd# joe src/screenshot.cpp
Can I work around this?
Valentijn
Engineer
Engineer
Posts: 118
Joined: 07 Nov 2007 10:04

Re: Running OpenTTD as dedicated server on my NAS

Post by Valentijn »

The assertion:

Code: Select all

/** Pixel data in 24bpp BMP */
struct RgbTriplet {
        byte b, g, r;
};
assert_compile(sizeof(RgbTriplet) == 3);

Very strange it fails ?!
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Running OpenTTD as dedicated server on my NAS

Post by peter1138 »

No, ARM packs the struct to 32 bit words, so it will be 4 bytes. This is a genuine OpenTTD bug, and r18673 fixes this assumption.
He's like, some kind of OpenTTD developer.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests