-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Building i686-unknown-linux-gnu target on OS X fails #16259
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
Comments
However, manually compiling |
Can you paste the error from On x86 we use the in-tree llvm-mc to compile assembly, and if that program is being invoked correctly, it should not be possible for an error here. |
Here's the
|
@brson I have encountered the same problem many times, do you have a plan to solve it ? |
Longer output. This is built with: ./configure --target=x86_64-apple-darwin,i686-unknown-linux-gnu,arm-unknown-linux-gnueabi
make I believe this uses the |
I don't think there's anything wrong with the way llvm-mc is called. |
as a quick workaround i tried adding --target=i686-unknown-linux-gnu to the clang command above,
i guessed again that there should be a --target option since it's trying to build a .so, not a .dylib.
I don't know how to fix that --eh-frame-hdr option. I tried messing with the ld command line to leave out the option to see what would happen.
weird. it's trying to produce a static library for the gnu platform but rust_builtin.o is a mach (osx) object file:
What on earth is supposed to happen? |
Oh, man. I didn't realize this was trying to cross from darwin to linux. I'm positive nobody has ever done that before, so certainly there will be issues. |
@cmsd2 You get that error when clang invokes darwin's ld with arguments for linux's ld. We need to invoke a ELF-compatible linker. Clang is infamous for completely ignoring its linker path argument, so I usually invoke clang with Alternatively, LLD can cross-link without any problems. However due to a bug in how it handles static libraries, LLD is not presently capable of statically linking Rust programs (the issue on LLVM), although it can dynamically link them. cc #9367 for linker issues |
Right ok. |
I too am bitten by this problem. I am trying to build a xv6 translation to rust - https://github.com/ckkashyap/unix/ - looks like I'll have to hold off build on mac for now. |
For what it's worth I have a workaorund that works for me - On my mac machine, do the following
|
i tried just using the osx version early on but without having a libcompiler-rt.a to hand. no need to go as far as linking a static library though. just emit the object file you want. for a mostly empty foo.rs:
this produces an elf object on my osx system using the osx build of rust:
i made sure my osx rustc and target libraries were both from last night's nightlies too. |
Couldn't morestack.S be rewritten in LLVM IR, like rust_try.ll? |
I'm still getting this error.. No solution in sight? |
+1. seeing this error on 1b28ffa while building a cross compiler from darwin to linux using |
This is unfortunately a known cross compilation triple that's just inherently quite difficult to target. Some of the bugs mentioned here have specifically been resolved, but in general this is never going to "just work" as it'll require a toolchain which can target 32-bit linux from OSX (which isn't available by default). If such a toolchain is installed, however, then most of our commands today should work just fine, but toolchains like this are pretty rare to come by. As a result I'm going to close this for now, but we're always looking for more avenues to make cross compilation in Rust easier, so please feel free to file follow-up bugs! |
@alexcrichton |
@dongz9 oh nice! While probably rare to come across, good to know they exist :) |
@alexcrichton Is there any chance for rust to support this in the near future? |
So long as you've got the right linker locally Rust already supports this use case, it's up to you to make sure all the right libraries are in place. |
@alexcrichton How can I configure rust to use this toolchain? |
You'll need to make sure that your |
I'm sorry but could you provide more details? Is this something I should do when calling ``configure'' before make? |
Unfortunately this kind of cross compilation is pretty unusual right now, so it's not really set up to "just work". It's unlikely that our configure script will be able to produce this kind compiler for this kind of cross compilation easily on OSX. In general you're mostly on your own in this territory right now. We certainly want to make this situation easier, but it will take some time and hasn't happened yet. Specifically what I mean is that all Rust distributions have a |
Just had the issue myself. As a workaround, I am using a docker container to build the executable:
(resource: https://github.com/clux/muslrust) |
I'm trying to build the rust libraries for multiple targets on OS X for cross-compilation purposes. Building with,
gives me:
The text was updated successfully, but these errors were encountered: