我正在尝试将此project交叉编译为MinGW。
该项目使用autotools作为构建系统,并依赖于libcurl,CUnit,Jansson和一些gnulib模块。
我为x86_64-w64-mingw32
编译了所有依赖项,并安装在/home/user/mingw64
我跑:
$ 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
我收到了这个错误:
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
是gnulib模块的一部分。所以我认为问题来自Makefile.am:
# Find gnulib headers.
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \
-DLOCALEDIR='"$(localedir)"' \
-Ilib -I$(top_srcdir)/lib \
-Isrc -I$(top_srcdir)/src \
但我无法弄清楚解决方案。我完全遵循gnulib manual中描述的说明。
答案 0 :(得分:3)
我设法找到了解决此问题的方法。显然autotools
并不像我想象的那么容易。
我不得不重新生成gnulib
个模块,这次指定了。{li>
--makefile-name
参数。即
$ gnulib-tool ... --makefile-name=gnulib.mk ...
我从lib/Makefile
中的automake生成的文件中删除了configure.ac
。所以而不是:
dnl Put automake generated files results here
AC_CONFIG_FILES([Makefile
po/Makefile.in
lib/Makefile])
现在我有:
dnl Put automake generated files results here
AC_CONFIG_FILES([Makefile
po/Makefile.in])
我在lib
中删除了SUBDIRS
表单Makefile.am
。即。而不是:
# Subdirectories to descend into.
SUBDIRS = po lib
我有:
# Subdirectories to descend into.
SUBDIRS = po
我在lib
目录中创建了一个名为local.mk
的新文件,其中包含以下内容:
include lib/gnulib.mk
# Allow "make distdir" to succeed before "make all" has run.
dist-hook: $(noinst_LIBRARIES)
.PHONY: dist-hook
并将其纳入Makefile.am
。
include $(top_srcdir)/lib/local.mk
最后我必须运行这个命令:
$ ./build-aux/prefix-gnulib-mk --lib-name=libshill lib/gnulib.mk
就是这样。