0

I'm trying to compile some code statically (dosfstools) with GCC for i386, using -static and -march=i386, but the libraries, for example /usr/lib/i386-linux-gnu/libc.a, are not i386 despite the name. I tried compiling it under "debian-10.7.0-i386-netinst.iso" and "Fedora-14-i386-netinst.iso" but neither are i386 despite the name. How can I get true i386 libraries?

The resulting binary compiled with make CFLAGS="-march=i386" LDFLAGS="-march=i386 -static" doesn't run on an i586 machine, giving error 'Illegal instruction'. Command objdump mkfs.fat -D | grep cmove shows that the binary has cmove instructions, those instructions were not introduced until i686 so it's not an i386 binary that's being generated. The same thing can be seen running the command against /usr/lib/i386-linux-gnu/libc.a.

2
  • "neither are i386 despite the name" what are they, i686?
    – Fox
    Jan 14 '21 at 1:27
  • Yes, they're i686.
    – Luna
    Jan 14 '21 at 1:44
0

Linux distributions dropped support for real 386s a long time ago. To build binaries which will run on a real 386, you’ll have to either use an old distribution, or rebuild your toolchain and any libraries you need (assuming that such a setup can still be built nowadays).

The last Debian release with support for 386s was Debian 3.0 (Woody).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.