Attempts to build a native edition fail under Linux x86_64

Issue #340 new
Ricky Curtice created an issue

Attempting to follow the instructions on http://doku.sphynkx.org.ua/links/plan9/native_inferno

Host platform: Kubuntu 14.04.2; 3.13.0-58-generic #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Steps taken: Edit mkconfig setting: (only showing changed lines)

    ROOT=/home/ricky/development/inferno-os

    SYSHOST=Linux
    SYSTARG=Linux

    OBJTYPE=386                     # target system object type (eg, 386, arm, mips, power, s800, sparc)
    #OBJTYPE=$objtype

Executed:

    $ ./makemk.sh

Edited mkconfig setting again:

    SYSTARG=Inferno

Executed: $ export PATH=/home/ricky/development/inferno-os/Linux/386/bin:$PATH $ mk -s nuke mkdirs install

At this point watched my CPU get eaten alive. Errors of sh: 2: cd: can't cd to Inferno and mk: echo "(cd $SYSTARG; ... : exit status=exit(1) abounded, which then finished off with a mk: for j in ... : exit status=exit(1) - not good.

A little poking around, mk install gives:

    (cd lib9; mk  install)
    warning: skipping missing include file: mkfile-Inferno: No such file or directory
    /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a doesn't exist: assuming it will be an archive
    8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convD2M.c
    sh: 1: 8c: not found
    mk: 8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include ...  : exit status=exit(127)
    mk: for j in ...  : exit status=exit(1)

I've done several other things, finding and grepping, reading mkfiles, and otherwise learning how the system's put together - to no avail.

My goal: get a working Inferno operating system running under a VirtualBox VM. The reason: I don't intend to make a hash of this Linux install by putting a mess of barely maintained 32bit compatibility libs and tools so that I can attempt to run Inferno in hosted mode - been there done that, reinstalled my OS and dropped the 32bit programs (Skype) that I was attempting to keep using. Better to put Inferno in its own container - and learn how to install it for real at the same time.

Comments (10)

  1. Александр Юричук

    You have to compile Inferno toolchain for Linux ( "mk install" with SYSTARGS=Linux), which part is 8c, to build Inferno kernel.

  2. Ricky Curtice reporter

    That fails because of a missing dependency of X11 libs... Even though I have them installed!

        cc -c -m32 -DROOT="/home/ricky/development/inferno-os" -DEMU -I. -I../port -I/home/ricky/development/inferno-os/Linux/386/include -I/home/ricky/development/inferno-os/include -I/home/ricky/development/inferno-os/libinterp -g -O -fno-strict-aliasing -fno-aggressive-loop-optimizations -Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit -I/home/ricky/development/inferno-os/Linux/386/include -I/home/ricky/development/inferno-os/include -DLINUX_386 -I. ../port/devroot.c
        cc -c -m32 -DROOT="/home/ricky/development/inferno-os" -DEMU -I. -I../port -I/home/ricky/development/inferno-os/Linux/386/include -I/home/ricky/development/inferno-os/include -I/home/ricky/development/inferno-os/libinterp -g -O -fno-strict-aliasing -fno-aggressive-loop-optimizations -Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit -I/home/ricky/development/inferno-os/Linux/386/include -I/home/ricky/development/inferno-os/include -DLINUX_386 '-DKERNDATE='1438610511 emu.c
        cc -m32  -o o.emu asm-386.o os.o kproc-pthreads.o segflush-386.o emu.root.o lock.o devmnt.o devsnarf.o devsrv.o srv.o ipif6-posix.o devmem.o devdraw.o devpipe.o devcmd.o cmd.o devssl.o devfs.o devcons.o devenv.o devprof.o devroot.o devprog.o devip.o devcap.o win-x11a.o devdup.o devpointer.o devindir.o deveia.o ipaux.o cache.o proc.o random.o error.o uqid.o qio.o discall.o inferno.o exception.o chan.o env.o devtab.o dis.o print.o dial.o exportfs.o main.o parse.o alloc.o latin1.o dev.o sysfile.o pgrp.o errstr.o emu.o /home/ricky/development/inferno-os/Linux/386/lib/libinterp.a /home/ricky/development/inferno-os/Linux/386/lib/libtk.a /home/ricky/development/inferno-os/Linux/386/lib/libfreetype.a /home/ricky/development/inferno-os/Linux/386/lib/libmath.a /home/ricky/development/inferno-os/Linux/386/lib/libdraw.a /home/ricky/development/inferno-os/Linux/386/lib/libmemlayer.a /home/ricky/development/inferno-os/Linux/386/lib/libmemdraw.a /home/ricky/development/inferno-os/Linux/386/lib/libkeyring.a /home/ricky/development/inferno-os/Linux/386/lib/libsec.a /home/ricky/development/inferno-os/Linux/386/lib/libmp.a /home/ricky/development/inferno-os/Linux/386/lib/lib9.a -lX11 -lXext -lm -lpthread
        /usr/bin/ld: cannot find -lX11
        /usr/bin/ld: cannot find -lXext
        collect2: error: ld returned 1 exit status
        mk: cc -c -m32 ...  : exit status=exit(1)
        mk: echo "(cd $SYSTARG; ...  : exit status=exit(1)
        mk: for j in ...  : exit status=exit(1)
    

    I do have the headers installed:

        $ sudo apt-get install libx11-dev libxext-dev libxpm-dev x11proto-xext-dev
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        libx11-dev is already the newest version.
        libxpm-dev is already the newest version.
        x11proto-xext-dev is already the newest version.
        libxext-dev is already the newest version.
    

    --- EDIT

    Just realized that's a linker error, not a compiler error. Which implies that building under native 64bit linux isn't working. Which leads back to my goals above.

  3. Ricky Curtice reporter

    Disabling emu\ in EMUDIRS=\ in the root mkfile gets me past that point and back pretty close to where I started, just this time with a working 8c:

        $ mk install
        (cd lib9; mk  install)
        warning: skipping missing include file: mkfile-Inferno: No such file or directory
        /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a doesn't exist: assuming it will be an archive
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convD2M.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convM2D.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convM2S.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convS2M.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include fcallfmt.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runestrchr.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runestrlen.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runetype.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include strtoll.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include strtoull.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include rune.c
        ar vu /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a convD2M.8 convM2D.8 convM2S.8 convS2M.8 fcallfmt.8 runestrchr.8 runestrlen.8 runetype.8 strtoll.8 strtoull.8 rune.8
        ar: no operation specified
        mk: ar vu /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a ...  : exit status=exit(1)
        mk: for j in ...  : exit status=exit(1)
    

    Seems like ar isn't being given the r option to actually put the files into the archive.

    Correcting mkfiles/mkfile-Inferno-386 to use ARFLAGS= ruvs gets me even further, but then I hit:

        (cd utils/iyacc; mk  install)
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include -I../include -DROOT="/home/ricky/development/inferno-os" -DPARSER="yaccpar" -DPARSERS="yaccpar" -o yacc.8 yacc.c
        yacc.c:4 8c: No such file or directory: ctype.h
        mk: 8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include ...  : exit status=exit(1)
    

    Hmmm... It's right there at /usr/include/ctype.h and a few other places under /usr. At this point I'm stumped again - why a system header can't be found is very odd, and my intuition and ability to pick up how this system is constructed needs sleep.

  4. Ricky Curtice reporter

    Disabling emu\ in EMUDIRS=\ in the root mkfile gets me past that point and back pretty close to where I started, just this time with a working 8c:

        $ mk install
        (cd lib9; mk  install)
        warning: skipping missing include file: mkfile-Inferno: No such file or directory
        /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a doesn't exist: assuming it will be an archive
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convD2M.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convM2D.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convM2S.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include convS2M.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include fcallfmt.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runestrchr.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runestrlen.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include runetype.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include strtoll.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include strtoull.c
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include rune.c
        ar vu /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a convD2M.8 convM2D.8 convM2S.8 convS2M.8 fcallfmt.8 runestrchr.8 runestrlen.8 runetype.8 strtoll.8 strtoull.8 rune.8
        ar: no operation specified
        mk: ar vu /home/ricky/development/inferno-os/Inferno/386/lib/lib9.a ...  : exit status=exit(1)
        mk: for j in ...  : exit status=exit(1)
    

    Seems like ar isn't being given the r option to actually put the files into the archive.

    Correcting mkfiles/mkfile-Inferno-386 to use ARFLAGS= ruvs gets me even further, but then I hit:

        (cd utils/iyacc; mk  install)
        8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include -I../include -DROOT="/home/ricky/development/inferno-os" -DPARSER="yaccpar" -DPARSERS="yaccpar" -o yacc.8 yacc.c
        yacc.c:4 8c: No such file or directory: ctype.h
        mk: 8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include ...  : exit status=exit(1)
    

    Hmmm... It's right there at /usr/include/ctype.h and a few other places under /usr. At this point I'm stumped again - why a system header can't be found is very odd, and my intuition and ability to pick up how this system is constructed needs sleep.

  5. Александр Юричук

    Look at this link Inferno on Virtualbox. I have compiled native Inferno OS by this instruction. If you have "8*" toolchain working on your host system (Linux) you may try to compile Inferno kernel:

    cd os/pc
    mk
    

    By the way. From this. "... Since your Ubuntu system is 64-bit and you're compiling a 32-bit program which must link against the 32-bit version of the library, you'll probably need to install the 32-bit version of libx11-dev. If you're installing with apt-get or aptitude, you can specify that by indicating libx11-dev:i386 as the package to install (since multarch is supported and being used). ... "

  6. Ricky Curtice reporter

    Thank you for the first link Alex! My Google fu doesn't extend outside of English I'm afraid, so I'd missed that. Though I'm still not sure why it's missing ctype.h...

    WRT to installing the 32bit libs, yes, I could have installed those. However I didn't want to, as stated in the OP. So instead I get to learn a bit about how the build system works - essential knowledge for my future with Inferno. I'm hoping that the end result of this bug report is a patch or series of patches that help to streamline, or at least document in a central location, this process. I've been preparing a wiki entry as I go along.

    -- Edit: Looks like it's even worse: the system ctype.h brings in the system features.h, which uses a precompiler statement that causes 8c to choke. Now I'm even more confused as to what and where a compatible #include <ctype.h> is supposed to be found. Here's what I did:

    cd utils/iyacc/
    8c -wFVT -I/home/ricky/development/inferno-os/Inferno/386/include -I/home/ricky/development/inferno-os/Inferno/include -I/home/ricky/development/inferno-os/include -I../include -I/usr/include -DROOT="/home/ricky/development/inferno-os" -DPARSER="yaccpar" -DPARSERS="yaccpar" -o yacc.8 yacc.c
    

    With the result:

        /usr/include/features.h:141 /usr/include/ctype.h:25 yacc.c:3 unknown #: if
        /usr/include/features.h:179 /usr/include/ctype.h:25 yacc.c:3 unknown #: if
        /usr/include/features.h:180 /usr/include/ctype.h:25 yacc.c:3 syntax error, last name: if
    

    The first failing line looks like #if defined __GNUC__ && defined __GNUC_MINOR__. Not surprising that 8c can't handle something designed for GCC, but... Where's the right ctype.h?

  7. Ricky Curtice reporter

    Trying to bypass the cmake.h problem by following the linked instructions, which are themselves an expansion of https://umdrive.memphis.edu/blstuart/htdocs/inf_native.html

    However this route also terminates in strange and weird errors - PWD is os/pc:

        8l -o ipc -T0x80100020 -l l.8 fpsave.8 portclock.8 tod.8 i8250.8 i8253.8 i8259.8 kbd.8 main.8 memory.8 mmu.8 trap.8 pc.root.8 tcp.8 udp.8 ipifc.8 icmp.8 icmp6.8 ipmux.8 devroot.8 devcons.8 devarch.8 devenv.8 devmnt.8 devpipe.8 devprog.8 devrtc.8 devsrv.8 devdup.8 devssl.8 devcap.8 devdraw.8 devpointer.8 devvga.8 devip.8 devether.8 devaudio.8 devuart.8 devtinyfs.8 ether2114x.8 ether79c970.8 ether83815.8 etherelnk3.8 ps2mouse.8 alarm.8 alloc.8 allocb.8 chan.8 dev.8 dial.8 dis.8 discall.8 exception.8 exportfs.8 inferno.8 latin1.8 nocache.8 nodynld.8 parse.8 pgrp.8 print.8 proc.8 qio.8 qlock.8 random.8 sysfile.8 taslock.8 xalloc.8 vgas3.8 vgamach64xx.8 uarti8250.8 screen.8 vga.8 vgax.8 cga.8 bootp.8 ip.8 ipv6.8 ipaux.8 iproute.8 arp.8 netlog.8 ptclbsum386.8 iprouter.8 plan9.8 nullmedium.8 pktmedium.8 netif.8 netaux.8 ethermedium.8 dma.8 pci.8 vgasavage.8 pc.8 /home/ricky/development/inferno-os/Inferno/386/lib/libinterp.a /home/ricky/development/inferno-os/Inferno/386/lib/libkeyring.a /home/ricky/development/inferno-os/Inferno/386/lib/libdraw.a /home/ricky/development/inferno-os/Inferno/386/lib/libmemlayer.a /home/ricky/development/inferno-os/Inferno/386/lib/libmemdraw.a /home/ricky/development/inferno-os/Inferno/386/lib/libtk.a /home/ricky/development/inferno-os/Inferno/386/lib/libsec.a /home/ricky/development/inferno-os/Inferno/386/lib/libmp.a /home/ricky/development/inferno-os/Inferno/386/lib/libmath.a /home/ricky/development/inferno-os/Inferno/386/lib/libkern.a
        ??none??: /home/ricky/development/inferno-os/Inferno/386/lib/libsec.a: first entry not symbol header
        ??none??: /home/ricky/development/inferno-os/Inferno/386/lib/libmp.a: first entry not symbol header
        ??none??: /home/ricky/development/inferno-os/Inferno/386/lib/libmath.a: first entry not symbol header
        consread: undefined: genrandom
        initIDEAkey: undefined: setupIDEAstate
        initDESkey: undefined: setupDESstate
        initRC4key: undefined: setupRC4state
        encryptb: undefined: block_cipher
        encryptb: undefined: idea_cipher
        encryptb: undefined: rc4
        capwriteuse: undefined: hmac_sha1
        bigtobase64: undefined: mptobe
        ipcopymp: undefined: mpcopy
        base64tobig: undefined: betomp
        sign: undefined: sha1
        sign: undefined: md5
        sign: undefined: md4
        sign: undefined: mpfree
        Keyring_dhparams: undefined: mpnew
        Keyring_dhparams: undefined: DSAprimes
        Keyring_dhparams: undefined: gensafeprime
        too many errors
    

    -- Edit - solved: Apparently I had to manually rm the three mentioned .a files.

  8. Ricky Curtice reporter

    After much further work, attempting to follow above linked instructions I find that the instructions assume a working emu. I do not have one and cannot currently have one as long as emu cannot be compiled for native 64bit under Linux and I refuse to risk my system stability by going multarch. So I'm going to bypass that for now via a VirtualBox 32bit Linux environment. Quite a hack - but that's been the name of the game thus far. To me it seems that native Inferno has way too many hoops - it's high time for some ready-to-go installation images: one of my secondary goals in fact.

  9. Log in to comment