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

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



Jun Sun <jsun@junsun.net> 于2019年12月29日周日 上午9:43写道:
>
> installing g++-mipsel-linux-gnu gives an error below.  Any suggestions?  Also, what is the recommended way to set up full 32bit dev environment on 64bit host if crossbuild is not the one?
>
> Jun
>
> root@debian-mips:/home/debian# apt install g++-mipsel-linux-gnu
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Package g++-mipsel-linux-gnu is not available, but is referred to by another package.
> This may mean that the package is missing, has been obsoleted, or
> is only available from another source
>
> E: Package 'g++-mipsel-linux-gnu' has no installation candidate

Ohh, sorry. you are on a mips64el system...
We don't have that compiler, while you can just
    apt install libc6-dev-mips32
    gcc -mabi=32

>
>
>
> On Sat, Dec 28, 2019 at 4:14 PM YunQiang Su <wzssyqa@gmail.com> wrote:
>>
>> Jun Sun <jsun@junsun.net> 于2019年12月29日周日 上午5:43写道:
>> >
>> > re-surfacing my own old thread ...
>> >
>> > On ARM, I was able to do something really simple to obtain complete 32bit development on a 64bit host:
>> >
>> > apt install -y build-essential    # this install 64bit dev environment
>> > apt install -y crossbuild-essential-armhf   # this install 32bit cross-dev environment
>> > apt install -y libc6:armhf
>> > apt install -y libstdc++6:armhf
>>
>> yep. we don't have the crossbuild-essential-mipsel package.
>> While for normal user, it is not useful at all.
>>
>> crossbuild-essential-armhf depends on g++-arm-linux-gnueabihf &&
>> gcc-arm-linux-gnueabihf
>>
>> So, you can do the same thing just by
>>    apt install g++-mipsel-linux-gnu   # gcc-mipsel-linux-gnu is not
>> needed, since g++ depeds on gcc.
>>
>> >
>> > However, similar steps don't work on mips64.  Specifically it is apparent  crossbuild-essential-mipsel dependency is broken, and if you try to fix the dependencies and it ended up conflicting with build-essential.
>> >
>> > Are there more better way to install a complete 32bit dev environment than what is mentioned earlier in this thread?
>> >
>> > Thanks!
>> >
>> > Jun
>> >
>> >
>> >
>> > On Sun, May 19, 2019 at 9:10 PM Jun Sun <jsun@junsun.net> wrote:
>> >>
>> >> 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
>>
>>
>>
>> --
>> YunQiang Su



-- 
YunQiang Su


Reply to: