I am trying to cross compile libiconv-1.13.1 for windows using mingw32. I have got a custom toolchain placed in /usr/i686-w64-mingw32/bin/ This is for the NetSurf browser project. I have set the paths to use this toolchain before calling configure:
sudo CC="/usr/i686-w64-mingw32/bin/i686-w64-mingw32-gcc -B/usr/i686-w64-mingw32/bin/i686-w64-mingw32-ld" AR="/usr/i686-w64-mingw32/bin/i686-w64-mingw32-gcc-ar" RANLIB="/usr/i686-w64-mingw32/bin/i686-w64-mingw32-gcc-ranlib" CFLAGS="-I/usr/i686-w64-mingw32/i686-w64-mingw32/include -DNO_FSEEKO" LDFLAGS="-L/usr/i686-w64-mingw32/i686-w64-mingw32/lib" ./configure --prefix=/usr/i686-w64-mingw32/ --host=i686-w64-mingw32 --disable-shared
So the configure finished and compilation started. The include path is shown in the compile commands so its set correctly. There is a step involving windres:
/bin/bash ../libtool --mode=compile --tag=RC i686-w64-mingw32-windres `/bin/sh ./../windows/windres-options --escape 1.13.1` -i ./../windows/libiconv.rc -o libiconv.res.lo --output-format=coff libtool: compile: i686-w64-mingw32-windres -DPACKAGE_VERSION_STRING=\\"1.13.1\\" -DPACKAGE_VERSION_MAJOR=1 -DPACKAGE_VERSION_MINOR=13 -DPACKAGE_VERSION_SUBMINOR=1 -i ./../windows/libiconv.rc --output-format=coff -o libiconv.res.o ./../windows/libiconv.rc:3:10: fatal error: winver.h: No such file or directory 3 | #include <winver.h> | ^~~~~~~~~~ compilation terminated. i686-w64-mingw32-windres: preprocessing failed. make[1]: *** [Makefile:93: libiconv.res.lo] Error 1
It seems that the include path was not passed when i686-w64-mingw32-windres was invoked on windows/libiconv.rc The include path ‘/usr/i686-w64-mingw32/i686-w64-mingw32/include’ does have the file winver.h
I am not familiar with how to pass an include path to this tool. There is a windres option file beside the .rc file: https://git.savannah.gnu.org/gitweb/?p=libiconv.git;a=blob;f=windows/windres-options;h=779fddec305d1e78f1e5c3123683b3c380e4a82e;hb=HEAD
Maybe I need to change something in the configure script: https://git.savannah.gnu.org/gitweb/?p=libiconv.git;a=tree;hb=HEAD
So any help with this error would be really helpful. Thanks.