Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has someone successfully compiled freetype with MinGW/MSYS?

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?

like image 534
René Nyffenegger Avatar asked Feb 13 '11 22:02

René Nyffenegger


1 Answers

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.

like image 129
rubenvb Avatar answered Nov 22 '22 03:11

rubenvb