Bug 75652

Summary: Freetype fails to build from Git because of unresolvable dependency on Harfbuzz.
Product: freetype Reporter: John Ralls <jralls>
Component: generalAssignee: Werner Lemberg <wl>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: brion, freedesktop
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Config.log from failed build

Description John Ralls 2014-03-01 23:59:43 UTC
Freetype requires Harfbuzz's freetype backend, but Harfbuzz needs Freetype to build the Harfbuzz backend.

Freetype checks pkgconfig for Harfbuzz during configure and fails if it's not present. Building Harfbuzz first works, except that building Freetype fails with:

In file included from /Users/john/Development/gtk-sources/freetype2/src/autofit/autofit.c:21:
In file included from /Users/john/Development/gtk-sources/freetype2/src/autofit/afpic.c:23:
In file included from /Users/john/Development/gtk-sources/freetype2/src/autofit/afglobal.h:26:
/Users/john/Development/gtk-sources/freetype2/src/autofit/hbshim.h:31:10: fatal error:
      'hb-ft.h' file not found
#include <hb-ft.h>
         ^
1 error generated.
make: *** [/Users/john/Development/gtk-sources/freetype2/objs/autofit.lo] Error 1
Comment 1 Werner Lemberg 2014-03-02 06:35:20 UTC
Yes, the chicken-and-egg problem is unfortunate.  Behdad told me he is going to split HarfBuzz into two libraries (or something like that) to avoid this issue.

For the moment, please do

  ./configure --without-harfbuzz

then build and install FreeType.  Then build and install HarfBuzz, then for FreeType do

  make distclean
  ./configure

and build and install FreeType again.
Comment 2 Werner Lemberg 2014-03-03 06:23:29 UTC
Please test the current git of FreeType; I've completely rewritten the library detection to use only what gets detected.  In other words, simply doing

  . configure, build, install FreeType
  . configure, build, install HarfBuzz
  . `make distclean', then again configure, build, install FreeType

should work now without any additional configure options.  Of course, the chicken-and-egg situation is still there.
Comment 3 John Ralls 2014-03-04 22:10:24 UTC
Nice try, but fail:
./builds/unix/libtool --mode=compile /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -ansi -I/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/objs -I./builds/unix -I/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/include -c -Wall -O2 -arch i386 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -DDARWIN_NO_CARBON   -DFT_CONFIG_OPTION_SYSTEM_ZLIB -I/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst/include/libpng15   -DFT_CONFIG_OPTION_USE_PNG  -DFT_CONFIG_OPTION_USE_HARFBUZZ -DFT_CONFIG_CONFIG_H="<ftconfig.h>" -DFT2_BUILD_LIBRARY -DFT_CONFIG_MODULES_H="<ftmodule.h>"  -I/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/pshinter -o /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/objs/pshinter.lo /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/pshinter/pshinter.c
In file included from /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/autofit/autofit.c:21:
In file included from /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/autofit/afpic.c:23:
In file included from /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/autofit/afglobal.h:26:
/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/src/freetype2/src/autofit/hbshim.h:29:10: fatal error:
      'hb.h' file not found
#include <hb.h>
         ^
Comment 4 Werner Lemberg 2014-03-05 05:51:34 UTC
This is not enough information to find out why the HarfBuzz test was (apparently incorrectly) successful at configure time.  What are the configure options, and what does config.log say about harfbuzz?
Comment 5 John Ralls 2014-03-05 06:05:14 UTC
Created attachment 95133 [details]
Config.log from failed build

Configure correctly determined that harfbuzz shouldn't be built, probably because it got the --without-harfbuzz parameter. Jam tried to build it anyway.

This was, by the way, a clean checkout and build.
Comment 6 Werner Lemberg 2014-03-05 07:05:13 UTC
Thanks.  It was a typo.  Fixed now in git.
Comment 7 John Ralls 2014-03-06 17:20:04 UTC
OK, that works, thanks.

One oddity: 

make distclean && ./configure --prefix /Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst --libdir '/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst/lib' --without-bzip2  CFLAGS="$CFLAGS -std=c99"
rm -f builds/unix/config.cache
rm -f builds/unix/config.log
rm -f builds/unix/config.status
rm -f builds/unix/unix-def.mk
rm -f builds/unix/unix-cc.mk
rm -f builds/unix/freetype2.pc
rm -f nul

FreeType build system -- automatic system detection

The following settings are used:

  platform                    unix
  compiler                    /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
  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 `/Applications/Xcode.app/Contents/Developer/usr/bin/make' again to build the library,
or `/Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc' to build the API reference (the latter needs python).

Generating modules list in ./objs/ftmodule.h...
* module: truetype  (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1     (Postscript font files with extension *.pfa or *.pfb)
* module: cff       (OpenType fonts with extension *.otf)
* module: cid       (Postscript CID-keyed fonts, no known extension)
* module: pfr       (PFR/TrueDoc font files with extension *.pfr)
* module: type42    (Type 42 font files with no known extension)
* module: winfnt    (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf       (pcf bitmap fonts)
* module: bdf       (bdf bitmap fonts)
* module: sfnt      (helper module for TrueType & OpenType formats)
* module: autofit   (automatic hinting module)
* module: pshinter  (Postscript hinter module)
* module: raster    (monochrome bitmap renderer)
* module: smooth    (anti-aliased bitmap renderer)
* module: smooth    (anti-aliased bitmap renderer for LCDs)
* module: smooth    (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux     (Postscript Type 1 & Type 2 helper module)
* module: psnames   (Postscript & Unicode Glyph name handling)
done.
cd builds/unix; /bin/sh ./configure  '--prefix' '/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst' '--libdir' '/Users/john/Development/gtk-build/gtk-unstable-10.9-i386/inst/lib' '--without-bzip2' 'CFLAGS=-O2 -arch i386 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -std=c99'
/bin/sh: ./configure: No such file or directory
make: *** [setup] Error 127


Adding ./autogen.sh into the command string (i.e. `make distclean && ./autogen.sh && ./configure...` works around the error. Perhaps the distclean target is removing a little too much?
Comment 8 Werner Lemberg 2014-03-06 18:06:51 UTC
I can't repeat your problem with `configure'.  Doing `make distclean' after a build on a Mac OS X platform doesn't delete it.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.