[英]Cross-compile a gnulib based project to MinGW
I am trying to cross-compile this project to MinGW. 我正在尝试将此项目交叉编译为MinGW。
The project uses autotools as the build system, and depends on libcurl , CUnit , Jansson and some gnulib modules. 该项目使用autotools作为构建系统,并依赖于libcurl , CUnit , Jansson和一些gnulib模块。
I have all the dependancies compiled for x86_64-w64-mingw32
and installed under /home/user/mingw64
我有为x86_64-w64-mingw32
编译的所有依赖项并安装在/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. errno.h
是gnulib模块的一部分。 So I think that the problem comes from this section in the Makefile.am : 所以我认为问题来自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't figure out the solution. 但我无法弄清楚解决方案。 I followed exactly the instructions described in the gnulib manual . 我完全按照gnulib手册中的说明进行操作 。
I managed to find a workaround for this issue. 我设法找到了解决此问题的方法。 Apparently autotools
aren't as easy as I thought they are. 显然autotools
并不像我想象的那么容易。
I had to regenerate gnulib
modules, this time specifying the --makefile-name
parameter. 我不得不重新生成gnulib
模块,这次指定了--makefile-name
参数。 ie. 即。
$ gnulib-tool ... --makefile-name=gnulib.mk ...
I removed lib/Makefile
from automake generated files in configure.ac
. 我从configure.ac
automake生成的文件中删除了lib/Makefile
。 So 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 removed lib
form SUBDIRS
in Makefile.am
. 我在Makefile.am
删除了lib
表单SUBDIRS
。 ie. 即。 Instead of: 代替:
# Subdirectories to descend into. SUBDIRS = po lib
I have: 我有:
# Subdirectories to descend into. SUBDIRS = po
I created a new file in lib
directory called local.mk
with this content: 我在lib
目录中创建了一个名为local.mk
的新文件, local.mk
包含以下内容:
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
. 并将其包含在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 was it. 就是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.