[rust-dev] Crosscompiling rust with non-blessed compiler prefixes

Cody P Schafer dev at codyps.com
Thu Oct 16 14:05:14 PDT 2014

On Thu, Oct 16, 2014 at 4:42 PM, Ben Harris <mail at bharr.is> wrote:
> You can currently (unless it has changed) specify the linker to use when
> calling rustc. I don't have rustc on this box, but I think it is similar to
> "-C linker=". This doesn't work with cargo at the moment, you can only
> really specify the target and then use that JSON to specify the target in
> more detail.

Yep, the problem I run into is that the building of rust itself
depends on knowing where that linker is, and there doesn't seem to be
a way to override the linker/cc rust uses when rust is being built as
a cross compiler (Or is there?).

   ./configure --target=arm-unknown-linux-gnueabi

Will fall on it's face unless I have an arm-linux-gnueabi-gcc
somewhere (in my case it isn't, I have arm-foobar-linux-gnueabi-gcc).
As I'm not calling rustc directly right here, so I can't easily pass
it arguments (I believe that the build scripts are the ones calling it
anyway, so rustc args aren't going to be the complete story).

It's rather unfortunate that we'll be unable to override settings at a
finer granularity. Needing to specify
data_layout, llvm_target, target_endian, target_word_size, arch, and
target_os just so I can change the linker means that I'll (probably)
end up shipping json configs that will potentially fall out of date
with upstream settings. It would be helpful to allow a way to extend
an existing configuration instead of needing to build them from

> Yes. As long as your target is supported by LLVM, the linker is the only
> external build tool required to get a binary. You also need a compatible
> libc and either libgcc or libcompiler-rt built for your target to provide
> some stubs.

Ok, those I've got.

More information about the Rust-dev mailing list