Building a Pair of Classic Arcade Shoot-Em-Ups: a mini porting journal

Here are two open source games in the style of the arcade classic Galaga. The first is Powermanga from and the other is Xgalaga from Powermanga has a few dependencies that can be obtained from and inst should complain if you don't have them. Xgalaga has none other than the X libraries.

Ironically, while I have no time to actually play these games (I've only verified the first 30-second of play), I do allow myself the luxury of porting them over to IRIX because it's fun, easy (now that Neko has shown me how) and I feel it's also educational. I'm not sure why games are easier ports than many other applications, maybe it's because they are simpler or that the programmers have portability in mind from the get go. In addition to the downloads, I'd like to share some of details of the builds with you (who in my deranged imagination are as interested in IRIX and building software as myself).

First of all, I usually try the following to do a port:

(a) unzip/tar the source into a working directory
(b) set the following environment variables

setenv CC cc setenv CFLAGS '-mips4 -O3 -I/usr/freeware/include' setenv LDFLAGS '-L/usr/local/lib -L/usr/freeware/lib32'

or if the GNU C/C++ compiler is preferred:

setenv CC gcc setenv CFLAGS '-mips3 -O2 -I/usr/freeware/include' setenv LDFLAGS '-L/usr/local/lib -L/usr/freeware/lib32'

Next, change to the directory where the configure executable lives and run it with

/configure --prefix=/Sr/local

or some variant. If that goes well, I use GNU make via


Lastly, I (as root) use:

gmake install

to place the software in the target subdirectories, but usually I try to running it locally first to make sure it built OK.

This approach works about 50% of the time. Usually, there is an error either in the configure step or else in the build. Let's look at the details for these two applications.

This one configured fine but got the following error during the linking (the last step of the build when all the compiled objects are merged into the executable).

d32: FATAL 9 : I/O error (-lXext): No such file or directory collect2: ld returned 32 exit status

Well I know that IRIX supports the X extensions library. It has things in it like the Xshape extension that allows non-rectangular windows and I know that xeyes (the demo program for that extension) runs fine. So that means it's just not finding it. So let's try some different link flags;

setenv LDFLAGS '-L/usr/lib32 -L/usr/local/lib -L/usr/freeware/lib32'

which points to the library location I found by searching for I do a 'gmake clean' and start over. (Sometimes it's necessary to delete the file
config.cache also, since it saves the values from the previous configure run, but not this time). And now it works! I do "gmake install" and then end up moving the executable from /usr/local/games to /usr/local/bin and the man page from /usr/local/man to /usr/local/man/man6 because that's how I have my paths set up. Done!

For xgalaga, I used the same "fixed" environment variables as Powermanga which includes /usr/lib32 on the linker flags. Configure goes smoothly, but I get a long string of errors similar to:

d32: ERROR 33 : Unresolved text symbol "XFreeCursor" -- 1st referenced by libsprite/libsprite.a(cursor.o). Use linker option -v to see when and which objects, archives and dsos are loaded.

This means that a function call has been made, but it can't find the library where the function lives. I happen to know this is a standard X11 function, but if you didn't, just "man functionname" to see if it SHOULD be on your system (alternately search in the /usr/include or /usr/freeware/include headers using grep). If found, it's just another path problem. In this case, I read in the INSTALL file included in the distribution that only recently has the GNU autoconfigure build feature been implemented, so it possible that the script is wrong. I don't know autoconfigure (should learn), so I go directly to the Makefile that got built when I ran configure.

Well, line 29 reads:

LIBS = -L -lX11 -lXmu -lXt -lXext -lXpm libsprite/libsprite.a

This is actually an error since linkers (which read from left to right and "-lA -lB" will work if libA depends on libB, but not the other way around). In this case, all the library dependencies are backwards (i.e. Xtoolkit and Xextensions need the X11 functions) so to change it to

LIBS = -L libsprite/libsprite.a -lXpm -lXext -lXt -lXmu -lX11

and then rebuild (don't re-configure, it will just erase the changes you just made to the makefile!). Now xgalaga compiles! I run it directory from the build directory and verify it works. It ends up the "install" script bombs and I have to change the configure prefix to --prefix=/usr/local/games/xgalaga re-configure, rebuild and manually move the support directories, but that doesn't happen too often.

That's it!

Anyway, I hope you didn't find this too elementary and boring. Here are the binaries in tardist format (another topic).


Let me know if there are any play-ability issues.

Everybody to the Limit! :)

About this Entry

This page contains a single entry by squeen published on October 23, 2003 9:07 AM.

Software Updates was the previous entry in this blog.

pureftpd 1.0.16b is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.