rust-everywhere icon indicating copy to clipboard operation
rust-everywhere copied to clipboard

arm-linux: explore qemu _sytem emulation_ to run cargo test

Open japaric opened this issue 9 years ago • 3 comments

UPDATE

We are already using QEMU with user emulation to run cross compiled test suites. This issue is now about exploring running the cross compiled test suites under QEMU's system emulation.


https://github.com/rust-lang/libc does this, it uses qemu user emulation to run tests. But its docs mention:

Note that one downside of this QEMU system is that threads are barely implemented, so we're careful to not spawn many threads.

So we may also want to explore using qemu full system emulation if the user mode presents problems in practice.

japaric avatar Feb 23 '16 02:02 japaric

  • Why is this still open? The implementation is already merged, isn't it?
  • On my Debian system installing qemu-user-static and binfmt-support makes it possible to execute the arm binaries, so cargo test --target arm-unknown-linux-gnueabifh and corresponding run just work. It could be worth trying on Travis too to make the script simpler.

jan-hudec avatar Mar 16 '16 14:03 jan-hudec

Why is this still open? The implementation is already merged, isn't it?

I left this open to remind me of testing cargo test under qemu system. In general I want to experiment with building/testing cargo projects natively inside qemu but that's blocked on having official rustc binaries for tier 2/3 platforms (which I hope are coming soon)

On my Debian system installing qemu-user-static and binfmt-support makes it possible to execute the arm binaries, so cargo test --target arm-unknown-linux-gnueabifh and corresponding run just work.

Oh, interesting. Do you know if there are equivalent brew packages for osx?

It could be worth trying on Travis too to make the script simpler.

Yeah, I'll be up for this if we can use the same trick on both linux and osx.

japaric avatar Mar 16 '16 17:03 japaric

interesting

I now remember the prefix path (given via -L when calling qemu-arm explicitly) still has to be defined and that I did that by creating a link in /etc (which can't be done due to no sudo), but it can also be done by setting environment variable QEMU_LD_PREFIX.

Do you know if there are equivalent brew packages for osx?

Sorry, I have absolutely zero experience with osx.

IMO the best solution would be to teach cargo itself to support target.*.interpreter key (similar to the ar and linker it already has) that would be used as prefix for running the binaries. Because that should work even for Android, NaCL, emscripten and such where I'm not sure binfmt can go that far and doing the full build under emulation is not an option.

jan-hudec avatar Mar 16 '16 17:03 jan-hudec