rust-osdev / cargo-xbuild

Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.
Apache License 2.0
258 stars 25 forks source link

Xbuild ignoring the linker config flag #26

Open hargoniX opened 5 years ago

hargoniX commented 5 years ago

I wrote the following .cargo/config file for an arm-none-eabi target

[target.arm-none-eabi]
linker = "arm-none-eabi-gcc"
rustflags = [
  "-C", "target-cpu=cortex-a8",
]

When i run cargo xbuild --target=arm-none-eabi.json it fails because it tries to link everything together with the cc linker. However when i insert "-C", "linker=arm-none-eabi-gcc" as follows

[target.arm-none-eabi]
rustflags = [
  "-C", "target-cpu=cortex-a8",
  "-C", "linker=arm-none-eabi-gcc"
]

It does use the arm-none-eabi-gcc linker correctly. Is xbuild actually just ignoring the linker flag (on purpose or without?) or am I supposed to do define the linker in a different way. If this actually turns out to be a bug with xbuild I'd happily try to add a fix so it picks up the linker flag.

phil-opp commented 5 years ago

Which version of cargo-xbuild are you using? There was an issue that might cause this in version 0.5.1, which should be fixed in version 0.5.2.

hargoniX commented 5 years ago

According to cargo xbuild --version im running on 0.5.3 with rustc at rustc 1.33.0-nightly from the 4th january 2018

phil-opp commented 5 years ago

Ok, then it's something different.

When does it fail? When linking the sysroot (i.e. core, alloc etc) or when linking your crate?

hargoniX commented 5 years ago

It fails after compiling everything with the note about ld being

 = note: /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/release/deps/test1-e3ada6bff0aa617c.test1.9lybuq61-cgu.0.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/release/deps/test1-e3ada6bff0aa617c.test1.9lybuq61-cgu.0.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/release/deps/test1-e3ada6bff0aa617c.test1.9lybuq61-cgu.0.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/release/deps/test1-e3ada6bff0aa617c.test1.9lybuq61-cgu.0.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/release/deps/test1-e3ada6bff0aa617c.test1.9lybuq61-cgu.0.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status

And if i just set the -C option as shown in my issue everything just works perfect which I assume is the case because now its trying to link an arm-none-eabi compiled file with my system ld which does of course not work as that one is made for x86 linux.

phil-opp commented 5 years ago

Could you do a cargo clean and then recompile it with the --verbose flag and post the output here?

Cargo-xbuild should only execute a normal cargo command and set the RUSTFLAGS environment variable before (so that the sysroot is found). So would expect that the linker = "…" key works and the rustflags = […] key doesn't, but it seems the other way around for you…

hargoniX commented 5 years ago
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ "cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/xargo.2NsjZO2ObSnI/Cargo.toml" "--target" "arm-none-eabi.json" "-v" "--" "-Z" "force-unstable-if-unmarked"
    Updating crates.io index
   Compiling compiler_builtins v0.1.5
   Compiling core v0.0.0 (/home/nix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
     Running `rustc --crate-name build_script_build /home/nix/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.5/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="mem"' -C metadata=0750035e48e8a06d -C extra-filename=-0750035e48e8a06d --out-dir /tmp/xargo.2NsjZO2ObSnI/target/release/build/compiler_builtins-0750035e48e8a06d -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/release/deps --cap-lints allow`
     Running `rustc --crate-name core /home/nix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=09cde34ace1c5be6 -C extra-filename=-09cde34ace1c5be6 --out-dir /tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/release/deps`
     Running `/tmp/xargo.2NsjZO2ObSnI/target/release/build/compiler_builtins-0750035e48e8a06d/build-script-build`
   Compiling rustc-std-workspace-core v1.0.0 (/home/nix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
     Running `rustc --crate-name rustc_std_workspace_core /home/nix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=083f64113d801410 -C extra-filename=-083f64113d801410 --out-dir /tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/release/deps --extern core=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps/libcore-09cde34ace1c5be6.rlib`
     Running `rustc --crate-name compiler_builtins /home/nix/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.5/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="mem"' -C metadata=373a374522350861 -C extra-filename=-373a374522350861 --out-dir /tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/release/deps --extern core=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps/librustc_std_workspace_core-083f64113d801410.rlib --cap-lints allow`
   Compiling alloc v0.0.0 (/tmp/xargo.2NsjZO2ObSnI)
     Running `rustc --crate-name alloc /home/nix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -Z force-unstable-if-unmarked -C metadata=b73aafba49ebcbe7 -C extra-filename=-b73aafba49ebcbe7 --out-dir /tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps -L dependency=/tmp/xargo.2NsjZO2ObSnI/target/release/deps --extern compiler_builtins=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps/libcompiler_builtins-373a374522350861.rlib --extern core=/tmp/xargo.2NsjZO2ObSnI/target/arm-none-eabi/release/deps/libcore-09cde34ace1c5be6.rlib`
    Finished release [optimized] target(s) in 30.53s
+ RUSTFLAGS="-C target-cpu=cortex-a8 -C link-args=-Tlink.ld --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot"
+ "cargo" "build" "--target=arm-none-eabi.json" "--verbose"
   Compiling tock-registers v0.2.0
     Running `rustc --crate-name tock_registers /home/nix/.cargo/registry/src/github.com-1ecc6299db9ec823/tock-registers-0.2.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=cf7b36e6bda7daec -C extra-filename=-cf7b36e6bda7daec --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --cap-lints allow -C target-cpu=cortex-a8 -C link-args=-Tlink.ld --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot`
   Compiling register v0.2.1
     Running `rustc --crate-name register /home/nix/.cargo/registry/src/github.com-1ecc6299db9ec823/register-0.2.1/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=79d78de45e50e380 -C extra-filename=-79d78de45e50e380 --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --extern tock_registers=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/libtock_registers-cf7b36e6bda7daec.rlib --cap-lints allow -C target-cpu=cortex-a8 -C link-args=-Tlink.ld --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot`
   Compiling test1 v0.1.0 (/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1)
     Running `rustc --edition=2018 --crate-name test1 src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=be56523ec1f35145 -C extra-filename=-be56523ec1f35145 --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -C incremental=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/incremental -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --extern register=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/libregister-79d78de45e50e380.rlib -C target-cpu=cortex-a8 -C link-args=-Tlink.ld --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot`

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot/lib/rustlib/arm-none-eabi/lib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o" "-o" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot/lib/rustlib/arm-none-eabi/lib" "-Wl,-Bstatic" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/librustc_std_workspace_core-083f64113d801410.rlib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/libcore-09cde34ace1c5be6.rlib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/libcompiler_builtins-373a374522350861.rlib" "-Tlink.ld" "-Wl,-Bdynamic"
  = note: /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile `test1`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name test1 src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=be56523ec1f35145 -C extra-filename=-be56523ec1f35145 --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -C incremental=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/incremental -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --extern register=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/libregister-79d78de45e50e380.rlib -C target-cpu=cortex-a8 -C link-args=-Tlink.ld --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot` (exit code: 1)

Here you go

phil-opp commented 5 years ago

Thanks! According to the cargo documentation, the linker argument should be passed as -C linker= to rustc, but it seems like this does not happen here. I have no idea why.

Can you try to add --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot to your RUSTFLAGS and then doing a normal cargo build instead of xbuild?

hargoniX commented 5 years ago

Okay if i run RUSTFLAGS="--sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot" cargo build --target=arm-none-eabi.json after a cargo clean with the same config as above i still get that huge linker error because of even normal cargo ignoring the linker flag. If you want the full output again:

   Compiling test1 v0.1.0 (/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1)
     Running `rustc --edition=2018 --crate-name test1 src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=be56523ec1f35145 -C extra-filename=-be56523ec1f35145 --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -C incremental=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/incremental -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --extern register=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/libregister-79d78de45e50e380.rlib --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot`

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot/lib/rustlib/arm-none-eabi/lib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o" "-o" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps" "-L" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot/lib/rustlib/arm-none-eabi/lib" "-Wl,-Bstatic" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/librustc_std_workspace_core-083f64113d801410.rlib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/libcore-09cde34ace1c5be6.rlib" "/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/xbuild_sysroot/lib/rustlib/arm-none-eabi/lib/libcompiler_builtins-373a374522350861.rlib" "-Wl,-Bdynamic"
  = note: /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: relocations in generic ELF (EM: 40)
          /usr/bin/ld: /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/test1-be56523ec1f35145.4wo28sq654rhyh9d.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile `test1`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name test1 src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=be56523ec1f35145 -C extra-filename=-be56523ec1f35145 --out-dir /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps --target /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/arm-none-eabi.json -C incremental=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/incremental -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps -L dependency=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/debug/deps --extern register=/home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/target/arm-none-eabi/debug/deps/libregister-79d78de45e50e380.rlib --sysroot /home/nix/Desktop/Programming/OsDev/BeaglePocket/RustyBeagle/test1/../xbuild_sysroot` (exit code: 1)
phil-opp commented 5 years ago

Ok, then this is an issue with cargo itself. It seems like the [target.arm-none-eabi] block is applied, since the target-cpu=cortex-a8 argument is in the verbose output, so this does not seem to be the problem. I don't have any ideas what could cause this right now. Maybe ask on https://users.rust-lang.org/?

hargoniX commented 5 years ago

Posted the issue over here