我尝试使用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路径转换为Windows路径,反之亦然。
现在,¨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过程的人能够给我一些提示。
更新II:根据rubenvb的答案,我想我可以尝试./configure --build=i686-pc-mingw32
,然后删除读取的行
TOP_DIR := $(shell cd $(TOP_DIR); cygpath -m `pwd`)
在
builds/unix/unix-def.mk
文件中,然后更改读取行。RCTOOL_COMPILE = RCTOOL
to
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'
我猜编译警告与链接错误有关联。那么,现在怎么办?
cygpath
相关的相同错误。我找到了一个 README(实际上称为 INSTALL.UNIX 和 UPGRADE.UNIX,都明确说明是用于 MinGW/MSYS),并告诉我基本上已经做了我已经做过的事情。我不会争论我没有尽力而为(虽然我已经花了4-5个小时),但整个 ./configure 的目的不是让我们不必担心不同的平台吗? - René NyffeneggerC:\ temp \ freetype-2.3.5-1 \ src \ freetype \ 2.3.5 \ freetype-2.3.5
,然后运行mingw32-make.exe -f Makefile.mingw
,它会打印很多行,最终打印mingw32-make:***没有规则可以制作目标
MFSED',需要all'。停止。
- René Nyffenegger./configure
,make -j SOME_NUMBER
,完成。 - scones