Where I have to write PKG_CONFIG_ALLOW_CROSS

I have been trying to understand where I should write PKG_CONFIG_ALLOW_CROSS=1 for correct cross compilation

I got an error:

failed to run custom build command for `x11 v2.21.0`. 

Then I figure out I have to use that argument somewhere

That is an env var. So if you are for example building using cargo build --target x86_64-unknown-linux-gnu you can use PKG_CONFIG_ALLOW_CROSS=1 cargo build --target x86_64-unknown-linux-gnu instead. Be aware however that you do need a copy of all X11 libraries for the target arch (as well as a copy of any other library that your program needs) installed.

Yeah, it didn't work out (thanks in any case I didn't know about second option). It says the same, but adds at the end:

 The pkg-config command could not be found.

So I found windows version, set a path to it, but nothing changed

If you want to compile from Windows, you may be better of using WSL2 rather than trying to get a cross-compilation toolchain working.

1 Like