Heads up, apparent change in MacPorts borks jdk9 build on Mac

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Mon Feb 3 20:00:24 UTC 2014

On 2014-02-03 17:55, David Chase wrote:
> On 2014-02-03, at 9:59 AM, Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com> wrote:
>> You seem to have gotten a mismatch due to several versions of freetype installed.
> At first I agreed with you, but after looking a little more I think I have been using the same one all along,
> and it just changed.  Perhaps this is just an early warning. Or perhaps my X11 is old and stale.

I'm sure there's a mixup here, and it's starting to be clearer for me 

Checking step by step:

>> In file included from /Users/dr2chase/work/jdk9/jdk/src/share/native/sun/font/freetypeScaler.c:34:
>> /usr/X11/include/ft2build.h:56:38: warning: freetype/config/ftheader.h: No such file or directory
When building, we do include the ft2build.h from /usr/X11. This is 
incorrect, given your configuration.

> configure:44157: checking for FREETYPE
> configure:44164: $PKG_CONFIG --exists --print-errors "freetype2"
> configure:44167: $? = 0
> configure:44180: $PKG_CONFIG --exists --print-errors "freetype2"
> configure:44183: $? = 0
> configure:44218: result: yes
> configure:44235: checking for freetype
> configure:44237: result: yes (using pkg-config)
> configure:46621: checking if we can compile and link with freetype
> configure:46646:  /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp  -L/opt/local/lib -lfreetype >&5
> configure:46646: $? = 0
> configure:46648: result: yes
So, we use pkg-config to locate freetype, and it is found in 
/opt/local/. This seems correct.

> spec.gmk:FREETYPE_CFLAGS:=-I/opt/local/include/freetype2
... and it's properly exported.

> I don't know what your basis for "it seems unlikely" is.
That I forgot about pkg-config. :-) Sorry, it is of course completely 
reasonable that configure works like this.
>> Using the --with-freetype option is the preferred mode, instead of modifying system files.
> I thought the preferred mode was for configure to work properly without human intervention :-).
Yeah, yeah... :-)

> dr2chase:~ dr2chase$ which pkg-config
> /opt/local/bin/pkg-config
> That looks like a likely cause, but that appears to be the only pkg-config on the box.
I think pkg-config is working alright. And you surely did right to 
install freetype.

I think the cause of the issue is, as Omair wrote in another mail, is 
that freetype headers have changed their structure. If you updated, you 
might just have gotten the new version. However, since the pattern to 
include freetype properly is:
         #include <ft2build.h>
         #include FT_FREETYPE_H
(which is what we do), this *should* have expanded to a correct include 

But if ft2build.h is picked up from /usr/X11, then it's not updated to 
match the new layout, but it probably still expands to the old paths for 
the rest of the include files. And that path has changed.

So I'm guessing we're putting /usr/X11 before the freetype include in 
the compiler command line, and that this is the cause of failure. 
*checking* Yep, that seems to be the case.

Can you please try the following patch and see if it solves your problem?

diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk
--- a/make/lib/Awt2dLibraries.gmk
+++ b/make/lib/Awt2dLibraries.gmk
@@ -792,9 +792,9 @@

+    $(FONT_HEADERS) \
      $(X_CFLAGS) \
-    $(FONT_HEADERS) \
      -I$(JDK_TOPDIR)/src/share/native/sun/font \
      -I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
      -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \


More information about the build-dev mailing list