Running the cross-compiler?

I successfully built (I think) a cross-compiler for Solaris SPARC in x64 Ubuntu: michele@michele-VirtualBox:~/rust$ ./ build --target sparcv9-solaris2.11 michele@michele-VirtualBox:~/rust$ sudo ./ install ... Dist std stage2 (x86_64-unknown-linux-gnu -> sparcv9-sun-solaris) finished in 15.907 Install std stage2 (Some("sparcv9-sun-solaris")) install: creating uninstall script at /usr/local/lib/rustlib/ install: installing component 'rust-std-sparcv9-sun-solaris'

std is standing at the ready.

Dist rustc stage2 (x86_64-unknown-linux-gnu) finished in 134.709 Install rustc stage2 (Some("x86_64-unknown-linux-gnu")) install: creating uninstall script at /usr/local/lib/rustlib/ install: installing component 'rustc'

Rust is ready to roll.

Build completed successfully in 1:35:32

This may be a dumb question, but where is it? I see a new rustc has appeared in /usr/local/bin but I don't know if that's the right thing. And when I ran /usr/local/bin/rustc, it created an x64 executable, not a SPARC executable.

And when I ran michele@michele-VirtualBox:~$ /usr/local/bin/rustc --target sparcv9-sun-solaris error: linking with cc failed: exit code: 1

My .cargo/config has this: [source.crates-io] replace-with = "vendored-sources"

directory = "vendor"

linker = "/usr/sparcv9-solaris/solaris/cross/bin/sparcv9-solaris2.11-gcc"

UPDATE After some more searching I found this page: Apparently you have to say $ cargo new --bin hello first. I did that and then in fact got an executable that ran on my Sun. It's still not clear why I can't just invoke rustc to get the same result.

rustc doesn't read options from .cargo/config, so you'll need to pass them on the command line instead. In your Cargo project, you can run cargo build -v to see how your configuration translates into rustc options.

Thanks for the tip. I found that I can get a cross-compiled executable by saying:

$ /usr/local/bin/rustc --target=sparcv9-sun-solaris -C linker=/usr/sparcv9-solaris/solaris/cross/bin/sparcv9-solaris2.11-gcc

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.