[MPlayer-users] zlib and fontconfig

Nicholas Schell nschell at gmail.com
Thu Nov 2 17:59:12 CET 2006


Interesting problem came up for me when attempting to build mplayer with a
static fontconfig, thanks to reimar's recent patches. Building in a
MSYS-MinGW environment (windows obviously, I hope you are still reading) and
building zlib, libiconv, freetype, expat and fontconfig all as static. Also
not using any --enable parameters for external libs at mplayer configure,
only the following:

./configure --prefix=mplayer_install --enable-runtime-cpudetection

Freetype can make use of zlib and this becomes a problem because freetype
itself is also a dependency of fontconfig. When mplayer attempts to find
fontconfig it will only add -lexpat -lfreetype, but not -lz with ld. It will
throw out errors from freetype that point to functions which make use of
zlib (inflate*).

gcc -O4 -march=i486 -mtune=i686 -pipe -ffast-math -fomit-frame-pointer
-I/mingw/include/freetype2 -I/mingw/include   -o /tmp/mplayer-
conf-25071-3948.o /tmp/mplayer-conf-14281-3948.c -lfontconfig -lexpat
-lfreetype
C:/other/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libfreetype.a(
ftgzip.o): In function
`ft_gzip_file_fill_output':c:/msys/1.0/home/Nicholi/freetype-2.2.1/src/gzip/ftgzip.c:406:
undefined reference to `inflate'
C:/other/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libfreetype.a(
ftgzip.o): In function
`ft_gzip_stream_close':c:/msys/1.0/home/Nicholi/freetype-2.2.1/src/gzip/ftgzip.c:303:
undefined reference to `inflateEnd'
C:/other/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libfreetype.a(
ftgzip.o): In function
`ft_gzip_stream_io':c:/msys/1.0/home/Nicholi/freetype-2.2.1/src/gzip/ftgzip.c:332:
undefined reference to `inflateReset'
C:/other/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libfreetype.a(
ftgzip.o): In function
`FT_Stream_OpenGzip':c:/msys/1.0/home/Nicholi/freetype-2.2.1/src/gzip/ftgzip.c:288:
undefined reference to `inflateInit2_'

Thus in the end causing the fontconfig check to come back negative, so no
static fontconfig in mplayer. I manually added -lz into the ld settings for
fontconfig in the configure file and this seemed to "solve" the issue. The
above errors don't appear and the fontconfig check comes back positive.
Previously I had been building freetype, expat, and fontconfig as shared
libs with mplayer and none of these issues came up (I also had freetype
depending on zlib at this time). Should this be something fixed in the
configure file? Or perhaps just an extra meaningless parameter,
--with-freetype-lz ?, or am I just a fool for building freetype with zlib.
Hopefully not a windows only issue :(.

My "solution" was just adding another else if for the fontconfig ld
settings.
  elif cc_check -lfontconfig -lexpat -lfreetype -lz ; then
    _ld_fontconfig="-lfontconfig -lexpat -lfreetype -lz"

Also previously with a shared fontconfig mplayer build, a friend and I
noticed we could control the location of the fonts.conf by making a very
small edit in the fontconfig src. Line 1468 in "fontconfig/src/fccfg.c"
change "\\etc\\fonts" to "\\mplayer". Just a handy thing he actually thought
of in order to put all of the .conf files in one folder. However with a
static fontconfig compile we noticed that no longer works, and were guessing
that there was something in the mplayer code itself which is controlling
where it expects to find fonts.conf, because it now only works in
"/etc/fonts". Any idea where that is, or if that is true at all?



More information about the MPlayer-users mailing list