'How to compile 32-bit programs in linux 64-bit environment

When I made lab1 of mit6.828, I tried to make the official lab file, and an error occurred

+ld obj/kern/kernel
ld: warning: section '.bss' type changed to PROGBITS
ld: obj/kern/printfmt.o: in function 'printnum':
lib/printfmt.c:41: undefined reference to '__udivdi3'
ld: lib/printfmt.c:49: undefined reference to '__umoddi3'
make: *** [kern/Makefrag:71: obj/kern/kernel]

My qemu is already installed and can be used, I guess it should be a compilation problem. The official said that this is because of the lack of a 32-bit compiler, and the gcc-mutilib package needs to be installed But I still can't compile normally after installation, and the same error is reported

My multi-architecture is enabled, and the compilation tools are also installed

gcc-mutilib & g++-mutilib are installed



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source