I know the standard way of cross compiling an autoconf-based project:
$ ./configure --host=i686-w64-mingw32
However, what if I want to use ccache?
I know I can override the CC and CXX variables (e.g CC="ccache i686-w64-mingw32-gcc" ./configure --host=i686-w64-mingw32). However, this seems redundant and error prone.
Is there a standard way, I'm missing, like some CC_PREFIX variable?
"building a cross-compiler is significantly harder than building a compiler that targets the platform it runs on." The problem exists due to the way libraries are built and accessed. In the normal situation all the libraries are located in a specific spot, and are used by all apps on that system.
GCC, a free software collection of compilers, can be set up to cross compile. It supports many platforms and languages. Cross-compiling GCC requires that a portion of the target platform's C standard library be available on the host platform.
There isn't, if you want to use ccache you'll have to change your CC
/CXX
parameters as well as passing --host
.
By the way, prefer
./configure --host=i686-w64-mingw32 \
CC="ccache i686-w64-mingw32-gcc" CXX="ccache i686-w64-mingw32-g++"
rather than pre-fixing the environment variables. This way they will be correctly recorded as overrides in config.log
/config.cache
if you're using maintainer mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With