Thursday, January 7, 2010

Compiling Inferno

Compiling Inferno is little more complicated than installation process.
Web-page for downloading code is here.

Here are the steps I followed.

wget http://www.vitanuova.com/dist/4e/inferno-20091215.tgz
gunzip inferno-20091215.tgz
tar -xvf inferno-20091215.tar
cd inferno


Edit mkconfig file to suit your requirements.
Here is my file

#
# Set the following 4 variables. The host system is the system where
# the software will be built; the target system is where it will run.
# They are almost always the same.

# On Nt systems, the ROOT path MUST be of the form `drive:/path'
ROOT=/home/pravin/projects/inferno/compile/inferno/

#
# Specify the flavour of Tk (std for standard builds)
#
TKSTYLE=std

#
# Except for building kernels, SYSTARG must always be the same as SYSHOST
#
SYSHOST=Linux # build system OS type (Hp, Inferno, Irix, Linux, MacOSX, Nt, Plan9, Solaris)
SYSTARG=$SYSHOST # target system OS type (Hp, Inferno, Irix, Linux, Nt, Plan9, Solaris)

#
# specify the architecture of the target system - Plan 9 imports it from the
# environment; for other systems it is usually just hard-coded
#
#OBJTYPE=386 # target system object type (eg, 386, arm, mips, power, s800, sparc)
OBJTYPE=386

#
# no changes required beyond this point
#
OBJDIR=$SYSTARG/$OBJTYPE

<$ROOT/mkfiles/mkhost-$SYSHOST # variables appropriate for host system
<$ROOT/mkfiles/mkfile-$SYSTARG-$OBJTYPE # variables used to build target object type


Make sure that the ROOT points to the directory created as output of previous tar command.
You also need to add inferno/Linux/386/bin/ path to your $PATH variable.

Once this setup is done then you can compile it by going in emu directory and running mk.

export PATH=$PATH:`pwd`/Linux/386/bin
mk install


In my case, it gave lot of errors :-(
Following is the output of above command till fist few errors.

[emu]$ mk
(cd Linux; mk all)
for i in emu
do
mk 'CONF='$i default
done
cc -c -m32 asm-386.S
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 os.c
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 segflush-386.c
/bin/sh ../port/mkroot emu
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 -I. ../port/lock.c
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 cmd.c
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 -I. ../port/devmnt.c
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 -I. ../port/ipif-posix.c
cc -c -m32 -DROOT="/home/pravin/projects/inferno/compile/inferno/" -DEMU -I. -I../port -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/home/pravin/projects/inferno/compile/inferno//libinterp -g -O -I/home/pravin/projects/inferno/compile/inferno//Linux/386/include -I/home/pravin/projects/inferno/compile/inferno//include -I/usr/X11R6/include -DLINUX_386 -I. ../port/win-x11a.c
../port/win-x11a.c:36:22: error: X11/Xlib.h: No such file or directory
../port/win-x11a.c:37:23: error: X11/Xatom.h: No such file or directory
../port/win-x11a.c:38:23: error: X11/Xutil.h: No such file or directory
../port/win-x11a.c:39:24: error: X11/keysym.h: No such file or directory
../port/win-x11a.c:40:33: error: X11/extensions/XShm.h: No such file or directory
In file included from ../port/win-x11a.c:42:


On googling little-bit, It seemed that some package is missing.
I installed following packages, and it compiled for me.

sudo apt-get install libx11-dev libxmu-dev libxmu-headers

This is not exact list. All three may not be needed. But with these three installed, compilation does work fine :-).

No comments:

Post a Comment