Cross compilation using pkg_config crate


I’m trying to cross-compile libudev-sys, which relies on the pkg-config-rs (and pkg_config under it) to find libraries. I was wondering if anyone has any successful examples of cross-compiling a crate that relies on pkg_config, either libudev-sys or another one. I’m a little familiar with cross-compilation in general, but I’m having a hard time understanding what the various environment variables need to be set to, and if any additional packages need to be installed, to make this happen. I’m locally running Fedora, but my CI setup is running Debian/Ubuntu, so examples using either of those platforms would be ideal.


You need to configure system’s pkg-config to look for target, not host, libraries, and then tell pkg_config crate to allow cross compilation:


Thanks, but that’s the overall part of the process I already understood. I’m looking for specific examples that I can reference. Like other crates already doing this.