-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for i586-unknown-linux-gnu #157
Conversation
I don't have a linux machine, is there a way to get the tests to run? Or do I have to test it manually (e.g. by forking cargo and trying to compile it with cross for i586 ?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's LGTM.
gcc \ | ||
libc6-dev \ | ||
make \ | ||
file \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is file dependency required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is a c&p-error from the i586
file in the stdsimd
crate. EDIT: fixed.
@@ -0,0 +1,27 @@ | |||
FROM ubuntu:17.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is based on i686-unknown-linux-gnu, right? If the ubuntu version is kept in 12.04, the docker layers can be shared between i686-unknown-linux-gnu and i586-unknown-linux-gnu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know my way around docker. Should I downgrade the version in this file, upgrade the version in the i686
docker file, or do I need to do something else to reuse the docker layers?
(FWIW in the stdsimd
crate we use 17.04 for everything and I am trying to replace our testing infrastructure there with cross
now that you are adding support here for qemu-system).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per @japaric 's comment below I've downgraded this to 12.04.
README.md
Outdated
@@ -198,6 +198,7 @@ worst, "hang" (never terminate). | |||
| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 | 1.0.2m | ✓ | 2.8.0 | ✓ | | |||
| `armv7-unknown-linux-musleabihf` | 1.1.15 | 5.3.1 | N/A | | 2.8.0 | ✓ | | |||
| `asmjs-unknown-emscripten` [4] | 1.1.15 | 1.37.13 | N/A | ✓ | N/A | ✓ | | |||
| `i586-unknown-linux-gnu` | 2.15 | 4.6.2 | 1.0.2m | ✓ | N/A | ✓ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the glibc version is wrong. Ubuntu 17.04 ships with glibc 2.24.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've downgraded the ubuntu version to 12.04, so that this should now be correct.
@@ -0,0 +1,27 @@ | |||
FROM ubuntu:17.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be as low as possible, i.e. 12.04 as the i686 target, to make the binaries produced with Cross compatible with legacy distributions like centos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. This should make the version in the readme file correct right?
I don't known how to run the test in a non Linux machine... Maybe you can install Linux in a virtual machine? Instructions to run the tests in a Linux machine: First you need to build the docker image:
Then you can run the tests:
|
I can throw this into homu as a try build but test times will be in the order of hours due to the large number of travis builders. If you temporarily comment all the other travis builds I can start a try build. |
@japaric I have another PR with an new ARM target. Maybe after that one passes review I can merge both PRs and then we can do a homu build of both together? |
@gnzlbg Fine by me. |
@japaric I've merged both PR here and disabled the other builds so that homu can be run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just remembered:
apt-get install -y --no-install-recommends g++-arm-linux-gnueabihf
This is wrong for arm-unknown-linux-gnueabihf
because that targets supports both ARMv6 and ARMv7 but g++-arm-linux-gnueabihf
targets ARMv7 thus with this combination the binary will contain ARMv7 instructions and will crash when executed on a ARMv6 device. You won't detect this problem when testing under QEMU because qemu-arm
emulates an ARMv7 processor by default. But quite a few people, including me, have run into this runtime crash (SIGILL) when using the Ubuntu toolchain for cross compilation.
TL;DR The C toolchain (gcc + libc) must be compiled from scratch to target ARMv6
@japaric is there a way to force qemu-arm to emulate an armv6 processor ? |
@japaric I've removed the arm target since I don't really know how to do that without a machine where I can test it, the i586 parts should be good to go if you want to try with homu. |
I think I tried setting a specific CPU before using QEMU_CPU but I think I didn't manage to get a SIGILL when supossedly emulating ARMv6 and running a binary that contained ARMv7-only instructions.
You can probably copy paste some of the Docker build stuff from rust-lang/rust. There they use crosstool-ng to build an ARMv6 toolchain. @homunkulus try |
add support for i586-unknown-linux-gnu Closes #156 .
💔 Test failed - status-travis |
It fails to link |
That looks slightly familiar. IIRC that error is caused because you used a relatively new binutils / gcc when compiling the std facade but used an old binutils (ld) when linking a Rust binary against the facade. This has happened before with 32-bit targets and it was fixed upstream, perhaps this target was not fixed? I believe the solution was to downgrade the binutils version used in the docker image (in rust-lang/rust) where std is built. |
@japaric you mean this here, and the comment above? https://travis-ci.org/japaric/cross/builds/302095949#L8670 It seems like that is done for i686 but not for i586. |
I was referring to this linker error:
Specifically the "unrecognized relocation" you can probably find issues with that phrase in rust-lang/rust. |
Did you take a look at the link? It seems to exactly be addressing that error, but it seems to be only doing so for i686 and not i586. I'll go through the issues and see what Ican find. |
Ok I c&p the wrong link, this is the right one: https://github.com/rust-lang/rust/blob/master/src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile#L36 |
Yes, that's the issue. The problem is that std is built in Ubuntu 16.04 and we are using a linker from 12.04.
This flag should also be applied to i586-gnu otherwise only i686-musl would be "supercompatible". This has to be fixed upstream. |
fix linking error on i586 Try to fix this linking error on i586 in cross: https://travis-ci.org/japaric/cross/builds/302095949#L8670 The problem is that `std` is built in Ubuntu 16.04 and `cross` uses a linker from 12.04. Currently this fix solves the problem for `i686-musl` making it "supercompatible", this PR applies the fix to `i586` as well. The cross PR is here: cross-rs/cross#157
@homunkulus try |
@japaric might be worth to retry this today or tomorrow, the fix was merged yesterday in rustc :) |
@homunkulus retry |
add support for i586-unknown-linux-gnu Closes #156 .
💔 Test failed - status-travis |
linker error:
that sounds like the std facade is being built against a newer libc than the one we are using. The easiest fix would be to bump our Ubuntu version to match the one that's being used in rust-lang/rust. The fix that would make i586 binaries more compatible would be to lower the libc version used in rust-lang/rust. |
I've bumped the ubuntu version to 16.04 (the one used in rust-lang/rust). If that works we could try lowering it to 14.04 and see if that works. |
@homunkulus try |
add support for i586-unknown-linux-gnu Closes #156 .
@gnzlbg you can |
☀️ Test successful - status-travis |
We shouldn't use a libc older than the one used by rust-lang/rust because there's the risk that a new libc symbol will be used in the std facade in the future and that will cause linker error due to us having an older libc without that symbol. If you uncomment the other build jobs I'll r+ this. |
@japaric I've rebased but I think the versions of libc in the readme are still wrong. |
@japaric so i've updated the version of glibc in the readme to 2.23 and gcc to 5.3.1 (those seem to be the values for ubuntu 16.04). IIUC the openssl version is 1.0.2m for all right? |
@homunkulus try |
add support for i586-unknown-linux-gnu Closes #156 .
☀️ Test successful - status-travis |
Yes. The OpenSSL is the same on all the images. Thank you, @gnzlbg. |
@japaric could you do a release of this? I'd like to move |
@gnzlbg v0.1.14 has been released. You'll have to wait like 1 hour until propely tagged images make it to dockerhub and the release works properly. When this build is done the new release should work. |
Thanks, I'll send a PR to |
Closes #156 .