[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compile 32bit MIPS program on 64bit MIPS - possible?



This is very cool!  It worked!  Thanks.

For a complete record here is what I did:
dpkg --add-architecture mipsel
apt-get update 
apt-get install gcc-multilib
 

Earlier I was using "-m32" option which was not recognized. but  -march=mips32 -mabi=32 worked just fine.

Also, just for the record, if one likes to install 32bit library later, you would just add ":mipsel" to the package name.  For example, you would do "apt install zlib1g:mipsel" to install 32bit version of zlib.

Cheers.

Jun


On Sun, May 19, 2019 at 5:55 PM YunQiang Su <wzssyqa@gmail.com> wrote:
Jun Sun <jsun@junsun.net> 于2019年5月20日周一 上午7:42写道:
>
> Recently I came across a piece of great work by blahcat who created 64bit MIPSEL debian image that runs on qemu.  See  https://blahcat.github.io/2017/07/14/building-a-debian-stretch-qemu-image-for-mipsel/
>
> I tried to install multilib in the hope to compile 32bit mips code on this 64bit machine.  But it does not seem to work.
>
how did you install it?
it should be done like:

apt-get install libc6-dev-mips32 gcc
   and
gcc -march=mips32 -mabi=32 xx.c

If your app needs libc only, it is enough.

> Does anybody know for sure whether this is a dead end or just a hiccup which I should overcome?

If your app depends on more libraries, you may need to use an mipsel
env, or use multiarch.
https://wiki.debian.org/Multiarch/HOWTO

>
> Thanks.
>
> Jun



--
YunQiang Su

Reply to: