I'm asking here rather than the rust-avr git pages, because I think my issue is more about building rust than about that fork.
I'd like to play with that. I have some small C projects that I think would make good tests and would seriously benefit from being tackled in a rust state of mind.
To start that, I got a recent copy of the llvm source tree, and built that with the experimental avr target enabled. I've verified that it at least generates code for that target, and can create a hex file (though I've not tried flashing one yet). Halfway there, right?
But I can't figure out how to get the rust-avr fork of rust to build. I keep getting a note that /usr/bij/ld could not find -lstdc++. I think the issue is that clang is the system compiler, so gcc - and in particular it's libraries - are in non-standard places. There doesn't seem to be a config setting for this, and setting LDFLAGS doesn't help.
Can someone provide the clue I'm overlooking? Or maybe there's more information you need from me?
That fork is
ancient rather behind in terms of changes to both LLVM and Rust, and deprecated now that LLVM supports targeting AVR.
If you take a Rust project and run
cargo build -v, you will get a printout of the
rustc invocation it uses. If you take that invocation and run it with
-emit=llvm-ir,link, it will produce a
$crate.ll file that you can then finish with
llc $crate.ll -march=avr. If that doesn't find libraries, I'm out of ideas.
Testing this sequence targeting x86 has worked for me, so I can verify that the command pipeline works, but I have no idea about the architecture targets at this time.
That it's depreciated doesn't surprise me, but I couldn't find any comments about that. And there are commits on it that are only a few months old, so I wouldn't really call it ancient. Maybe that's because I'm ancient.
I'll give that a try later today. Thanks.
"ancient" is relative to where LLVM and Rust currently are; in the past few months LLVM merged the AVR subsytem in and Rust had a pretty major release. I don't know if the rust-avr fork is able to accept the recent (and rather significant) changes that have landed since then.
1.15 was a pretty big jump, both in the language itself and in the compiler infrastructure. I'm not intimately familiar with the avr fork, but I'd be extremely surprised if it was unaffected by the build system changes or the language changes.
I've heard that rustc is working its way towards both upgrading bundled LLVM to 4.0 (including AVR) and using the system LLVM (minus Rust's patches that make it even cooler), but I'm not sure how that's coming.
I think we currently have nothing for AVR support, so you'll have to build libcore yourself and do
#![no_std], but if you follow japaric's excellent guides on making embedded-Rust projects and then do the LLVM halt-and-switch I described, that might get you most of the way there.
I've seen some of the traffic on github about this, but it didn't seem like there was a single good issue to watch. And I didn't find anything about this when I checked the forums before posting. So is there some good way to keep updated on the state of AVR support in Rust? Or is that the same question as the state of the llvm-4.0 integration?
I think we're blocked on LLVM 4.0. I have no doubt that once that lands in our tree, japaric will open his floodgates of wisdom on making the magic happen. Other than the LLVM upgrade and awaiting info from japaric, I don't know of anywhere else to look off the top of my head.