Closed ggtrigg closed 3 years ago
As the output suggests, you have to configure pkg-config correctly for cross-compilation:
pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.
That doesn't seem to be a very helpful response. I haven't done anything with pkg-config and it's managed to cross-compile all the other crates. Or am I missing something? (And the pkc-config output I provided shows that it's picking up the arm-linux-gnueabihf paths for include files & libraries.)
The error in question comes from https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L316 . You'll have to check the documentation of that crate and generally the pkg-config documentation for how to set up things properly, this has nothing to do with glib-sys. It also seems curious that you have set up PKG_CONFIG_SYSROOT_DIR=/
, usually the sysroot for cross-compilation is a directory somewhere else.
Maybe also this blog post will help you.
Sigh. I have been following that blog post and my dockerfile is almost exactly the same as theirs (just exchanging the libgstreamer dev package with gtk dev packages). I have also tried a myriad of different environment variables, including anything that should be preventing the CrossCompilation error but to no avail. And the fact that when I connect to the container and run pkg-config with it returning the correct paths for the target environment is causing more confusion. Sounds like I'd better start a conversation on the pkg-config-rs crate page then.
Yeah that would be a better place. But also I'm not sure why target_supported()
returns false
in that linked code for you. It should go into the None
case and then PKG_CONFIG_SYSROOT_DIR
is set so it should return true
.
For completion here, it seems like cross
isn't doing everything it's supposed to be doing (& I'm not really sure what that is).
If I manually run the container with the appropriate host directories mounted and run (in the container) crate build --target armv7-unknown-linux-gnueabihf
and with PKG_CONFIG_ALLOW_CROSS=1
then the build is successful and the binary runs nicely on the Pi.
Thanks for taking the time to engage and provide pointers.
I'm attempting to build a gtk-based app for my raspberry-pi and am using
cross
to cross-compile it for that architecture. Currently the cross-compile is failing and so far my attempts at finding solutions haven't been successful. On the container that cross is using I can confirm thatpkg-config
is working...yet here is the
cross
output...cross_output.txt
Any suggestions/solutions would be greatly appreciated.
(And if it's useful, here's the environment in the container...
)