Compiling Micropolis on Ubuntu

Download the Micropolis source (micropolis-activity-source.tgz) from http://www.donhopkins.com/home/micropolis/.

Install the following packages:

sudo apt-get install libx11-dev libxpm-dev x11proto-xext-dev libxext-dev


yacc Issue

Micropolis requires yacc to compile properly. Bison is the recommended replacement package for yacc however errors were generated and Micropolis would not compile. I used the FreeBSD package freebsd5-buildutils instead:

sudo apt-get install freebsd5-buildutils

Now extract the Micropolis source code:

tar -xzf micropolis-activity-source.tgz
gedit micropolis-activity/src/tclx/config.mk

Go to line 83 and change the yacc path to be /usr/lib/freebsd/yacc:

#------------------------------------------------------------------------------
# Definition of the compiler you want to use, as well as extra flags for the
# compiler and linker.  Also the yacc program you wish to use.
#
AR=ar
XCFLAGS=
XLDFLAGS=
YACC=/usr/lib/freebsd/yacc
#YACC=bison -b y

Patch the Micropolis Source Code

When running Micropolis the tiles are not displayed correctly (see comments). A patch exists that fixes the issue.

First download the patch from http://rmdir.de/~michael/micropolis_git.patch and place in the directory into the newly unzipped micropolis-activity/ directory.

Now run the patch:

patch -p1 < micropolis_git.patch

A successful patch will display the following:

patching file res/micropolis.tcl
patching file res/sounds/player
patching file res/weditor.tcl
patching file res/whead.tcl
patching file res/wmap.tcl
patching file res/wscen.tcl
patching file src/sim/g_bigmap.c
patching file src/sim/g_cam.c
patching file src/sim/g_map.c
patching file src/sim/g_smmaps.c
patching file src/sim/headers/sim.h
patching file src/sim/headers/view.h
patching file src/sim/makefile
patching file src/sim/s_disast.c
patching file src/sim/s_fileio.c
patching file src/sim/w_resrc.c
patching file src/sim/w_sim.c
patching file src/sim/w_sprite.c
patching file src/sim/w_tk.c
patching file src/sim/w_x.c
patching file src/tcl/tclenv.c
patching file src/tcl/tclunix.h
patching file src/tclx/ossupp/makefile
patching file src/tclx/src/tclxgdat.y
patching file src/tclx/src/tclxid.c
patching file src/tclx/src/tclxint.h
patching file src/tk/tkbind.c
patching file src/tk/tkcanvas.c
patching file src/tk/tkcolor.c
patching file src/tk/tkgrab.c
patching file src/tk/tkint.h
patching file src/tk/tkpixmap.c
patching file src/tk/tkscale.c
patching file src/tk/tkscrbar.c
patching file src/tk/tkwindow.c
patching file src/tk/tkwm.c

Compiling Micropolis

Now it is time to compile Micropolis. From a command prompt navigate to the directory in which you downloaded micropolis-activity-source.tgz and:

cd micropolis-activity/src
make && make install

This will install Micropolis in the micropolis-activity/res/ directory. To run Micropolis ensure that you are in the micropolis-activity/ directory and run:

./Micropolis
NOTE: I managed to get the source to compile however initially there was a huge issue when running Micropolis. I could not interact with the interface in any fashion. I was unable to click on any buttons, enter text, or even close the window. Any mouse or keyboard activity did nothing. The issue is with a weird bug when the num-lock key is on (see comments). Turning off the num-lock solves the issue.

Error Messages:

Missing X11/ files

In file included from main.c:20:
tkconfig.h:54:22: error: X11/Xlib.h: No such file or directory
tkconfig.h:55:28: error: X11/cursorfont.h: No such file or directory
tkconfig.h:59:27: error: X11/Xresource.h: No such file or directory
tkconfig.h:60:23: error: X11/Xutil.h: No such file or directory
In file included from main.c:21:
tkint.h:25:25: error: X11/Xlibint.h: No such file or directory

Install libx11-dev:

sudo apt-get install libx11-dev

Missing xpm.h

tkpixmap.c:44:17: error: xpm.h: No such file or directory
tkpixmap.c: In function ‘Tk_GetPixmap’:
tkpixmap.c:164: error: ‘XpmAttributes’ undeclared (first use in this function)
tkpixmap.c:164: error: (Each undeclared identifier is reported only once
tkpixmap.c:164: error: for each function it appears in.)
tkpixmap.c:164: error: expected ‘;’ before ‘xpm_attributes’
tkpixmap.c:198: error: ‘xpm_attributes’ undeclared (first use in this function)
tkpixmap.c:201: error: ‘XpmVisual’ undeclared (first use in this function)
tkpixmap.c:201: error: ‘XpmColormap’ undeclared (first use in this function)
tkpixmap.c:201: error: ‘XpmDepth’ undeclared (first use in this function)

Install libxpm-dev:

sudo apt-get install libxpm-dev

Missing XShm.h

In file included from sim.c:62:
headers/sim.h:133:33: error: X11/extensions/XShm.h: No such file or directory
In file included from headers/sim.h:148,
                 from sim.c:62:
headers/view.h:182: error: expected specifier-qualifier-list before ‘XShmSegmentInfo’

Install x11proto-xext-dev:

sudo apt-get install x11proto-xext-dev

Cannot find -lXext

/usr/bin/ld: cannot find -lXext
collect2: ld returned 1 exit status

Install libxext-dev:

sudo apt-get install libxext-dev

Missing yacc

make[2]: yacc: Command not found
make[2]: *** [tclxgdat.c] Error 127

Instructions are here.

tclxgdat.y Compile Issues

tclxgdat.y:67.15: syntax error, unexpected =
tclxgdat.y:79.16: syntax error, unexpected =
tclxgdat.y:83.25: syntax error, unexpected =
tclxgdat.y:86.32-33: invalid $ value: $3
tclxgdat.y:88.32-33: invalid $ value: $3
tclxgdat.y:88.44-45: invalid $ value: $4
tclxgdat.y:90.32-33: invalid $ value: $3
tclxgdat.y:91.50-51: invalid $ value: $4
tclxgdat.y:91.62-63: invalid $ value: $4
tclxgdat.y:93.32-33: invalid $ value: $3
tclxgdat.y:93.41-42: invalid $ value: $5
tclxgdat.y:95.32-33: invalid $ value: $3
tclxgdat.y:95.41-42: invalid $ value: $5
tclxgdat.y:95.53-54: invalid $ value: $6
tclxgdat.y:97.32-33: invalid $ value: $3
tclxgdat.y:97.41-42: invalid $ value: $5
tclxgdat.y:98.50-51: invalid $ value: $6
tclxgdat.y:98.62-63: invalid $ value: $6
tclxgdat.y:100.14: syntax error, unexpected =
tclxgdat.y:105.13: syntax error, unexpected =
tclxgdat.y:110.40-41: invalid $ value: $2
tclxgdat.y:112.27: syntax error, unexpected =
tclxgdat.y:115.47-48: invalid $ value: $5
tclxgdat.y:119.47-48: invalid $ value: $4
tclxgdat.y:126.21: syntax error, unexpected =
make[2]: *** [tclxgdat.c] Error 1

Instructions are here.

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

THANK YOU SO MUCH!

I think I love you :)

This fixed a problem I was having with lEext missing!

I realize this article is

I realize this article is old, but it is important to point out that you must build-essentials first if you haven't done so yet.

sudo apt-get install build-essential

That should fix it.

Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.