tailhook / vagga

Vagga is a containerization tool without daemons
http://vagga.readthedocs.org
MIT License
1.86k stars 96 forks source link

Initial command to cross-compile vagga for arm (Raspberry PI) #483

Closed tailhook closed 6 years ago

tailhook commented 6 years ago

/cc @rainboh

rainboh commented 6 years ago
git clone https://github.com/tailhook/vagga.git
cd vagga
git checkout arm
vagga make-arm 

...

error: linking with `cc` failed: exit code: 1
  |
  = note ...
...  = note: /usr/bin/ld: /usr/lib/rustlib/arm-unknown-linux-musleabihf/lib/crt1.o: Relocations in generic ELF (EM: 40)
          /usr/bin/ld: /usr/lib/rustlib/arm-unknown-linux-musleabihf/lib/crt1.o: Relocations in generic ELF (EM: 40)
          /usr/lib/rustlib/arm-unknown-linux-musleabihf/lib/crt1.o: error adding symbols: File in wrong format
          collect2: error: ld returned 1 exit status
tailhook commented 6 years ago

Forgot that it requires .cargo/config:

> cat .cargo/config
[target.arm-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"

Is there any other way to specify linker for arm? Or maybe you have this setting in $HOME?

rainboh commented 6 years ago

Or maybe you have this setting in $HOME?

Yes. And of course there it's not visible for the container, my fault.

Is there any other way to specify linker for arm?

Unshure if this is correct:

exec cargo rustc --target=arm-unknown-linux-musleabihf -- -C linker="arm-linux-gnueabihf-gcc"

When running above line with '--verbose' option, console output shows

   Compiling vagga v0.8.0 (file:///work)
     Running `rustc --crate-name vagga src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C linker=arm-linux-gnueabihf-gcc ...

Using '.cargo/config' as well as above line did build successfull and both are running fine on target

Forgot that it requires .cargo/config:

Either '.cargo/config' or ' -C linker="arm-linux-gnueabihf-gcc' should be added to the repo. Agree ?

tailhook commented 6 years ago

Yes. Merged in. We probably also want to cross-compile on travis, but this is out of scope of this PR.

tailhook commented 6 years ago

Maybe armv7 couldn't be compiled for the same reasons? (i.e. different headers)

rainboh commented 6 years ago

First of all, thanks for your help and support to get target 'arm' working.

Maybe armv7 wasn't compiled for the same reasons? (i.e. different headers)

Most probably. At least I can successfull build it on Pi with

CC=musl-gcc cargo build --target=armv7-unknown-linux-musleabihf