Open ephraim opened 8 years ago
definitely possible, but that can quickly fill up your build-target list. Most IDEs offer a way to change the cross-target independently of the build-targets, if there were such a package, atom-build-cargo
could take advantage of it.
that would be a solution too. So I vote for such a change :)
But for the start of this feature it would be sufficient to recognize the environment variable ARCH and use this for the --target parameter, if available.
What do you think?
So I vote for such a change :)
I'll happily integrate such an atom-package, but first we'd need to write one... It should probably allow to choose the toolchain, too. I don't know much about atom packages, but I'll happily help developing it if you care to start.
But for the start of this feature it would be sufficient to recognize the environment variable ARCH and use this for the --target parameter, if available.
that's already possible by setting the RUST_FLAGS
env var to --target=yourtarget
Nice! Thanks. So thats a start at least.
Such a package would need to extend the Atom API to provide a way to change the target arch. Sounds nice for my first atom package :).
Thanks for your hints!
Looks like RUSTFLAGS (AFAIK it's without "_") don't work :(. Just to share my tests. I know it's not build-cargo specific.
Good Build:
$ unset RUSTFLAGS $ rm -r target $ cargo build --target=arm-unknown-linux-gnueabi --verbose Compiling hello_world v0.0.1 (file:///home/cestonarot/Projects/rust/helloworld) Running
rustc src/main.rs --crate-name hello_world --crate-type bin -g --out-dir /home/cestonarot/Projects/rust/helloworld/target/arm-unknown-linux-gnueabi/debug --emit=dep-info,link --target arm-unknown-linux-gnueabi -C ar=/usr/bin/arm-linux-gnueabi-ar -C linker=/usr/bin/arm-linux-gnueabi-gcc -L dependency=/home/cestonarot/Projects/rust/helloworld/target/arm-unknown-linux-gnueabi/debug -L dependency=/home/cestonarot/Projects/rust/helloworld/target/arm-unknown-linux-gnueabi/debug/deps
Bad Build with RUSTFLAGS:
$ rm -r target $ export "RUSTFLAGS=--target=arm-unknown-linux-gnueabi --verbose" $ echo $RUSTFLAGS --target=arm-unknown-linux-gnueabi --verbose $ cargo build Compiling hello_world v0.0.1 (file:///home/cestonarot/Projects/rust/helloworld) error: linking with
cc
failed: exit code: 1 note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib" "/home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o" "-o" "/home/cestonarot/Projects/rust/helloworld/target/debug/hello_world" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/cestonarot/Projects/rust/helloworld/target/debug" "-L" "/home/cestonarot/Projects/rust/helloworld/target/debug/deps" "-L" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/libstd-55711bc2dd2a07f8.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/libcollections-3b95c337f71e0879.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/librustc_unicode-bc06291f5c8c137f.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/librand-d616b26a78fe6a13.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/liballoc-38fb4351f0eb2195.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/liballoc_jemalloc-3d5078df376e8e22.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/liblibc-57a5ce8421433b46.rlib" "/usr/local/lib/rustlib/arm-unknown-linux-gnueabi/lib/libcore-e50b5109cd57293a.rlib" "-l" "gcc_s" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-l" "compiler-rt" note: /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /usr/bin/ld: /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: Umwandlung in generisches ELF (EM: 40) /home/cestonarot/Projects/rust/helloworld/target/debug/hello_world.0.o: error adding symbols: Falsches Dateiformat collect2: error: ld returned 1 exit statuserror: aborting due to previous error error: Could not compile
hello_world
.To learn more, run the command again with --verbose.
hmm... looks like cargo needs to know about the target.
RUSTFLAGS is for rustc, right? But the --target parameter is for cargo, too. Ok sad.
actually... maybe we don't need an extra package. We could simply add the target + toolchain chooser as an additional menu to this package.
You just need to select a target toolchain once, which would be e.g. via menu entry under packages. Then just build as usuall. That would be great!
Hey!
currently I'm able to crossbuild a rust project via cargo with the --target parameter on commandline.
Do you think that build-cargo could find supported target platforms and e.g. make it available via F7 (build targets) ?
e.g. Cargo: build (arm-none-linux-gnueabi) (release) Cargo: build (arm-none-linux-gnueabi) (debug) Cargo: build (x86_64-pc-windows-gnu) (release) Cargo: build (x86_64-pc-windows-gnu) (debug) Cargo: build (x86_64-pc-windows-msvc) (release) Cargo: build (x86_64-pc-windows-msvc) (debug)
Cheers, Ephraim