webrtc-audio-processing icon indicating copy to clipboard operation
webrtc-audio-processing copied to clipboard

Set --host flag for autotools to support cross compilation

Open skywhale opened this issue 4 years ago • 6 comments

https://docs.rs/autotools/0.2.1/autotools/struct.Config.html#method.host It's set automatically, but based on the compilation host. We want the target architecture to be set for --host flag.

skywhale avatar Jun 05 '20 13:06 skywhale

LGTM!

bschwind avatar Jun 05 '20 17:06 bschwind

@skywhale @bschwind Sorry to dig this up after 3 years. Let's finish this. .) Seems like we could just merge? If not, let's close this.

goodhoko avatar Dec 05 '23 13:12 goodhoko

We should probably test before merging though, by successfully cross-compiling this library with this branch.

bschwind avatar Dec 05 '23 14:12 bschwind

I'll give it a try. I just need to make the regular compilation work first. (something something c++ errors out)

goodhoko avatar Dec 05 '23 15:12 goodhoko

@bschwind Tested this by successfully compiling for x86 macOS on an arm macOS. You need to have have the target's rust toolchaing installed and you also need to set PKG_CONFIG_SYSROOT_DIR to this weird value (found out here)

I pushed an additional commit that documents this in the README.

PKG_CONFIG_SYSROOT_DIR=/ cargo build --target x86_64-apple-darwin 

goodhoko avatar Dec 06 '23 10:12 goodhoko

@skywhale

Do you remember why you wrote this?

We want the target architecture to be set for --host flag.

Yes, rust's "target" is "host" in autotools's nomenclature, but the autotools crate docs say:

The host and target methods on this package’s autotools::Config structure (as well as the $HOST and $TARGET variables set by cargo) are understood with their Rust meaning.

Anyway, I think I've lost too much time on this trying to debug opaque autoconf//gcc/cc errors. If anyone else won't pick this up let's close it as stale.

goodhoko avatar Dec 07 '23 10:12 goodhoko