Re: Building against fontconfig-2.4.2 (latest release) causes two missing symbols when linking libXft.

Marc Aurele La France <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <Pine.WNT.4.64.0704142155310.1460@tsi>
On Wed, 11 Apr 2007, SciFi wrote:

> 1.  Building against fontconfig-2.4.2 (latest release) causes two
> missing symbols when linking libXft.

> Build Log snip:

>>>>>
> [...]
> ld: Undefined symbols:
> _FcPatternFindElt
> _FcPatternInsertElt
> /usr/bin/libtool: internal link edit command failed
> <<<<

> To recreate:

> a) build and install fontconfig-2.4.2
> b) specify these in your [build/]config/cf/host.def file:
> #define HasFontconfig	YES
> #define FontconfigDir	/usr/local   (or wherever you installed fontconfig)

> Discussion:

> There are two API functions that have been renamed in recent
> versions of fontconfig, while their ABI (parms passed, header
> layouts, etc.) remain the same.

> Chiefly what we need to do in xf86's source:
> s/FcPatternFindElt/FcPatternObjectFindElt/
> s/FcPatternInsertElt/FcPatternObjectInsertElt/

> I don't know enough how to insert #ifdefs that will test the
> installed fontconfig's version criteria, so that we could make
> xf86 compilable on old-and-new versions.  I did find the commit
> that made this change:
> <http://lists.freedesktop.org/archives/fontconfig/2006-August/002381.html>
> ...but still not sure what was the "switchover" point for this
> commit, i.e. the version-rel-mod-patch level to use for #ifdefs to
> decide after which point to use the new function names.  I hope
> you know what I mean.  ;)

> For now, a quick patch to fix this:

>>>>> -cut->>>>
> --- xc/lib/Xft1/xftint.h_orig	2002-06-30 23:28:17 -0500
> +++ xc/lib/Xft1/xftint.h	2007-04-06 08:17:55 -0500
> @@ -92,10 +92,10 @@
>  * Yes, these are stolen from fcint.h
>  */
> FcPatternElt *
> -FcPatternFindElt (const FcPattern *p, const char *object);
> +FcPatternObjectFindElt (const FcPattern *p, const char *object);
>
> FcPatternElt *
> -FcPatternInsertElt (FcPattern *p, const char *object);
> +FcPatternObjectInsertElt (FcPattern *p, const char *object);
>
> typedef FcPatternElt XftPatternElt;
>
> --- xc/lib/Xft1/xftpat.c_orig	2002-06-07 18:44:23 -0500
> +++ xc/lib/Xft1/xftpat.c	2007-04-06 08:18:45 -0500
> @@ -210,9 +210,9 @@
> XftPatternFind (XftPattern *p, const char *object, FcBool insert)
> {
>     if (insert)
> -	return FcPatternInsertElt (p, object);
> +	return FcPatternObjectInsertElt (p, object);
>     else
> -	return FcPatternFindElt (p, object);
> +	return FcPatternObjectFindElt (p, object);
> }
>
>
> <<<<-cut-<<<<

Here's a quicker one...

*** cvs/xc/lib/Xft1/xftint.h    Sun Jun 30 22:28:17 2002
--- devel/xc/lib/Xft1/xftint.h  Sat Apr 14 21:40:45 2007
*************** typedef struct _FcPatternElt FcPatternEl
*** 91,96 ****
--- 91,107 ----
   /*
    * Yes, these are stolen from fcint.h
    */
+ /*
+  * Unfortunately, fontconfig's version number was not updated when these were
+  * renamed (in 2.3.95).
+  */
+ #if FC_VERSION == 20395
+ # error "fontconfig 2.3.95 not supported"
+ #endif
+ #if FC_VERSION > 20395
+ # define FcPatternFindElt   FcPatternObjectFindElt
+ # define FcPatternInsertElt FcPatternObjectInsertElt
+ #endif
   FcPatternElt *
   FcPatternFindElt (const FcPattern *p, const char *object);


Marc.

+----------------------------------+----------------------------------+
|  Marc Aurele La France           |  work:   1-780-492-9310          |
|  Academic Information and        |  fax:    1-780-492-1729          |
|    Communications Technologies   |  email:  [email protected]         |
|  352 General Services Building   +----------------------------------+
|  University of Alberta           |                                  |
|  Edmonton, Alberta               |    Standard disclaimers apply    |
|  T6G 2H1                         |                                  |
|  CANADA                          |                                  |
+----------------------------------+----------------------------------+
XFree86 developer and VP.  ATI driver and X server internals.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.