红联Linux门户
Linux帮助

ubuntu 15.04 comiling MIT JOS的问题:undefined reference to `

发布时间:2015-07-09 22:05:49来源:albertcn.blog.163.com作者:艾伯特的鸟屋

$make qemu
+ as kern/entry.S
+ cc kern/entrypgdir.c
+ cc kern/init.c
+ cc kern/console.c
+ cc kern/monitor.c
+ cc kern/printf.c
+ cc kern/kdebug.c
+ cc lib/printfmt.c
+ cc lib/readline.c
+ cc lib/string.c
+ ld obj/kern/kernel
obj/kern/printfmt.o: In function `printnum':
lib/printfmt.c:41: undefined reference to `__udivdi3'
lib/printfmt.c:49: undefined reference to `__umoddi3'
kern/Makefrag:70: recipe for target 'obj/kern/kernel' failed
make: *** [obj/kern/kernel] Error 1


解决:
sudo apt-get install gcc-4.8-multilib

$make clean; make
+ as kern/entry.S
+ cc kern/entrypgdir.c
+ cc kern/init.c
+ cc kern/console.c
+ cc kern/monitor.c
+ cc kern/printf.c
+ cc kern/kdebug.c
+ cc lib/printfmt.c
+ cc lib/readline.c
+ cc lib/string.c
+ ld obj/kern/kernel
+ as boot/boot.S
+ cc -Os boot/main.c
+ ld boot/boot
boot block is 377 bytes (max 510)
+ mk obj/kern/kernel.img