linuxubuntuxv6

Error compiling xv6 in Ubuntu(Makefile:124: recipe for target 'kernel' failed)


I tried to compile xv6 in my Ubuntu 18.04.3 using "make qemu-nox"

It failed with the following error. Can you give me some information about this error?

ld -m    elf_i386 -T kernel.ld -o kernel entry.o bio.o console.o exec.o file.o fs.o ide.o ioapic.o kalloc.o kbd.o lapic.o log.o main.o mp.o picirq.o pipe.o proc.o sleeplock.o spinlock.o string.o swtch.o syscall.o sysfile.o sysproc.o trapasm.o trap.o uart.o vectors.o vm.o  -b binary initcode entryother
trap.o: In function `tvinit':
/home/lee/OS-Homework/trap.c:23: undefined reference to `vectors'
/home/lee/OS-Homework/trap.c:24: undefined reference to `vectors'
Makefile:124: recipe for target 'kernel' failed
make: *** [kernel] Error 1

Solution

  • When linking, ld complains about the lack of vectors array which is generated by rule vectors.S

    vectors.S: vectors.pl
        perl vectors.pl > vectors.S
    

    It seems that it that this rule is not generated...

    To build vector.S just type make vectors.S before make qemu-nox, or even in one command:

    make vectors.S qemu-nox