将基于gnulib的项目交叉编译到MinGW [英] Cross-compile a gnulib based project to MinGW

查看:79
本文介绍了将基于gnulib的项目交叉编译到MinGW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将此项目交叉编译到MinGW.

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

该项目使用自动工具作为构建系统,并依赖于 libcurl CUnit Jansson 和一些gnulib模块.

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

我已经为 x86_64-w64-mingw32 编译了所有依赖关系,并安装在/home/user/mingw64

I have all the dependancies compiled for x86_64-w64-mingw32 and installed under /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 中的本节中>:

errno.h is part of the gnulib modules. So I think that the problem comes from this section in the Makefile.am:

# Find gnulib headers.
ACLOCAL_AMFLAGS = -I m4

AM_CPPFLAGS = \
  -DLOCALEDIR='"$(localedir)"' \
  -Ilib -I$(top_srcdir)/lib \
  -Isrc -I$(top_srcdir)/src \

但是我不知道解决方案.我完全按照 gnulib手册中所述的说明进行操作.

But I can't figure out the solution. I followed exactly the instructions described in the gnulib manual.

推荐答案

我设法找到了解决此问题的方法.显然 autotools 并不像我想象的那么容易.

I managed to find a workaround for this issue. Apparently autotools aren't as easy as I thought they are.

  1. 我不得不重新生成 gnulib 模块,这次指定了-makefile-name 参数.即.

  1. I had to regenerate gnulib modules, this time specifying the --makefile-name parameter. ie.

$ gnulib-tool ... --makefile-name=gnulib.mk ...

  • 我从 configure.ac 中自动生成的文件中删除了 lib/Makefile .因此,代替:

  • I removed lib/Makefile from automake generated files in configure.ac. So instead of:

    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])
    

  • 我从 Makefile.am 中的 SUBDIRS 中删除了 lib .IE.代替:

  • I removed lib form SUBDIRS in Makefile.am. ie. Instead of:

    # Subdirectories to descend into.
    SUBDIRS = po lib
    

    我有:

    # Subdirectories to descend into.
    SUBDIRS = po
    

  • 我在 lib 目录中创建了一个名为 local.mk 的新文件,其内容如下:

  • I created a new file in lib directory called 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
    

  • 并将其包含在 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
    

  • 就是这样.

    这篇关于将基于gnulib的项目交叉编译到MinGW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆