building openTTD

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
vishnu
Donor
Donor
Posts: 3189
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby vishnu » Fri Oct 09, 2015 1:13 pm

That's why I use BASH on my Unix boxes, so I never have to use setenv... :lol:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby Trippynet » Sat Oct 10, 2015 10:01 am

Hmm, bugger. Got the environment all set up correctly this time (I think), and it compiles right through to thread.c upon which it spits out 13 errors and dies.

Pretty much all the errors are:

Code: Select all

/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:277:33: error: unknown type name 'pthread_barrierattr_t'


Other bits it can't find in the same header file are pthread_barrier_t and pthread_spinlock_t.

A hefty bit of searching seems to suggest that these were added with IRIX 6.5.23, so looks like I'll have to compile this on my Fuel. Until now I'd been using the Indigo2 for it :)
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby Trippynet » Sun Oct 11, 2015 5:07 am

OK, compiled it fine on my Fuel, and it runs rather nicely too! Decided to then have a go at compiling the latest release.

And it fails when running the configure file with a bunch of "/sbin/sed: arg list too long" errors. pfftt.
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby Trippynet » Sun Oct 18, 2015 1:08 pm

And a bit more. I've found from testing that 0.5.3 works fine in general, but opening the map causes an instant CTD with a "Bus Error".

I've had a look at later versions, and unfortunately they've changed the config/build system heavily for 0.6.0 and above. When running configure, I find it gets most of the way through the configuration process, then throws several "/sbin/sed: arg list too long" errors whilst generating the Makefile. After checking what it's produced, the Makefile is essentially empty.

Digging into it more (and I'm mentioning most of this in case anyone else wants to take a look and doesn't want to have to repeat my digging), it gets to line 2962 of config.lib which is where it's calling the first of the sed commands which is failing. I tweaked the file in order to capture the data it's trying to pass through sed, and as you can see from the attached file, you can understand why I'm at a bit of a loss as to see where it's failing.

I did then have a go at trying to port the more recent changes from openttd-1.0.0 (1.1.0 and above require liblzma, hence me sticking with 1.0.0) into the Makefile from 0.5.3, but this is a none-starter as all the dependency files under .deps don't exist for the later versions.

If anyone has any bright ideas, that would be nice. Otherwise, I might do some prodding on the OpenTTD forum to see if anyone there (who understands the build script better) can comment on why it's failing. I really don't fancy having to try and re-create the whole config/makefile from scratch...
Attachments
sedError.txt
The input piped to sed which causes configure to fail. You're going to need word-wrap for this one :-)
(21.03 KiB) Downloaded 23 times
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

jpstewart
Donor
Donor
Posts: 437
Joined: Tue Sep 21, 2010 3:31 pm
Location: Southwestern Ontario, Canada

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby jpstewart » Mon Oct 19, 2015 8:14 am

Trippynet wrote:I've had a look at later versions, and unfortunately they've changed the config/build system heavily for 0.6.0 and above. When running configure, I find it gets most of the way through the configuration process, then throws several "/sbin/sed: arg list too long" errors whilst generating the Makefile.

That's not surprising. The default value for maximum command line length on IRIX is 20480 bytes (20 KB). The file you posted was one line of 21538 bytes, which is just over the limit. What I've done in similar situations in the past is run 'systune -r ncargs 262144' to (temporarily) raise the limit to 256 KB, which is (IIRC) the hard limit on IRIX and should be more than enough for what you're trying to do. (Note that systune must be run as root. See the man page for more details. In particular, omit the -r if you want the change to be permanent.)

That should get sed to run. But I'm not sure if IRIX's version of sed will handle that code properly or not. If sed chokes again after running systune, either change your path so that Nekoware sed comes before /sbin/sed, or try 'setenv SED /usr/nekoware/bin/sed' before running configure. Given all the other GNU-isms in the code, it wouldn't surprise me at all if GNU sed is required. (But the need for systune is the same with both IRIX sed and GNU sed since that's a kernel limit.)
:Indigo2IMP: :Octane: :Indigo: :O3x0:
Sun SPARCstation 20, Blade 2500, T5240, Ultra2
HP C8000

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby Trippynet » Mon Oct 19, 2015 8:18 am

Outstanding, thank you! I think I've already set up the GNU sed from Nekoware to be the default, but I'll double check. I'll give it a bash with that later this evening if I get chance to see what difference it makes.
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: Open Transport Tycon Deluxe - openTTD for IRIX

Unread postby Trippynet » Mon Oct 19, 2015 12:50 pm

OK, that's fixed the configuration issue and I now have a shiny Makefile popping out at the end. Thanks jpstewart!

However, it seems that this version of OpenTTD is far from just being a quick run through GCC in order to compile it, unlike 0.5.3.

Working through it (with my admittedly limited C++ knowledge), I've fixed three issues/bugs in the source code so far, still running into more issues as I go on. Still, I'll keep at it. I'm determined to get this bugger compiled in the end...
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: building openTTD

Unread postby Trippynet » Tue Oct 20, 2015 1:42 pm

Done, well at least to some degree. Source code took a fair bit of fixing, but attached is version 1.0.0 of OpenTTD for IRIX.

Compiled with GCC (sorry hamei), and no networking or AI at present (might have a look at those at some point in the future), but unlike 0.5.3, the minimap works now without crashing.

Only other limitation I've found so far is that the music doesn't work. I'll need to investigate why - all other sound seems fine. Otherwise though, enjoy! Oh, and you'll need the "gm" and "data" folders from a genuine release of TTD (or the free newgrf alternatives from the OpenTTD site) before this will run.

Next, I'll have a try at the latest OpenTTD release... :?
Attachments
openttd-1.0.0.tar.gz
OpenTTD-1.0.0
(3.44 MiB) Downloaded 23 times
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
necron2600
Posts: 279
Joined: Tue May 26, 2015 10:38 pm
Location: Boston

Re: building openTTD

Unread postby necron2600 » Tue Oct 20, 2015 6:49 pm

Any info on what was done to the source code to make it compile?
I tried .. and had quite a bit of mods to files.. I did get it to compile but it just failed to start with
Bus error (core dumped)

Also, when it compiled, there was more than just the openttd binary and lang dir.. there were some compiled files in data that I assume are needed, even if you have the orig game data files.
openttdd.grf, openttdw.grf, opentitle.dat, etc..
Do you happen to have those when you compiled?

My issues in compiling:
Had to ./configure --os=UNIX --disable=network --without-liblzo2 (not sure if you have liblzo2 around?)

3rdparty/squirrel/squirrel/ errors out at:
[SRC] Compiling 3rdparty/squirrel/squirrel/sqapi.cppwarning: 'sq_vm_realloc' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation

So I modded objs/release/Makefile to use g++ -fpermissive to make it work (probably a bad idea)

Then a lot of errors later where alloca was not declared such as:
openttd-1.0.0/src/ai/api/ai_road.cpp:384:87: error: 'alloca' was not declared in this scope
To which I would edit the .ccp or .hpp file to add before the includes:
#define alloca __builtin_alloca

later.. I had
/openttd-1.0.0/openttd-1.0.0/src/fileio.cpp:914:16: error: 'chdir' was not declared in this scope
to which I added to fileio_func.h :
#include <unistd.h>

next: openttd-1.0.0/src/os/unix/crashlog_unix.cpp:63:27: error: 'strsignal' was not declared in this scope
Couldnt figure this one out.. so I just commented out the single strsignal line. Potentially an issue... but I assume a crashlog wouldnt affect gameplay.

It finished compiling.. just core dumped when running ;)

If you have any steps.. I would like to know what was done .. at least for my own education.

Thanks,
-Kevin

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: building openTTD

Unread postby Trippynet » Wed Oct 21, 2015 12:47 am

I'll post my changelog later on (I quickly documented all my tweaks for future reference).

Off the top of my head, Squirrel can be got rid of by turning off the "AI" switch in configure. I might have a try at getting it working at some point, but it's not essential for the compile. I also had to turn off Allegro, and I disabled Network, just because it was known to be troublesome with 0.5.3, and also liblzo2 (as you mentioned - it's only used for loading very old OpenTTD save files, so not a problem to turn it off).

Not sure about those other files you list, I'll have to check my OpenTTD folder on my Fuel once I get home (typing this from work).

Lots of alloca errors, all fixed by adding #include <alloca.h> to the top of the affected files.

I also commented out the strsignal line, seeing as the only thing it will affect is removing one line of debug info from the crashlog if it goes tits-up - not exactly a massive issue.

Can't remember the other changes I made, I'll post them this evening.

Anyway, the result of this for me was a successful compile, then once I'd copied the data and gm folders across, it launched fine. Only issue I do have is that if you try to open the Jukebox, it complains and won't play anything. I'll need to investigate that one later.

EDIT: My list of fixes is now attached...
Attachments
Fixes.txt
(2.25 KiB) Downloaded 23 times
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: building openTTD

Unread postby Trippynet » Sun Oct 25, 2015 7:52 am

OK, quick question. What exactly is a segmentation fault?

I've compiled the latest OpenTTD and have fixed a number of issues with it. However, whenever saving a game, it always crashes with a "Segmentation Fault". OpenTTD 1.0.0 saves fine.

I did wonder if it was due to newer OpenTTDs using LZMA for save compression rather than ZLIB, so I recompiled with LZMA support disabled, but it still segfaults when saving. It'll load a ZLIB save from OpenTTD 1.0.0 absolutely fine. I've also found that if I run it in debug mode (.\openttd -d 1), it prints various bits of debug info to the console, but then crashes with a segfault before it can even render the main menu.

Err... any ideas here about things to try? Knowing what a segfault is would be a start! :)
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
dexter1
Moderator
Moderator
Posts: 2743
Joined: Thu Feb 20, 2003 6:57 am
Location: Zoetermeer, The Netherlands

Re: building openTTD

Unread postby dexter1 » Mon Oct 26, 2015 2:23 am

Trippynet wrote:OK, quick question. What exactly is a segmentation fault?


A segmentation fault is an illegal access of protected memory by a program, which causes the OS kernel to issue a SIGSEGV signal. If programs have error handling they can do something (i.e. recover) but usually the program aborts.

This means the program has a bug and needs to be debugged :) Best thing to do is to recompile your program with the debug flag -g and run the program through a debugger with either gdb or cvd.
:Crimson: :PI: :Indigo: :O2: :Indy: :Indigo2: :Indigo2IMP:

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: building openTTD

Unread postby Trippynet » Mon Oct 26, 2015 1:23 pm

Thanks for the help!

I've re-compiled it with -d, and have run it through gdb. Interestingly, it never even gets as far as displaying the UI before running into problems. Very quickly, I get:

Code: Select all

Starting program: /usr/people/dave/Compiling/openttd-1.5.2-source/bin/openttd

Program received signal ?, Unknown signal.
0x0fa42e88 in __open () at /xlv86/patches/7207/work/irix/lib/libc/libc_n32_M4/sys/open.s:23
23      /xlv86/patches/7207/work/irix/lib/libc/libc_n32_M4/sys/open.s: No such file or directory.
        in /xlv86/patches/7207/work/irix/lib/libc/libc_n32_M4/sys/open.s
Current language:  auto; currently asm


I've tried running next a few times, and I get...

Code: Select all

warning: Signal ? does not exist on this system.

24      in /xlv86/patches/7207/work/irix/lib/libc/libc_n32_M4/sys/open.s
(gdb) next
0x0fa42f60 in _open () at openSCI.c:31
31      openSCI.c: No such file or directory.
        in openSCI.c
Current language:  auto; currently c


After this point, trying to continue again just causes a seemingly endless loop. Quitting from it after many minutes of 100% CPU usage gives me:

Code: Select all

Program received signal SIGINT, Interrupt.
0x0fa42f7c in _open () at openSCI.c:31
31      in openSCI.c


Not sure if this means anything to anyone, or if I'm simply using gdb the wrong way? I have to be honest and say that I'm somewhat out of my comfort zone at this stage :)
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30

User avatar
Trippynet
Donor
Donor
Posts: 815
Joined: Thu Aug 15, 2013 6:22 am
Location: Aberdeen, Scotland, UK

Re: building openTTD

Unread postby Trippynet » Tue Nov 10, 2015 8:04 am

OK, I've temporarily shelved plans for OpenTTD 1.4.2 because I simply lack the knowhow to debug this properly. Instead, I've worked back through the different versions and have found that every version after 1.1.0 segfaults when saving. Interestingly, this is the version where they changed from ZLIB to XZ for save game compression, which may be related. However when I built OpenTTD 1.4.2 without XZ support, it still crashed when saving.

Anyway, instead I've successfully compiled a complete version of 1.0.5. This is complete in that it includes both AI and Network code (both these were missing from my 1.0.0 tarball above). I've tested it out and it saves fine, works great with the free graphics/sound replacements, and you can also browse all the various online network servers (for an online game), and download NewGRF mods from within it.

I was thinking about trying to package it up into a proper Nekoware tardist (more learning required, not done one before, and I need to take into account the folder rules and whatnot for Nekoware). However, if anyone wants a copy before then, let me know and I'll attach a tarball of it.

Next step after that is for me to look at the changes to the saving code between 1.0.5 and 1.1.0 to see if I can spot any telling signs as to why the later versions are segfaulting. I might have more success with troubleshooting and understanding the source code rather than trying to debug a compiled version.

Edit: Thanks to everyone that has offered help or encouragement so far :)
Systems in use:
:Indigo2IMP: - Nitrogen: R10000 195MHz CPU, 384MB RAM, SolidIMPACT Graphics, 36GB 15k HDD & 300GB 10k HDD, 100Mb/s NIC, New/quiet fans, IRIX 6.5.22
:Fuel: - Lithium: R14000 600MHz CPU, 4GB RAM, V10 Graphics, 72GB 15k HDD & 300GB 10k HDD, 1Gb/s NIC, New/quiet fans, IRIX 6.5.30
Other system in storage: :O2: R5000 200MHz, 224MB RAM, 72GB 15k HDD, PSU fan mod, IRIX 6.5.30


Return to “SGI: Development”

Who is online

Users browsing this forum: No registered users and 1 guest