Cross-compile gnulib-based project for MinGW

I am trying to cross-compile this project in MinGW.

The project uses autotools as a build system and depends on libcurl , CUnit , Jansson, and some gnulib modules.

I have all the dependencies compiled for x86_64-w64-mingw32 and installed under /home/user/mingw64

I run:

 $ gnulib-tool --update $ autoreconf -fi $ CURL_CFLAGS="-I/home/user/mingw64/usr/local/include" \ CURL_LIBS="-L/home/user/mingw64/usr/local/lib -lcurl" \ JANSSON_CFLAGS="-I/home/user/mingw64/usr/local/include" \ JANSSON_LIBS="-L/home/user/mingw64/usr/local/lib -ljansson" \ CUNIT_CFLAGS="-I/home/user/mingw64/usr/local/include" \ CUNIT_LIBS="-L/home/user/mingw64/usr/local/lib -lcunit" \ ./configure --host=x86_64-w64-mingw32 $ make 

And I get this error:

 make all-recursive make[1]: Entering directory '/home/user/projects/shill' Making all in po make[2]: Entering directory '/home/user/projects/shill/po' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/user/projects/shill/po' Making all in lib make[2]: Entering directory '/home/user/projects/shill/lib' make[2]: *** No rule to make target 'lib/errno.h', needed by 'all'. Stop. make[2]: Leaving directory '/home/user/projects/shill/lib' Makefile:1897: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/user/projects/shill' Makefile:1429: recipe for target 'all' failed make: *** [all] Error 2 

errno.h is part of the gnulib modules. Therefore, I think the problem arises from this section in Makefile.am :

 # Find gnulib headers. ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = \ -DLOCALEDIR='"$(localedir)"' \ -Ilib -I$(top_srcdir)/lib \ -Isrc -I$(top_srcdir)/src \ 

But I can not understand the solution. I followed exactly the instructions described in the gnulib manual .

+7
c cross-compiling autotools gnulib
source share
1 answer

I managed to find a workaround for this problem. autotools not to be as simple as I thought.

  • I had to regenerate the gnulib modules, this time specifying --makefile-name . i.e.

     $ gnulib-tool ... --makefile-name=gnulib.mk ... 
  • I removed lib/Makefile from the files generated by the machine in configure.ac . Therefore, instead of:

     dnl Put automake generated files results here AC_CONFIG_FILES([Makefile po/Makefile.in lib/Makefile]) 

    Now I have:

     dnl Put automake generated files results here AC_CONFIG_FILES([Makefile po/Makefile.in]) 
  • I deleted the lib SUBDIRS form in Makefile.am . i.e. Instead:

     # Subdirectories to descend into. SUBDIRS = po lib 

    I have:

     # Subdirectories to descend into. SUBDIRS = po 
  • I created a new file in the lib directory named local.mk with this content:

     include lib/gnulib.mk # Allow "make distdir" to succeed before "make all" has run. dist-hook: $(noinst_LIBRARIES) .PHONY: dist-hook 
  • And included it in Makefile.am .

     include $(top_srcdir)/lib/local.mk 
  • Finally, I had to run this command:

     $ ./build-aux/prefix-gnulib-mk --lib-name=libshill lib/gnulib.mk 

That's all.

+3
source share

All Articles