Stream: general

Topic: how can I test on a big endian platform?

Jake Goulding (Jul 28 2019 at 17:45, on Zulip):

In twox-hash, I do some bit-banging work. I'm all but certain that I've screwed something up with respect to big- and little-endian, but I only have access to my x86 little-endian laptop, so I can't test to be sure.

Is there some big-endian emulator setup that I can run Rust code in?

RalfJ (Jul 28 2019 at 18:08, on Zulip):

if you are using Linux, you can use qemu to run binaries for pretty much any architecture

RalfJ (Jul 28 2019 at 18:09, on Zulip):

if you are not using Linux I guess you could run it in a VM^^

RalfJ (Jul 28 2019 at 18:10, on Zulip):

qemu-binfmt is pretty cool:
with that, you can literally ./binary for binaries that have the "wrong" architecture, and it will transparently use qemu to run it (you need the dynamic linker and libs for that architecture obviously, but at least on debian, thanks to multiarch that all is fairly easyto set up)

RalfJ (Jul 28 2019 at 18:12, on Zulip):

alternatively, you could use Miri :D but unfortunately cross-building libstd is not as easy as it could be (

RalfJ (Jul 28 2019 at 18:18, on Zulip):

Also see, I think it should be possible to make it easier to cross-run things with Miri.

nagisa (Jul 28 2019 at 18:59, on Zulip): has some big endian targets.

nagisa (Jul 28 2019 at 19:00, on Zulip):

MIPS and SPARC most notably.

Thom Chiovoloni (Jul 29 2019 at 00:28, on Zulip):

I've used in CI for things similar to this

Last update: Jul 16 2020 at 14:05UTC