[rust-dev] Rust (Servo) Cross-Compile to ARM

Skirmantas Kligys skirmantas.kligys at gmail.com
Sun Jun 8 20:17:41 PDT 2014


On Sun, Jun 8, 2014 at 3:10 PM, Corey Richardson <corey at octayn.net> wrote:
> You need to change the target, not just the target-cpu. `rustc
> --target arm-unknown-linux-gnueabihf ...`

Oh, apparently it built a compiler and a cross-compiler in the same
binary.  That was unexpected.

For the record, this is the correct way to compile:

rustc --target arm-unknown-linux-gnueabihf -C
linker=arm-linux-gnueabihf-g++ hello.rs

Thanks for help!


> On Sun, Jun 8, 2014 at 2:57 PM, Skirmantas Kligys
> <Skirmantas.Kligys at gmail.com> wrote:
>> Luqman Aden <laden at ...> writes:
>>>
>>> Building a Rust cross compiler that can target arm isn't too hard. You
>> just need the right toolchain installed. I personally use Debian with the
>> gcc-4.7-arm-linux-gnueabi package from the Emdebian repo. (I believe Ubuntu
>> and other distros have similar packages). From there it's just a simple
>> matter of passing the right triple to the configure script.
>>>
>>> ./configure --target=arm-unknown-linux-gnueabi && make
>>>
>>> That'll build a rustc that can target arm as well as all the libraries.
>> Then you can run it like so:
>>>
>>> rustc --target=arm-unknown-linux-gnueabi --linker=arm-linux-gnueabi-gcc
>> hello.rs
>>>
>>> That'll give you a binary, hello, which will run on arm/linux. So, that's
>> the basic gist of it.
>>
>> I am trying to follow these instructions and also
>>
>> https://gist.github.com/amatus/6665852
>>
>> unsuccessfully.
>>
>> export PATH=$PWD/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-
>> x64/bin:$PATH
>> cd rust
>> ./configure --prefix=/usr/local/stow/rust-pi-20140608 --target=arm-unknown-
>> linux-gnueabihf
>> make -j2
>> sudo make install
>>
>> cfg: build triple x86_64-unknown-linux-gnu
>> cfg: host triples x86_64-unknown-linux-gnu
>> cfg: target triples x86_64-unknown-linux-gnu arm-unknown-linux-gnueabihf
>> cfg: non-build target triples arm-unknown-linux-gnueabihf
>> cfg: enabling more debugging (CFG_ENABLE_DEBUG)
>> cfg: host for x86_64-unknown-linux-gnu is x86_64
>> cfg: host for arm-unknown-linux-gnueabihf is arm
>> cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
>> cfg: os for arm-unknown-linux-gnueabihf is unknown-linux-gnueabihf
>> cfg: using CC=gcc (CFG_CC)
>> cfg: no pdflatex found, deferring to xelatex
>> cfg: no xelatex found, deferring to lualatex
>> cfg: no lualatex found, disabling LaTeX docs
>> cfg: no pandoc found, omitting PDF and EPUB docs
>> cfg: no llnextgen found, omitting grammar-verification
>> ...
>>
>> A rustc gets built, but it targets Intel:
>>
>>  $ rustc -C target-cpu=help hello.rs
>> Available CPUs for this target:
>>
>>   amdfam10      - Select the amdfam10 processor.
>>   athlon        - Select the athlon processor.
>>   athlon-4      - Select the athlon-4 processor.
>>   athlon-fx     - Select the athlon-fx processor.
>>   athlon-mp     - Select the athlon-mp processor.
>>   athlon-tbird  - Select the athlon-tbird processor.
>>   athlon-xp     - Select the athlon-xp processor.
>>   athlon64      - Select the athlon64 processor.
>>   athlon64-sse3 - Select the athlon64-sse3 processor.
>> ...
>>
>> Any ideas?
>>
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>
>
>
> --
> http://octayn.net/


More information about the Rust-dev mailing list