xinu-os / xinu

Repository for Xinu source code
http://xinu-os.org/
Other
432 stars 128 forks source link

Issues compiling x86 variant on Ubuntu 22.04 #34

Open nnathan opened 10 months ago

nnathan commented 10 months ago

Hi,

I'm trying to compile Xinu x86 on Ubuntu 22.04 with the provided gcc toolchain.

I get the following errors:

$ make
-e      Compiling ../system/initialize.o
-e      Installing ../lib/libxc.a
make[1]: Entering directory '/home/naveen/code/xinu/lib/libxc'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/naveen/code/xinu/lib/libxc'
-e      Linking xinu.elf
ld: ../system/udelay.o: in function `udelay':
/home/naveen/code/xinu/compile/../system/udelay.c:33: undefined reference to `clkcount'
ld: /home/naveen/code/xinu/compile/../system/udelay.c:45: undefined reference to `clkcount'
ld: /home/naveen/code/xinu/compile/../system/udelay.c:52: undefined reference to `clkcount'
ld: /home/naveen/code/xinu/compile/../system/udelay.c:54: undefined reference to `clkcount'
ld: ../apps/rdate.o: in function `getRdate':
/home/naveen/code/xinu/compile/../apps/rdate.c:33: undefined reference to `udpAlloc'
ld: /home/naveen/code/xinu/compile/../apps/rdate.c:38: undefined reference to `dot2ipv4'
ld: /home/naveen/code/xinu/compile/../apps/rdate.c:44: undefined reference to `ethertab'
ld: /home/naveen/code/xinu/compile/../apps/rdate.c:44: undefined reference to `netLookup'
ld: ../apps/timeserver.o: in function `timeServer':
/home/naveen/code/xinu/compile/../apps/timeserver.c:34: undefined reference to `udpAlloc'
ld: /home/naveen/code/xinu/compile/../apps/timeserver.c:43: undefined reference to `netLookup'
ld: ../lib/libxc.a(atol.o): in function `atol':
atol.c:(.text.atol+0x39): undefined reference to `__stack_chk_fail'
ld: ../lib/libxc.a(doprnt.o): in function `_doprnt':
doprnt.c:(.text._doprnt+0x472): undefined reference to `__stack_chk_fail'
ld: ../lib/libxc.a(fscanf.o): in function `fscanf':
fscanf.c:(.text.fscanf+0x3f): undefined reference to `__stack_chk_fail'
ld: ../lib/libxc.a(sprintf.o): in function `sprintf':
sprintf.c:(.text.sprintf+0x45): undefined reference to `__stack_chk_fail'
ld: ../lib/libxc.a(doscan.o): in function `_doscan':
doscan.c:(.text._doscan+0x50b): undefined reference to `__stack_chk_fail'
make: *** [Makefile:282: xinu.elf] Error 1

The udpAlloc it fixable by adding udp to DEVICES in the platforms/x86/platformVars.

I get the following compile issues this time around:

-e      Compiling ../system/initialize.o
-e      Compiling ../device/udp/udpAlloc.o
../device/udp/udpAlloc.c: In function ‘udpAlloc’:
../device/udp/udpAlloc.c:25:21: error: ‘NUDP’ undeclared (first use in this function)
   25 |     for (i = 0; i < NUDP; i++)
      |                     ^~~~
../device/udp/udpAlloc.c:25:21: note: each undeclared identifier is reported only once for each function it appears in
../device/udp/udpAlloc.c:31:24: error: ‘UDP0’ undeclared (first use in this function)
   31 |             return i + UDP0;
      |                        ^~~~

I can't find to see any symbol/reference to NUDP or UDP0 in the codebase, so I don't know how these get defined.

Furthermore I still have to sort out the linker errors for __stack_chk_fail and I've tried compiling with -fno-stack-protector to disable the stack canaries but the linker errors still persist.

Would appreciate some assistance, thank you.