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

David Chase david.r.chase at oracle.com
Mon Feb 3 16:55:34 UTC 2014

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.

> The output from the build is:
>> 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
> which indicates that you are using freetype from /usr/X11/include. This is likely what configure will autodetect. If you check the configure output, what does it say about freetype?

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
configure:46707: checking if we should bundle freetype
configure:46712: result: no

and grepping for freetype yields (among others):

config.log:configure:44164: $PKG_CONFIG --exists --print-errors "freetype2"
config.log:configure:44180: $PKG_CONFIG --exists --print-errors "freetype2"
config.log:configure:44235: checking for freetype
config.log:configure:46621: checking if we can compile and link with freetype
config.log:configure:46646:  /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp  -L/opt/local/lib -lfreetype >&5
config.log:configure:46707: checking if we should bundle freetype
config.log:configure:47075: /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp -ljpeg   >&5
config.log:configure:47233: /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp -lz   >&5
config.log:configure:47317: /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp  >&5
config.log:configure:47360: /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp -lm   >&5
config.log:configure:47419: /usr/bin/g++ -o conftest  -I/opt/local/include/freetype2    conftest.cpp -ldl   >&5
config.log:pkg_cv_FREETYPE_CFLAGS='-I/opt/local/include/freetype2 '
config.log:pkg_cv_FREETYPE_LIBS='-L/opt/local/lib -lfreetype '
config.log:CXXFLAGS=' -I/opt/local/include/freetype2 '
config.log:FREETYPE_CFLAGS='-I/opt/local/include/freetype2 '
config.log:FREETYPE_LIBS='-L/opt/local/lib -lfreetype'

config.status:S["FREETYPE_LIBS"]="-L/opt/local/lib -lfreetype"
config.status:S["FREETYPE_CFLAGS"]="-I/opt/local/include/freetype2 "
config.status:S["CXXFLAGS"]=" -I/opt/local/include/freetype2 "

spec.gmk:FREETYPE_LIBS:=-L/opt/local/lib -lfreetype
spec.gmk:#CXXFLAGS:= -I/opt/local/include/freetype2 

>> Apparently configure picked up the MacPorts freetype2, but that changed in a recent update.
> That seems unlikely that it should have picked that up by itself. Did you set --with-freetype at any point? Do you have any configure logs from the old build?

I don't know what your basis for "it seems unlikely" is.
I did not set --with-freetype, so to me it appears not only likely, but certain, that it picked that up by itself.
(I think I would have mentioned this....)

I looked at the logs from the old build, and they appear to be identical to the logs with the symbolic link
added, since I did not touch the flags.  It's "unlikely" (that word again) that adding the link would change
things, since it made the mistake without the link and the added link merely causes the build to succeed.

>> Another option might have been to try setting
>> --with-freetype-include specify directory for the freetype include files
> 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 :-).

> Nevertheless, I'm curious if configure really did pick up freetype automatically in the /opt/local system before, but not now. It might be due to pkg-config.
> Can you try running "pkg-config --cflags freetype2" and post the output? If you have access to a machine without this change in packaging, can you try the same command there?

dr2chase:~ dr2chase$ pkg-config --cflags freetype2

dr2chase:~ dr2chase$ ls -l /opt/local/include/freetype2/freetype
lrwxr-xr-x  1 root  admin  12 Jan 31 15:35 /opt/local/include/freetype2/freetype -> ../freetype2

dr2chase:~ dr2chase$ sudo rm /opt/local/include/freetype2/freetype

dr2chase:~ dr2chase$ pkg-config --cflags freetype2

dr2chase:~ dr2chase$ 


dr2chase:~ dr2chase$ which pkg-config

That looks like a likely cause, but that appears to be the only pkg-config on the box.
(Checked /bin, /usr/bin, /usr/local/bin, /etc, /usr/etc, /usr/sbin, /sbin )

Was my mistake installing freetype?  Lots of stuff depends on it:

dr2chase:macosx-x86_64-normal-server-fastdebug dr2chase$ port dependents freetype
R depends on freetype
Xft2 depends on freetype
cairo depends on freetype
dvipng depends on freetype
fontconfig depends on freetype
gd2 depends on freetype
ghostscript depends on freetype
graphviz depends on freetype
harfbuzz depends on freetype
librsvg depends on freetype
libsdl_ttf depends on freetype
libwmf depends on freetype
poppler depends on freetype
texlive-bin depends on freetype

More information about the build-dev mailing list