[tex-live] Build failure on Mac OS X 10.4.7: dvipng

Jonathan Kew jonathan_kew at sil.org
Fri Dec 8 00:59:25 CET 2006

On my Mac OS X 10.4.7 (Intel and PPC) systems, ./Build ends with a  
link failure in dvipng:

gcc  dvipng.o color.o draw.o dvi.o font.o misc.o pk.o set.o special.o  
papersiz.o ppagelist.o vf.o t1.o sfd.o ft.o enc.o fontmap.o tfm.o -o  
dvipng -lm ../kpathsea/.libs/libkpathsea.a  ../../libs/gd/ 
libgd.a ../../libs/freetype2/.libs/libfreetype.a ../../libs/t1lib/ 
libt1.a ../../libs/t1lib/../type1/libtype1.a ../../libs/libpng/ 
libpng.a ../../libs/zlib/libz.a
/usr/bin/ld: multiple definitions of symbol _hash_create
definition of _hash_create
../kpathsea/.libs/libkpathsea.a(hash.o) definition of _hash_create in  
section (__TEXT,__text)
collect2: ld returned 1 exit status
make[2]: *** [dvipng] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1

This occurs because there is a hash_create in the system's libm,  
which clashes with the function defined in kpathsea, and the system's  
dynamic libm is linked before the static kpathsea library.

The problem will not arise if libkpathsea.a is listed *before* -lm in  
the link command. However, a further problem then shows up: there are  
a bunch of unresolved references to Mac OS X functions. I believe  
these are coming from libfreetype, which uses Mac APIs to interact  
with the OS font system. To resolve these references, we need to add  
"-framework ApplicationServices" to the link command.

So I'd like to propose the following patch to texk/dvipng/ 
configure.ac (and the resulting update to texk/dvipng/configure,  
after re-running autoconf in that directory):

--- texk/dvipng/configure.ac    (revision 2611)
+++ texk/dvipng/configure.ac    (working copy)
@@ -167,11 +167,6 @@
-LIBS="../kpathsea/.libs/libkpathsea.a $LIBS"
  dnl -- gd jpeg fn not defined? AC_DEFINE(HAVE_GDIMAGECREATETRUECOLOR)
  dnl then we get a warning about gdImageAlpha, but so what.
@@ -189,6 +184,33 @@
  AC_CHECK_LIB(m, main)
  AC_CHECK_LIB(gen, basename)
+LIBS="../kpathsea/.libs/libkpathsea.a $LIBS"
+#   Check for ApplicationServices
+  _cppflags=$CPPFLAGS _ldflags=$LDFLAGS
+  AC_MSG_CHECKING([for Mac OS X ApplicationServices framework])
+    [
+#include <ApplicationServices/ApplicationServices.h>
+      ], [
+ATSFontRef fontRef;
+    ],
+    [ AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_APP_SERVICES, 1, [Define if you have  
ApplicationServices (Mac OS X)])
+      LIBS="$LIBS -framework ApplicationServices"
+    ],
+    [ AC_MSG_RESULT(no) ]
+  )

The effect is to move libkpathsea.a earlier in LIBS, so it is found  
before libm, and to test for the existence of the Mac OS X  
ApplicationServices framework and add this to the link if present.

This will allow a successful build on current Mac OS X systems, and  
should be harmless elsewhere; if I don't hear objections, I intend to  
check it in tomorrow after some further testing here.


More information about the tex-live mailing list