jserv/xv6-x86_64

ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)

anta40 opened this issue · 3 comments

I'm trying to build xv6-x86_64 on Debian testing 64 (gcc 12 is already installed)
Running make xv6.img yield this:

No rule to make target /.d
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -Os -o out/bootmain.o -c kernel/bootmain.c
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -o out/bootasm.o -c kernel/bootasm.S
ld -m elf_i386 -nodefaultlibs --omagic -e start -Ttext 0x7C00
-o out/bootblock.o out/bootasm.o out/bootmain.o
ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)
make: *** [Makefile:137: out/bootblock] Error 1

Fix it by replacing the -nodefaultlibs with -z nodefaultlib.

jserv commented

@Li-Guangda, Thanks for this information. Can you please send a pull request?

anta40 commented

@Li-Guangda Thanks. At least it fixed 1 issue. There are more issues, though.

Running make again gave you this:

user/sh.c: In function ‘runcmd’:
user/sh.c:58:1: error: infinite recursion detected [-Werror=infinite-recursion]

Whoops. Hmm quick Google search told me to remove -Werror from CFLAFS. Let's run make again. Got different error:

out/mkfs fs.img .fs/README .fs/cat .fs/chmod .fs/echo .fs/forktest .fs/grep .fs/init .fs/kill .fs/ln .fs/ls .fs/mkdir .fs/rm .fs/sh .fs/stressfs .fs/usertests .fs/wc .fs/zombie
nmeta 29 (boot, super, inode blocks 26, bitmap blocks 1) blocks 941 log 30 total 1000
mkfs: tools/mkfs.c:268: iappend: Assertion `fbn < MAXFILE' failed.
make: *** [Makefile:247: fs.img] Aborted
make: *** Deleting file 'fs.img'