Bug 16521 - libgdiplus 2.10.9 fails to build with freetype 2.5.1
Summary: libgdiplus 2.10.9 fails to build with freetype 2.5.1
Alias: None
Product: Class Libraries
Classification: Mono
Component: libgdiplus ()
Version: 2.10.x
Hardware: PC Mac OS
: Low minor
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-11-29 18:27 UTC by Ryan Schmidt
Modified: 2014-02-12 17:52 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Ryan Schmidt's patch (101 bytes, text/plain)
2014-01-24 14:11 UTC, Neil Mayhew
Ryan Schmidt's patch (418 bytes, patch)
2014-01-24 14:13 UTC, Neil Mayhew

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ryan Schmidt 2013-11-29 18:27:56 UTC
libgdiplus 2.10.9 fails to build with freetype 2.5.1:

./gdiplus-private.h:33:10: fatal error: 'freetype/tttables.h' file not found
#include <freetype/tttables.h>
1 error generated.

The freetype CHANGES file explains the problem:

CHANGES BETWEEN 2.5 and 2.5.1




    - The header  file layout  has been changed.   After installation,
      all files are now located in `<prefix>/include/freetype2'.

      Applications  that  use   (a)  `freetype-config'  or  FreeType's
      `pkg-config' file to get the include directory for the compiler,
      and (b) the documented way for header inclusion like

        #include <ft2build.h>
        #include FT_FREETYPE_H

      don't need any change to the source code.
Comment 1 Brian Reiter 2013-12-04 00:16:02 UTC
It builds if you tweak the path in gdiplus-private.h.

diff --git a/src/gdiplus-private.h b/src/gdiplus-private.h
index 59edf9e..df8fb17 100644
--- a/src/gdiplus-private.h
+++ b/src/gdiplus-private.h
@@ -30,7 +30,7 @@
 #include <stdio.h>
 #include <math.h>
 #include <glib.h>
-#include <freetype/tttables.h>
+#include <freetype2/tttables.h>
 #include <pthread.h>
 #include <unistd.h>
Comment 2 Ryan Schmidt 2013-12-04 00:45:27 UTC
That is not the correct change to make; this is:

Comment 3 Neil Mayhew 2014-01-24 13:50:12 UTC
This is also a problem on Debian Jessie and Ubuntu Trusty.
Comment 4 Neil Mayhew 2014-01-24 14:11:12 UTC
Created attachment 5917 [details]
Ryan Schmidt's patch

The MacPorts patch works nicely on Linux. I'm attaching a copy of it for convenience.
Comment 5 Neil Mayhew 2014-01-24 14:13:40 UTC
Created attachment 5918 [details]
Ryan Schmidt's patch

Really attaching it this time
Comment 6 Miguel de Icaza [MSFT] 2014-02-12 14:41:06 UTC
This really needs a configure test, and based on the configure test, determine what to include.
Comment 7 Neil Mayhew 2014-02-12 17:04:47 UTC
I disagree. Ryan Schmidt's patched version of the code works with any version of FreeType, on both Linux and Mac, so no configuration test is needed. (I've tested it.) It's actually the way it should have been coded in the first place, and is in line with what the documentation says to do. Although the FreeType header files have moved location, pkg-config takes care of that.

Note that Brian Reiter's patch shown in his comment is different, and would need a configuration test.
Comment 8 Miguel de Icaza [MSFT] 2014-02-12 17:48:32 UTC
Turns out, we already apply this patch on master
Comment 9 Neil Mayhew 2014-02-12 17:52:33 UTC
Yeah, I just noticed that and was in the middle of writing a comment to say so!

Debian (and therefore Ubuntu) already uses this in the form of a patch to an
unofficial tarball made from commit 506df13. However, it really would be nice
to have an official release of 2.11 with a tarball. Since Debian Testing is already using 506df13 + this fix, I assume it is stable enough to consider releasing it.