我尝试使用 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 实用程序(参见此处)将 unix-paths 转换为 windows-paths,反之亦然。
现在,a¨find . -type f -exec grep -l cygpath {} \;
找到了几个使用的位置cygpath
:
- ./builds/unix/aclocal.m4
- ./builds/unix/configure
- ./builds/unix/unix-def.in
- ./builds/unix/unix-def.mk
- ./patches/freetype-2.3.4.diff
- ./patches/freetype-2.3.5/builds/unix/unix-def.mk
- ./patches/freetype-2.3.5.diff
而且我认为我必须在其中一个或多个位置进行更改才能修复构建。正确的?我仍然希望对整个 ./configure-build 过程有更多了解的人可以就这个问题给我一个提示。
更新二:从rubenvb 的回答,我想我可以尝试./configure --build=i686-pc-mingw32
,然后删除行阅读
TOP_DIR := $(shell cd $(TOP_DIR); cygpath -m `pwd`)
inbuilds/unix/unix-def.mk
然后更改行读数
RCTOOL_COMPILE = RCTOOL
至
RCTOOL_COMPILE = $(RCTOOL)
./builds/freetype.mk
并复制http://gnuwin32.sourceforge.net/rctool.sh.txt到(c:\mingw\bin
因为缺少. _rctool.sh
make
现在,源文件的编译似乎(至少部分)终于完成了,尽管我收到 了很多警告,比如
./src/base/ftcalc.c:75:3: warning: 'FT_RoundFix' redeclared without dllimport attribute: previous dllimport ignored
但是链接器无法链接 *.o 文件,因为有许多未定义的引用,例如
C:\temp\freetype-2.3.5-1\src\freetype\2.3.5\freetype-2.3.5/src/base/ftinit.c:89: undefined reference to `_imp__FT_Add_Module'
我猜编译警告与链接器错误并非无关。
所以现在怎么办?