DoctorWkt / xv6-freebsd

Ths project adds a FreeBSD libc, other libs and a runtime to the xv6 kernel
Other
65 stars 13 forks source link

linker (ld) error #2

Open markem1 opened 7 years ago

markem1 commented 7 years ago

I am getting this error when I make xv6. I am unsure where the issue is at. I'm compiling on an x86-64 Ubuntu system: Linux version 4.4.0-64-generic (buildd@lgw01-56) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017

gcc -fno-builtin -Wall -m32 -nostdinc -I../../include -msoft-float -fno-stack-protector -c -o cat.o cat.c cat.c: In function ‘raw_cat’: cat.c:235:14: warning: unused variable ‘sbuf’ [-Wunused-variable] struct stat sbuf; ^ cat.c: At top level: cat.c:44:13: warning: ‘sccsid’ defined but not used [-Wunused-variable] static char sccsid[] = "@(#)cat.c 5.15 (Berkeley) 5/23/91"; ^ ld -m elf_i386 -N -Ttext 0 -o cat cat.o ../../lib/libc.a /usr/lib/gcc/x86_64-linux-gnu/5/x32/libgcc.a ../../lib/libc.a(vfprintf.o): In function vfprintf': vfprintf.c:(.text+0x8e3): undefined reference toumoddi3' vfprintf.c:(.text+0x8fc): undefined reference to `udivdi3' Makefile:35: recipe for target 'cat' failed make[2]: [cat] Error 1 rm cat.o make[2]: Leaving directory '/u/markem/Classes/OS/XV6/FreeBSD/xv6-freebsd/cmd/simple' Makefile:2: recipe for target 'all' failed make[1]: [all] Error 2 make[1]: Leaving directory '/u/markem/Classes/OS/XV6/FreeBSD/xv6-freebsd/cmd' Makefile:21: recipe for target 'fs/cat' failed make: *** [fs/cat] Error 2

Thank you!

--mark

markem1 commented 7 years ago

Resolved. Wrong 32-bit library.

JetStarBlues commented 5 years ago

For those who have the same problem, the correct 32-bit library in this specific case is: /usr/lib/gcc/x86_64-linux-gnu/5/32/libgcc.a

Note the subtle difference of using the 32 subdirectory instead of x32