有人用MinGW / MSYS成功编译了freetype吗?

时间:2011-02-13 22:30:17

标签: cygwin mingw gnu-make freetype cygpath

我试图用MinGW / MSYS

编译freetype是不成功的

这就是我的所作所为:

cmd.exe我切换到MSYS

C:\temp\freetype-2.3.5-1\src\freetype\2.3.5\freetype-2.3.5>bash

然后调用configure脚本

bash-3.1$ ./configure

FreeType build system -- automatic system detection

The following settings are used:

  platform                    unix
  compiler                    cc
  configuration directory     ./builds/unix
  configuration rules         ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).

cd builds/unix; ./configure
checking build system type... i686-pc-mingw32

[------ Deleted some 121 lines because they seem irrelevant for the problem ------]

config.status: creating ftconfig.h
make: Nothing to be done for `unix'.

配置freetype后,我想使用make来编译源代码:

bash-3.1$ make
/bin/sh: cygpath: command not found
config.mk:36: /builds/freetype.mk: No such file or directory
config.mk:57: /builds/unix/install.mk: No such file or directory
builds/toplevel.mk:158: /builds/modules.mk: No such file or directory
make: *** No rule to make target `/builds/modules.mk'.  Stop.

问题似乎是 cygpath ,这很奇怪,因为我还没有安装cygwin。

由于编译指令要求 gnu make ,我验证了这一点:

bash-3.1$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-msys

我做错了什么?

修改:目录中还有Makefile.mingw。尝试使用make -f Makefile.mingw开始编译过程也没有完成,返回消息¨make: *** No rule to make target 'MFSED', needed by 'all'. Stop.

更新好的,我已经对此事做了一些侦探调查,似乎问题是精确因为我没有安装CygWin。我有这个假设,因为cygpath是一个CygWin实用程序(See here),它将unix路径转换为windows路径,反之亦然。

现在,¨find . -type f -exec grep -l cygpath {} \;找到了几个使用cygpath的位置:

  • ./建立/ UNIX / aclocal.m4
  • ./建立/ UNIX /配置
  • ./建立/ UNIX / unix-def.in
  • ./建立/ UNIX / unix-def.mk
  • ./贴剂/ freetype的-2.3.4.diff
  • ./贴剂/ freetype的-2.3.5 /建立/ UNIX / unix-def.mk
  • ./贴剂/ freetype的-2.3.5.diff

我认为我必须在一个或多个这些位置更改某些内容以修复构建。对?我仍然希望那些对整个./configure-build过程有更多了解的人可以给我一个提示。

更新II :来自 rubenvb的回答,我想我可以尝试./configure --build=i686-pc-mingw32然后然后删除行读取

TOP_DIR := $(shell cd $(TOP_DIR); cygpath -m `pwd`)

builds/unix/unix-def.mk然后更改行读数

RCTOOL_COMPILE = RCTOOL

RCTOOL_COMPILE = $(RCTOOL)
<{1>}中的

以及将http://gnuwin32.sourceforge.net/rctool.sh.txt复制到./builds/freetype.mk(由于缺少c:\mingw\bin而出现奇怪错误)和然后启动使用rctool.sh编译过程。

现在,源文件的编译似乎(至少部分地)最终完成,尽管我已经许多警告,如

make

但链接器无法链接* .o文件,因为有许多未定义的引用,如

./src/base/ftcalc.c:75:3: warning: 'FT_RoundFix' redeclared without dllimport attribute: previous dllimport ignored

我猜编译警告与链接器错误无关。

那么,现在呢?

1 个答案:

答案 0 :(得分:4)

通常,在Windows上编译unix / linux软件可以有两种方式:

  1. 使用MSYS或Cygwin中的现有配置脚本。

  2. 使用cmd.exe(windows shell)中提供的mingw makefile。

  3. 你尝试了第一次(但我认为不够努力),并且第二次尝试错了:

    1. 尝试传递--host=i686-pc-mingw32进行配置。脚本告诉你它检测到unix构建,这是非常错误的,你可以看到,它不起作用。

    2. 您也可以直接从cmd.exe使用mingw32-make来使用您找到的makefile.mingw。它应该可以正常工作。

    3. 尝试在主源目录中找到README或INSTALL文件。它应该告诉你该做什么,并且可能有一个特定于Windows的部分。

相关问题