Helping a noob getting inferno-os to compile on modern Linux (nixos)

45 views
Skip to first unread message

Charles Langlois

unread,
Mar 25, 2026, 9:14:58 PM (14 days ago) Mar 25
to inferno-os
Hi.
Been interested in Plan 9 & inferno os for a while. Been rediscovering those wonders recently.

So now I'm trying to get inferno os emulator to compile on my nixos (Linux, 64 bit) machine.

I'm pretty much a noob at low-level / system programming / C stuff (I'm a python developer), trying to learn and get better.

Not sure when's the last time someone got inferno emulator to compile on a "modern" system? 

I'm trying to setup a working build environment (using nix to pull in the right dependencies), but getting all kinds of compile / linking errors, mostly missing includes (undeclared functions).
Can't help but think my environment is not setup properly, either I'm not using the right packages or not setting the right CFLAGS or LD environment or something similar? 

Tried building the Dockerfile as well, also doesn't work.

Tweaked some configs and added missing includes in some files, got emu to build but it segfaults on run so I'm not there yet.

If someone got it to build and run on a linux system recently, advice would be appreciated.

Thanks all, hope this project continues to survive and keep inspiring similar ones!


Caerwyn Jones

unread,
Mar 25, 2026, 9:23:27 PM (14 days ago) Mar 25
to Charles Langlois, inferno-os
Hi Charles,

I recommend using the inferno64 fork at https://github.com/caerwynj/inferno64. I build and use it regularly.

There is also a MinGW branch for running on Windows and a Termux branch that I use for building on Android.

Best regards,
Caerwyn Jones


--
You received this message because you are subscribed to the Google Groups "inferno-os" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inferno-os+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/inferno-os/cf983f98-0738-4bac-b843-c5e82af8a59fn%40googlegroups.com.

Charles Langlois

unread,
Mar 25, 2026, 10:07:33 PM (14 days ago) Mar 25
to inferno-os
Hi Caerwynj, thanks for the heads up, I'll try this out.

I got the Dockerfile from the repo to build actually, but running the image segfaults.

Take care,

Charles Langlois

unread,
Mar 25, 2026, 10:33:55 PM (14 days ago) Mar 25
to inferno-os
Do we know which compiler version works? Trying to compile with gcc 13 or 14 gives me errors:

| create.c: In function ‘create’:
| create.c:26:20: error: implicit declaration of function ‘mkdir’ [-Wimplicit-function-declaration]
| 26 | if(mkdir(f, perm&0777) < 0)

Charles Langlois

unread,
Mar 26, 2026, 7:44:16 AM (13 days ago) Mar 26
to inferno-os
Success, i got inferno64 to compile and run! Just had to specify some compiler flags to ignore some errors.

You received this message because you are subscribed to a topic in the Google Groups "inferno-os" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/inferno-os/MvynWx2xNdQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to inferno-os+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/inferno-os/413d3b09-cfbe-4012-849e-7bfcae3cda5fn%40googlegroups.com.

Charles Forsyth

unread,
Mar 26, 2026, 10:01:57 AM (13 days ago) Mar 26
to reply...@charleslanglois.dev, inferno-os
There are several variants like this, and it would be sensible to bring them all together in the (old, 32-bit) github repo.
I might finally take time to do that.

Hendrik Boom

unread,
Mar 26, 2026, 11:24:43 AM (13 days ago) Mar 26
to infer...@googlegroups.com
On Wed, Mar 25, 2026 at 06:14:58PM -0700, Charles Langlois wrote:
> Hi.
> Been interested in Plan 9 & inferno os for a while. Been rediscovering
> those wonders recently.
>
> So now I'm trying to get inferno os emulator to compile on my nixos (Linux,
> 64 bit) machine.
>
> I'm pretty much a noob at low-level / system programming / C stuff (I'm a
> python developer), trying to learn and get better.
>
> Not sure when's the last time someone got inferno emulator to compile on a
> "modern" system?

I tried to do that on a 32-bit Debian linux years ago and succeeded.
But I couldn't figure out what to do with the inferno afterward.

Staartine with Linux was coparrtively esy, since I already had Unix
experience daating from the 1070's.

Bu that didn't seem to help with the inferno I ended up with.

-- hendrik
xs

Valery Ushakov

unread,
Mar 26, 2026, 8:25:42 PM (13 days ago) Mar 26
to inferno-os
Pretty please... (:ShrekCatEyes:)

I have a few PRs for JIT fixes (on arm and power) and for NetBSD/sparc host support.

da...@boddie.org.uk

unread,
Mar 27, 2026, 7:47:43 AM (12 days ago) Mar 27
to inferno-os
Sorry, I tried to review the ARM ones but, although they look fine to me,
I couldn't be certain that I understood them properly and I didn't have the
time to test them.

Charles Langlois

unread,
Mar 28, 2026, 1:56:22 PM (11 days ago) Mar 28
to inferno-os
For reference, using the caerwyn/inferno64 fork, I had to apply this diff to get gcc 14 to swallow it.

# -----------------------------------------------------------------
diff --git a/makemk.sh b/makemk.sh
index 00b4a52b..edc68d3f 100755
--- a/makemk.sh
+++ b/makemk.sh
@@ -19,7 +19,7 @@ grep -s 'SYSTARG=Plan9' mkconfig || . ./mkconfig
 PLAT=$ROOT/$SYSTARG/$OBJTYPE
 
 # you might need to adjust the CC, LD, AR, and RANLIB definitions after this point
-CC="p cc -c -I$PLAT/include -I$ROOT/include -I$ROOT/utils/include"
+CC="p cc -c -Wno-error=implicit-function-declaration -std=gnu11 -I$PLAT/include -I$ROOT/include -I$ROOT/utils/include"
 LD="p cc "
 AR="p ar crvs"
 RANLIB=":" # some systems still require `ranlib'
diff --git a/mkfiles/mkfile-Linux-amd64 b/mkfiles/mkfile-Linux-amd64
index 03a47535..c232ca75 100644
--- a/mkfiles/mkfile-Linux-amd64
+++ b/mkfiles/mkfile-Linux-amd64
@@ -13,10 +13,13 @@ ASFLAGS=
 
 CC= cc -c
 CFLAGS= -g\
+ -Wno-error=implicit-function-declaration\
+ -Wno-error=implicit-int\
+ -Wno-error=incompatible-pointer-types\
+ -std=gnu11\
  #-O\
  -fno-strict-aliasing\
  -fno-aggressive-loop-optimizations\
- -Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit\
  -I$ROOT/Linux/amd64/include\
  -I$ROOT/include\
  -DLINUX_AMD64\

Charles Forsyth

unread,
Mar 29, 2026, 7:53:16 PM (10 days ago) Mar 29
to Charles Langlois, inferno-os
the first two look like something has very old C code, which should be changed.
can you paste here the code that it was complaining about, if not vast?


Charles Langlois

unread,
Mar 29, 2026, 10:18:25 PM (10 days ago) Mar 29
to inferno-os
One of them is limbo.c:
gcc -c -m32 -DINCPATH="/home/drpyser/projects/inferno-os/inferno-os/module" -g -O -fno-strict-aliasing -fno-aggressive-loop-optimizations -Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit -I/home/drpyser/projects/inferno-os/inferno-os/Linux/386/include -I/home/drpyser/projects/inferno-os/inferno-os/include -D_GNU_SOURCE -fcommon -DLINUX_386 -o y.tab.o y.tab.c
limbo.y: In function ‘win2inf’:
limbo.y:1938:30: error: implicit declaration of function ‘tolower’ [-Wimplicit-function-declaration]
 1938 |                         *t = tolower(*t);
      |                              ^~~~~~~
limbo.y:3:1: note: include ‘<ctype.h>’ or provide a declaration of ‘tolower’
    2 | #include "limbo.h"
  +++ |+#include <ctype.h>
    3 | %}

Another when building mk (lib9.c):
---
gcc -c -D_GNU_SOURCE -DROOT="/home/drpyser/projects/inferno-os/inferno-os" -I/home/drpyser/projects/inferno-os/inferno-os/Linux/386/include -I/home/drpyser/projects/inferno-os/inferno-os/include -I/home/drpyser/projects/inferno-os/inferno-os/utils/include dirstat-posix.c rerrstr.c errstr-posix.c getuser-posix.c charstod.c cleanname.c create.c dirwstat.c fmtprint.c fmtvprint.c fprint.c print.c runeseprint.c runesmprint.c runesnprint.c runevseprint.c seprint.c smprint.c snprint.c sprint.c vfprint.c vseprint.c vsmprint.c vsnprint.c dofmt.c dorfmt.c errfmt.c fcallfmt.c fltfmt.c fmt.c fmtfd.c fmtlock.c fmtprint.c fmtquote.c fmtrune.c fmtstr.c fmtvprint.c exits.c getfields.c pow10.c print.c qsort.c rune.c runestrlen.c seek.c strdup.c strtoll.c utflen.c utfrrune.c utfrune.c utfecpy.c utflen.c utfnlen.c utfrrune.c utfrune.c strecpy.c

create.c: In function ‘create’:
create.c:26:20: error: implicit declaration of function ‘mkdir’ [-Wimplicit-function-declaration]
   26 |                 if(mkdir(f, perm&0777) < 0)
      |                    ^~~~~
lib9 compilation failed


I also have linking errors in the original repository so I have to add more stuff to CFILES like "argv0" and "nulldir":
---
/nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld: mkext.o: in function `error':
mkext.c:(.text+0x27c): undefined reference to `argv0'
/nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld: mkext.o: in function `warn':
mkext.c:(.text+0x32c): undefined reference to `argv0'
/nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld: mkext.o: in function `extmkdir':
mkext.c:(.text+0x411): undefined reference to `nulldir'
/nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld: mkext.o: in function `extract':
mkext.c:(.text+0x7b1): undefined reference to `nulldir'
/nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld: mkext.o: in function `main':
mkext.c:(.text.startup+0x4d): undefined reference to `argv0'


Might not be exhaustive.

Valery Ushakov

unread,
Mar 30, 2026, 12:30:25 PM (9 days ago) Mar 30
to inferno-os
You seem to be building Plan9 version (arg0 and nulldir are omitted from lib9 there)

Charles Langlois

unread,
Mar 30, 2026, 1:52:24 PM (9 days ago) Mar 30
to Valery Ushakov, inferno-os
This issue is for buildmk.sh, not for an arch-specific build.

But if your point is that this is a normal required change for a Linux build, point taken (it could be documented perhaps). 
Maybe i misunderstand the proper way to setup a build on linux? 
I understand mkconfig needs to be customized for the build platform, but is not used by buildmk.sh.

Valery Ushakov

unread,
Mar 30, 2026, 2:52:30 PM (9 days ago) Mar 30
to infer...@googlegroups.com
On Mon, Mar 30, 2026 at 13:52:09 -0400, Charles Langlois wrote:

> This issue is for buildmk.sh, not for an arch-specific build.
[...]
> >> I also have linking errors in the original repository so I have to add
> >> more stuff to CFILES like "argv0" and "nulldir":
> >> ---
> >> /nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld:
> >> mkext.o: in function `error':
> >> mkext.c:(.text+0x27c): undefined reference to `argv0'
> >> /nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld:
> >> mkext.o: in function `warn':
> >> mkext.c:(.text+0x32c): undefined reference to `argv0'
> >> /nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld:
> >> mkext.o: in function `extmkdir':
> >> mkext.c:(.text+0x411): undefined reference to `nulldir'
> >> /nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld:
> >> mkext.o: in function `extract':
> >> mkext.c:(.text+0x7b1): undefined reference to `nulldir'
> >> /nix/store/k437vl1310idx166rwfad9ydggs7pdxj-binutils-2.44/bin/ld:
> >> mkext.o: in function `main':
> >> mkext.c:(.text.startup+0x4d): undefined reference to `argv0'
[...]
> But if your point is that this is a normal required change for a Linux
> build, point taken (it could be documented perhaps).
> Maybe i misunderstand the proper way to setup a build on linux?
> I understand mkconfig needs to be customized for the build platform, but is
> not used by buildmk.sh.

The above failure (missing argv0 and nulldir) is not from building the
boostrapping mk by makemk.sh.

It seems that you forgot to edit mkconfig and you ended up building
with SYSHOST=Plan9 that is set there as it's shipped. plan9 does not
include argv0.c and nulldir.c in lib9. Note that:

$ grep IMPORTFILES lib9/mkfile*
lib9/mkfile:IMPORTFILES=\
lib9/mkfile-Nt: $IMPORTFILES\
lib9/mkfile-Posix: $IMPORTFILES\

it's not in mkfile-Plan9
> >>>>> <https://github.com/inferno-os/inferno-os> to build actually, but
> >>>>> <https://groups.google.com/d/msgid/inferno-os/cf983f98-0738-4bac-b843-c5e82af8a59fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>>>> .
> >>>>>
> >>>>> --
> >>>>> You received this message because you are subscribed to a topic in the
> >>>>> Google Groups "inferno-os" group.
> >>>>> To unsubscribe from this topic, visit
> >>>>> https://groups.google.com/d/topic/inferno-os/MvynWx2xNdQ/unsubscribe.
> >>>>> To unsubscribe from this group and all its topics, send an email to
> >>>>> inferno-os+...@googlegroups.com.
> >>>>> To view this discussion, visit
> >>>>> https://groups.google.com/d/msgid/inferno-os/413d3b09-cfbe-4012-849e-7bfcae3cda5fn%40googlegroups.com
> >>>>> <https://groups.google.com/d/msgid/inferno-os/413d3b09-cfbe-4012-849e-7bfcae3cda5fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>>>> .
> >>>>>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google
> >>>>> Groups "inferno-os" group.
> >>>>> To unsubscribe from this group and stop receiving emails from it, send
> >>>>> an email to inferno-os+...@googlegroups.com.
> >>>>>
> >>>>> To view this discussion, visit
> >>>>> https://groups.google.com/d/msgid/inferno-os/CAAztV6%3DzBy%2BWp84Ci5PJ1r73UsOp0tX%2Bmvp0TBgKi9VyJpfYUQ%40mail.gmail.com
> >>>>> <https://groups.google.com/d/msgid/inferno-os/CAAztV6%3DzBy%2BWp84Ci5PJ1r73UsOp0tX%2Bmvp0TBgKi9VyJpfYUQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> >>>>> .
> >>>>>
> >>>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "inferno-os" group.
> >>>> To unsubscribe from this group and stop receiving emails from it, send
> >>>> an email to inferno-os+...@googlegroups.com.
> >>>>
> >>> To view this discussion, visit
> >>>> https://groups.google.com/d/msgid/inferno-os/dde13892-016c-4260-8a89-f63632f29426n%40googlegroups.com
> >>>> <https://groups.google.com/d/msgid/inferno-os/dde13892-016c-4260-8a89-f63632f29426n%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>>> .
> >>>>
> >>> --
> > You received this message because you are subscribed to a topic in the
> > Google Groups "inferno-os" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/d/topic/inferno-os/MvynWx2xNdQ/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> > inferno-os+...@googlegroups.com.
> > To view this discussion, visit
> > https://groups.google.com/d/msgid/inferno-os/60d5f615-d47a-4c75-931b-7e115924f369n%40googlegroups.com
> > <https://groups.google.com/d/msgid/inferno-os/60d5f615-d47a-4c75-931b-7e115924f369n%40googlegroups.com?utm_medium=email&utm_source=footer>
> > .
> >

-uwe

Charles Langlois

unread,
Mar 30, 2026, 8:28:49 PM (9 days ago) Mar 30
to inferno-os
Oh, you're perfectly right Valery, I got badly confused, sorry.
I had actually modified makemk.sh to rebuild the bundled bootstrapping binaries (mkext, data2c, iyacc) because I though the bundled binaries were not working on my system (nixos can introduce some pain around shared libraries for unpatched binaries). That's why I had those linker errors while running makemk.sh. 
Turns out, by only fixing the implicit-function-declaration errors, makemk.sh builds mk without issues with those binaries, so I had ran myself into circles. 

Charles Langlois

unread,
Mar 30, 2026, 8:49:36 PM (9 days ago) Mar 30
to inferno-os
Alright, here's another actual compile error:

$ utils.c: In function ‘tksorttable’:
utils.c:1622:58: error: passing argument 4 of ‘infqsort’ from incompatible pointer type [-Wincompatible-pointer-types]
 1622 |                 qsort(c->cmd, c->ncmd, sizeof(TkCmdtab), qcmdcmp);
      |                                                          ^~~~~~~
      |                                                          |
      |                                                          int (*)(const void *, const void *)
In file included from utils.c:1:
/home/drpyser/projects/inferno-os/inferno-os/Linux/386/include/lib9.h:279:42: note: expected ‘int (*)(void *, void *)’ but argument is of type ‘int (*)(const void *, const void *)’
  279 | extern  void    qsort(void*, long, long, int (*)(void*, void*));
      |                                          ^~~~~~~~~~~~~~~~~~~~~
Reply all
Reply to author
Forward
0 new messages