Wine 1.9.22 development (dated Oct 28, 2016) has been released! See the release notes for changes. Alas, I encountered errors trying to compile it "on top" of the Wine 1.9.21 installation, following the steps from my post Compiling Wine from scratch. I spent a whole day searching for the problem, and resolved it as below.

The first time I ran make, it stopped midway with a fatal error - sfnt2fon couldn't run:

dyld: Library not loaded: libfreetype.6.dylib
  Referenced from: /Users/[user]/Downloads/wine/wine-1.9.22/fonts/../tools/sfnt2fon/sfnt2fon
  Reason: image not found

I tried to fix this manually, in the most quick-and-dirty way possible, by using install_name_tool and by simply copying the files to where they are expected.

But, after compiling successfully, running any program in Wine would generate an empty window and errors like "Wine cannot find the FreeType font library. To enable Wine to use TrueType fonts please install a version of FreeType greater than or equal to 2.0.5." in the console.

After lots of checking, I traced the problem to a few lines in error in config.status. This file is generated by configure as part of the intermediate build process, and it is this file, in turn, that generates the Makefile. I read about this after a Google search turned up a short summary from The GNU Project Build Tools, Appendix C5.

There are a few lines in config.status that are supposed to point to the library file names, but instead contain the output of otool including the initial tab character and ending with a text description of the version (in brackets)!

D["SONAME_LIBFREETYPE"]=" \"    libfreetype.6.dylib (compatibility version 19.0.0, current version 19.6.0)\""
D["SONAME_LIBJPEG"]=" \"    libjpeg.9.dylib (compatibility version 12.0.0, current version 12.0.0)\""
D["SONAME_LIBPNG"]=" \" libpng16.16.dylib (compatibility version 42.0.0, current version 42.0.0)\""
D["SONAME_LIBTIFF"]=" \"    libtiff.3.dylib (compatibility version 12.0.0, current version 12.2.0)\""
D["SONAME_LIBODBC"]=" \"    libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0)\""
D["SONAME_LIBNETAPI"]=" \"  libnetapi.dylib.0 (compatibility version 0.0.0, current version 0.0.0)\""

The lines above are from various locations in config.status but presented in a block for clarity.

I just manually corrected these entries, leaving just the file name without the leading tab and training version string:

D["SONAME_LIBFREETYPE"]=" \"libfreetype.6.dylib\""
D["SONAME_LIBJPEG"]=" \"libjpeg.9.dylib\""
D["SONAME_LIBPNG"]=" \"libpng16.16.dylib\""
D["SONAME_LIBTIFF"]=" \"libtiff.3.dylib\""
D["SONAME_LIBODBC"]=" \"libodbc.2.dylib\""
D["SONAME_LIBNETAPI"]=" \"libnetapi.dylib.0\""

After running config.status, Wine compiles just fine (make -j5 install), and applications work as expected, without any errors.

Do not compile after changing dependent library names

Clearly, configure is picking up incorrect libraries because I ran configure after I had relinked the libraries using install_name_tool -change.

Next time, I'll either:

  • Re-install the libraries from the original compiled sources (remove the install directory and make install), and then run Wine's configure, prior to re-linking.
  • Or, simply run install_name_tool against a copy of the libraries , e.g. when Creating a bundle, modify Resources\bin and Resources\lib instead.

Hope this helps someone!