Cross compilation error fixed by explicitly passing sysroot

Hi,

I'm working on a little Raspberry PI fun project. For this I've set up cargo to produce cross-compiled binaries for my PI3 following the instructions here:

https://hackernoon.com/compiling-rust-for-the-raspberry-pi-49fdcd7df658

And that works just great!

Now I wanted to add the ableton-link crate found here:

https://github.com/magdaddy/ableton-link-rs

However this bombed on me with error-messages similar to what is discussed here:

https://github.com/rust-lang/rust-bindgen/issues/1229

With my limited understanding of the cross-toolchain setup I think what basically happens is that clang, which is ultimately used to spit out code that produces the binding between rust and the C-interface the binding created for the C++ library, uses my host sysroot - and falls flat on it's face.

I was able to fix this issue by explicitly passing the sysroot of the arm toolchain on my system that is used following the above cross compile setup. You can see the necessary changes here:

https://github.com/dir-ableton/ableton-link-rs/commit/d6b40aabfa75616b3628f649868ba0fc3bda29d0

Now comes my question: this obviously is a hack. I also have a hard time believing that this is the way it should be - that the author of build.rs must specify this kind of flags, given that quite a few of my many dependencies seem to work just fine (e.g. nanomsg).

So my question is: what to do to fix this proper, so I can create a pull request for the betterment of the state of the Rust ecosystem?

Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.