8

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?

René Nyffenegger
  • 39,402
  • 33
  • 158
  • 293

1 Answers1

4

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.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • Thanks for your valuable help. Unfortunatly, neither option changed anyting, both still produce the same error related to the missing `cygpath`. I found a README (actually called *INSTALL.UNIX* and *UPGRADE.UNIX*, both of which are explicitly stated for MinGW/MSYS use) and the tell me to do basically what I already did. I don't argue that I didn't try hard enough (although I spent 4-5 hours already), but is not the point of the entire ./configure thing not to have to worry about different plattforms? – René Nyffenegger Feb 14 '11 at 21:55
  • 1
    Well, cygpath should not be needed in an msys environment. Are you sure using the mingw makefile from the windows console (cmd.exe) using mingw32-make doesn't work? – rubenvb Feb 15 '11 at 19:23
  • When I open a cmd.exe and cd into `C:\temp\freetype-2.3.5-1\src\freetype\2.3.5\freetype-2.3.5` and do a `mingw32-make.exe -f Makefile.mingw`, after printing lots of lines it finally prints `mingw32-make: *** No rule to make target `MFSED', needed by `all'. Stop.` – René Nyffenegger Feb 17 '11 at 20:58
  • @René: then there's something wrong with their makefile. But your directory structure is pretty deep (probably has nothing to do with your problem though...) – rubenvb Feb 17 '11 at 21:02
  • Thanks for your help. Something must heve gone wrong with my unzipping the sources. I have downloaded another source-zip-file, and it is currently building the library. Seems as though it's going to work this time. – René Nyffenegger Feb 17 '11 at 21:17
  • As time passes by and problems change: I stumbled upon this answer, because the dependency chain of msys2-freetype2 stopped at ole32, which was not part of msys2. Now it is even easier to compile freetype. download the source, open mingw32 /mingw64 shell, `./configure`, `make -j SOME_NUMBER`, done. – scones Apr 06 '15 at 08:23