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

发布于 2024-10-17 08:53:19 字数 3869 浏览 7 评论 0原文

我尝试使用 MinGW/MSYS 编译 freetype 失败,

这就是我所做的:

cmd.exe 切换到 MSYS

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

然后调用 configure script

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: *** Norule to make target 'MFSED', need by '全部'。停止。

更新 好的,我对此事做了一些侦探调查,看来问题正是因为我没有安装 CygWin。我有这个假设,因为 cygpath 是一个 CygWin 实用程序(请参阅此处),它将 unix 路径转换为 ​​windows 路径,反之亦然。

现在,一个 ¡find 。 -type f -exec grep -l cygpath {} \; 查找使用 cygpath 的多个位置:

  • ./builds/unix/aclocal.m4
  • ./builds/unix/configure
  • ./构建/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 然后 删除builds/unix/unix-def.mk中的行读取

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

,然后然后将行读取更改

RCTOOL_COMPILE = RCTOOL

RCTOOL_COMPILE = $(RCTOOL)

./builds/freetype.mk中的行 并复制 http://gnuwin32.sourceforge.net/rctool.sh.txt< /a> 到 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'

我猜编译警告

与链接器错误不无关系。那么,现在怎么办?

I am unsucessful trying to compile freetype with MinGW/MSYS

Here's what I do:

From cmd.exe I switch in to MSYS:

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

And then call the configure script

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'.

After configuring freetype, I want to use make to compile the sources:

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.

The problem seems to be cygpath, which is strange, because I haven't installed cygwin.

Since the compile instructions mandate gnu make, I verified this:

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

What do I do wrong?

Edit: There is also Makefile.mingw in the directory. Trying to start the compile process with make -f Makefile.mingw doesn't finish either, returning the message ¨make: *** No rule to make target 'MFSED', needed by 'all'. Stop..

Update Ok, I have done some detective investigations into the matter, and it seems that the problem is precisly because I haven't installed CygWin. I have this assumption because cygpath is a CygWin utility (See here) that converts unix-paths to windows-paths and vice versa.

Now, a ¨find . -type f -exec grep -l cygpath {} \; finds several locations where cygpath is used:

  • ./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

and I think I'd have to change something in one or more of these locations to fix the build. Right? I am still hoping that someone with more knowledge about the entire ./configure-build process can give me a hint on the issue.

Update II: From rubenvb's answer, I figured I could try ./configure --build=i686-pc-mingw32 and then remove the line reading

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

in builds/unix/unix-def.mk and then change the line reading

RCTOOL_COMPILE = RCTOOL

to

RCTOOL_COMPILE = $(RCTOOL)

in ./builds/freetype.mk and also copying http://gnuwin32.sourceforge.net/rctool.sh.txt to c:\mingw\bin (since there were strange errors because of the missing rctool.sh) and then start the compile process with make.

Now, the compilation of the source files seemed to (at least partially) complete at last, although I have gotten many warnings like

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

But the linker is unable to link the *.o files because there are many undefined references like

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'

I guess the compile-warnings are not unrelated to the linker errors.

So, what now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你只要分分秒秒 2024-10-24 08:53:19

一般来说,在Windows上编译unix/linux软件有两种方法:

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

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

您尝试了第一个(但我认为不够努力),但第二个错误:

  1. 尝试传递 --host=i686-pc-mingw32 进行配置。该脚本告诉您它检测到一个 unix 版本,这是严重错误的,正如您所看到的,它不起作用。

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

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

In general, compiling unix/linux software on Windows can go two ways:

  1. Use the existing configure scripts from MSYS or Cygwin.

  2. Use a supplied mingw makefile from cmd.exe (the windows shell).

You tried the first (but I think not hard enough), and did the second one wrong:

  1. Try passing --host=i686-pc-mingw32 to configure. The script is telling you it detects a unix build, which is horribly wrong and as you can see, does not work.

  2. You can also use mingw32-make directly from cmd.exe to use the makefile.mingw you have found. It should work fine.

Try to locate a README or INSTALL file in the main source directory. It should tell you what to do and probably has a windows specific section.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文