Cannot be cross-built without QEMU interpreters
(Moved over from & tested against !1 (merged))
During my Void packaging of geonames it appeared that cross builds (e.g. x86_64-glibc -> x86_64-musl or x86_64-glibc -> aarch64-glibc) fail without a QEMU wrapper (build_helper="qemu"):
=> libgeonames-0.2.0r92_1: running do_build ...
[ 10%] Building C object src/CMakeFiles/mkdb.dir/geonames-mkdb.c.o
[ 20%] Linking C executable mkdb
[ 20%] Built target mkdb
[ 30%] Generating cities.compiled
/bin/sh: line 1: mkdb: command not found
make[2]: *** [src/CMakeFiles/locales-gen.dir/build.make:77: src/cities.compiled] Error 127
make[1]: *** [CMakeFiles/Makefile2:208: src/CMakeFiles/locales-gen.dir/all] Error 2
Investigating the build directory afterwards, it appears compile-time tool mkdb is built against the target (in this case aarch64-musl) instead of the host (x86_64-glibc):
void-packages $ cd masterdir/builddir/geonames-*
geonames-e64a781891ad061c96ad42af28af072cf645d541 $ file build/src/mkdb
build/src/mkdb: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, BuildID[sha1]=a1bda5bda8a972ea8dc60523f1edfb6a42a26c38, with debug_info, not stripped
This is definitely not ideal as generating the cities.compiled datebase under QEMU is insanely slow (whole package takes ~30 seconds to build against host arch & ~3 minutes when cross-building with QEMU interpreters involved!).
Additionally cross builds (via QEMU for now) don't seem to work without also installing gtkdoc-scangobj in the target chroot (as well as the host):
[ 66%] Generating geonames.signals
CMake Error: Error processing file: GTKDOC_SCANGOBJ_WRAPPER-NOTFOUND
make[2]: *** [doc/reference/CMakeFiles/doc-geonames.dir/build.make:118: doc/reference/geonames.signals] Error 1
Couldn't the gtkdoc-scangobj from the host be used here instead of the target? Perhaps this one will go away when QEMU isn't involved anymore.
@mariogrip suggested we need to do some stuff like https://stackoverflow.com/questions/36173840/how-to-instruct-cmake-to-use-the-build-architecture-compiler to start building mkdb for the host architecture instead of the target one.