-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Cannot build for mips and armhf with jemalloc #30966
Comments
Looks like a simple case of missing symbols - probably means the EDIT: |
I've downloaded the rust libs from http://static.rust-lang.org/dist/ndex.html, e.g. http://static.rust-lang.org/dist/2016-01-15/rust-std-nightly-mips-unknown-linux-gnu.tar.gz
Is this the wrong approach? Should I build them myself? |
Yes, cause you're using a slightly old distro. If you tried it on one of the Odroids that would work as expected. |
Interesting! This is likely because we're using a pretty new toolchain to compile the MIPS nightlies, and we may need to downgrade that. This may be the same case for the ARM nightlies as well. |
@alexcrichton Or just provide more options? |
If you try to provide your own |
Thanks. I'm quite new to rust. Cross-compiling std doesn't seem to be straightforward, so I'm just using the system allocator for now. |
@herrernst So, can the guys close this issue? |
I think it should be considered downgrading the build chain for the prebuilt std libs, as alexcrichton has said, because it would be nice for example to use the standard Raspberry Pi toolchain without having to need compiling Rust yourself. |
@herrernst This is my approach https://github.com/joerg-krause/rust-cross-libs to cross-compile std for an ARMv5 target (which is an custom target), because I did not wanted to cross-bootstrap the whole Rust toolchain. EDIT: insert link |
I would indeed like to assuage this issue if at all possible, but I also want to try to drill down here and get some specifics about how to move forward. What I believe to be the problem is that we're using "too new" of a C compiler when compiling jemalloc, and I suspect that this may be fixable by just using an older C compiler. With that in mind, first here's what we're using on the bots for building our nightlies:
Both of those gcc versions are indeed very new, but I wouldn't be 100% sure of how to downgrade, either, unfortunately. I suspect what actually needs to be downgraded is the glibc version for each platform (it just tends to be in step with a gcc version). With this all in mind, I think there's a few courses of action here:
I'd personally be in favor of 1 or 2, but I unfortunately don't know what to do with option 1... As a side note as well, it looks like the OpenWRT SDK uses uclibc? Does that strive for binary ABI compatibility with glibc? If not then there may be worse consequences mixing with the |
On Ubuntu 15.10 the oldest GCC that can be installed is GCC 4.7. To the second question: Here is a comparison - you can see that uclibc doesn't even have a stable ABI. ref |
Thanks for the answer @lilianmoraru! The pointer for the For MIPS we have a custom PPA from @angelsl, so unfortunately there isn't a standard package for 4.7 (I believe) just yet. We can likely try to find one, however, or make it ourselves. Also thanks for explaining uclibc, that matches what I'd suspect. I'm a little surprised that it doesn't even have a stable ABI (could make, e.g., porting liblibc to it a little difficult), but alas! In that case anyway @herrernst I don't think you can use our MIPS nightlies with the OpenWRT toolchain because there's a mismatch with the libc versions. |
Thanks for all the information and feedback work. One thing I'm not yet quite sure of: If a build a local std crate with the compiler from the OpenWRT toolchain, should it work then? It then links against uclibc, doesn't it? I picked some random Rust project, hyper, and the example server (albeit without OpenSSL for now) seems to run okay. |
@herrernst, seems to run okay on the OpenWRT target? If yes, my guess would be that everything you need is statically linked(like it would be with musl). Probably you don't use system libraries(dynamic linking). You could check that by running |
The trunk version of OpenWRT is now using musl instead of uclibc. The next stable release will probably be using musl, so having Apart from building std against uclibc, I think we'll also need to add uclibc support to the libc crate. |
Whether libstd works with uclibc may actually be either intended or lucky. When compiling the standard library for MIPS on Linux it will default to glibc definitions of libc (e.g. this is what liblibc is verified against), so if it works against uclibc then either: A) uclibc tries to mirror glibc in terms of ABI, but doesn't provide guarantees and we just happen to use the subset that mirrors correctly Overall I would say that it's pretty risky business to run a -gnu nightly against a uclibc build oh excellent! I'd be quite interested in getting those builds up and running. |
@alexcrichton uclibc does not attempt to keep ABI compatibility with glibc: My only guess would be that it works because it was statically linked. |
I don't think it's statically linked:
On the target:
I think the hello-world example works because "uClibc is more compatible to |
Triage: still getting the "undefined reference to secure_getenv" on ARM with Rust 1.7.0 and nightly-2016-03-07 when cross compiling hello world. Oddly enough, I didn't get this error when cross compiling with Rust 1.6.0 and 1.8.0-beta.1 |
Hm interesting, @japaric looks like there's a gcc version mismatch. We're 4.7 on the bots, and it looks like you're using 4.6.3? Not entirely sure why the other two versions would work... |
@alexcrichton I think the problem is libc and not gcc. secure_getenv was introduced in glibc-2.17 (grep for secure_getenv). The bots are running Ubuntu 15.10 so the libc6-dev-armel-cross package is A solution would be moving the bots to an older arm glibc. crosstool-ng can generate a gcc-4.8/glibc-2.14 arm toolchain, perhaps we could use that in the bots? EDIT: Actually the bots are running ubuntu 15.10, so the glibc version is higher. |
Ah yeah that'd do it. I tend to conflate gcc/glibc as they're so commonly paired together. I'd love to use an older glibc! If you've got a way to updated our linux-cross image then I'd be down to merge+deploy. |
Triage: the problem is gone on ARM, today's (2016-03-16) libstd can be used to cross compile to arm-unknown-linux-gnueabihf on Ubuntu precise. |
The `secure_getenv` issue is caused by too old `libc6-armhf-cross` (see rust-lang/rust#30966) and the missing system call is likely caused by too old `qemu`. Both because TravisCI still uses absurdly ancient Ubuntu 12.04 Precise Pangolin. So try to add `debian-sid` package source (as the only newer source listed in <https://github.com/travis-ci/apt-source-whitelist/>) whether it will fix the problem, and restore attempt to build that target with stable toolchain, because it might potentially fix both issues.
Confirming, nightly does not have the problem. Stable does. I am then hitting another problem where qemu complainins it does not support system call 384 when trying to run the tests. Somehow it only complains in some builds and I don't see any obvious difference between those that worked and those that didn't. |
Note that the other option is to request Trusty from TravisCI. I tested that the settings to request it, |
I believe this has since been fixed, so closing. |
The rust-lang/rust#30966 has been closed and the workaround using trusty wasn't working anyway since there the tests usually locked up and never finished (while they finish just fine on my up-to-date Debian Stretch).
Yes, for nightly it compiles now. The tests unfortunately don't run on Travis under qemu anyway, neither in the default container nor with |
I tried cross-compiling to mips, getting jemalloc errors when linking:
... and it goes on.
When adding this to main.rs it works
Error happens with stable 1.5, beta, latest nighty. I'm using the linker from OpenWRT SDK which identifies as "mips-openwrt-linux-gcc (OpenWrt/Linaro GCC 4.8-2014.04 r46450) 4.8.3"
Also I get a similar error when trying to compile for armhf:
Here, I am using gcc from Raspberry Pi tools.
The text was updated successfully, but these errors were encountered: