CentOS 5.2 + Qt 4.5 + FcFreeTypeQueryFace
Posted by theitdepartment on March 15, 2009
So with all the buzz around the new release of Qt 4.5, you may be like me and have been desperately wanting to give it a whirl. Has this happened to you yet?
/opt/qtsdk-2009.01/qt/lib/libQtGui.so: undefined reference to `FcFreeTypeQueryFace'
collect2: ld returned 1 exit status
Someone’s got some ’splainin to do. Lucky for you, that’s me. Basically, the people at fontconfig did not add this API call until 2.4.2. From fontconfig’s ChangeLog 2.4.2:
commit 72ffe6536a6825a32095c8185aff836a12326ac5
Author: Keith Packard
Date: Sat Dec 2 13:22:27 2006 -0800
Add FcFreeTypeQueryFace external API. Bug #7311.
Expose ability to build an FcPattern directly from an FT_Face
object.
configure.in | 4 ++--
doc/fcfreetype.fncs | 17 +++++++++++++++-
fontconfig/fcfreetype.h | 6 ++++++
src/fcfreetype.c | 50 ++++++++++++++++++++++++++---------------------
4 files changed, 52 insertions(+), 25 deletions(-)
Problem is for us CentOS 5.2 users, we’re given a version 2.4.1-7 from “upstream”
It’s not a big deal, we can just compile fontconfig from source … wait, did I just say compile? No worries, it’s easy.
1. Compile fontconfig 2.4.2 from source
Note: Throughout this step, I used fontconfig 2.4.2 since this is the minimum required version, but I tested this with the latest version 2.6.0 so just replace the version numbers accordingly if you choose to use 2.6.0.
[user@localhost ~]$ cd /usr/src
[user@localhost /usr/src]$ wget http://fontconfig.org/release/fontconfig-2.4.2.tar.gz
[user@localhost /usr/src]$ tar -zxf fontconfig-2.4.2.tar.gz
[user@localhost /usr/src]$ cd fontconfig-2.4.2
[user@localhost /usr/src/fontconfig-2.4.2]$ ./configure --prefix=/opt/fontconfig-2.4.2
... (note: 'configure' output omitted for brevity) ...
[user@localhost /usr/src/fontconfig-2.4.2]$ make
... (note: 'make' output omitted for brevity) ...
[user@localhost /usr/src/fontconfig-2.4.2]$ make install
... (note: 'make install' output omitted for brevity) ...
Note: I chose to install into /opt/fontconfig-2.4.2 since I like keeping my “deviations” from upstream organized.
2. Add the fontconfig library location to your project’s .pro file
LIBS += -L/opt/fontconfig-2.4.2/lib
3. Recompile and that’s it!
Now I can’t guarantee you will not have any ‘make’ errors due to library dependencies but I’m pretty sure that if you got as far as you did to receive this error, you will have every *-devel package needed by fontconfig already installed on your system.
Ed said
That was just what I needed! I can now build and run my QT Creator “Hello World” application under Cent0s 4.2.
Thank you very much for taking the time to document this in a detailed step-by-step style. It was just what a Linux and QT newbie like myself needed.
Thanks again,
-Ed
Ed said
Correction, meant to type CentOs 5.2 not “4.2″
beetle said
Thank you for help!
But when i compile fontconfig 2.4.2 from source whit worng,I really desperately wanting to give it a whirl!!!
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../src -I/usr/local/include/freetype2 -
Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarat
ions -Wnested-externs -fno-strict-aliasing -DFC_CACHEDIR=\”/opt/fontconfig-2.4.2
/var/cache/fontconfig\” -DFONTCONFIG_PATH=\”/opt/fontconfig-2.4.2/etc/fonts\” -g
-O2 -MT fcfreetype.lo -MD -MP -MF .deps/fcfreetype.Tpo -c fcfreetype.c -fPIC -
DPIC -o .libs/fcfreetype.o
fcfreetype.c:69:2: warning: #warning “No FT_Get_BDF_Property: Please install fre
etype 2.1.4 or later”
fcfreetype.c:73:2: warning: #warning “No FT_Get_PS_Font_Info: Please install fre
etype 2.1.1 or later”
fcfreetype.c:126: error: ‘TT_MS_ID_UCS_4′ undeclared here (not in a function)
fcfreetype.c:460: error: ‘TT_MS_LANGID_TIBETAN_CHINA’ undeclared here (not in a
function)
fcfreetype.c:460: error: initializer element is not constant
fcfreetype.c:460: error: (near initialization for ‘fcFtLanguage[288].language_id
‘)
fcfreetype.c:461: error: ‘TT_MS_LANGID_DZONGHKA_BHUTAN’ undeclared here (not in
a function)
fcfreetype.c:461: error: initializer element is not constant
fcfreetype.c:461: error: (near initialization for ‘fcFtLanguage[289].language_id
‘)
fcfreetype.c:508: error: ‘TT_MS_LANGID_SPANISH_UNITED_STATES’ undeclared here (n
ot in a function)
fcfreetype.c:508: error: initializer element is not constant
fcfreetype.c:508: error: (near initialization for ‘fcFtLanguage[317].language_id
‘)
fcfreetype.c:511: error: ‘TT_MS_LANGID_SPANISH_LATIN_AMERICA’ undeclared here (n
ot in a function)
fcfreetype.c:511: error: initializer element is not constant
fcfreetype.c:511: error: (near initialization for ‘fcFtLanguage[318].language_id
‘)
fcfreetype.c:512: error: ‘TT_MS_LANGID_FRENCH_NORTH_AFRICA’ undeclared here (not
in a function)
fcfreetype.c:512: error: initializer element is not constant
fcfreetype.c:512: error: (near initialization for ‘fcFtLanguage[319].language_id
‘)
fcfreetype.c:514: error: ‘TT_MS_LANGID_FRENCH_MOROCCO’ undeclared here (not in a
function)
fcfreetype.c:514: error: initializer element is not constant
fcfreetype.c:514: error: (near initialization for ‘fcFtLanguage[320].language_id
‘)
fcfreetype.c:515: error: ‘TT_MS_LANGID_FRENCH_HAITI’ undeclared here (not in a f
unction)
fcfreetype.c:515: error: initializer element is not constant
fcfreetype.c:515: error: (near initialization for ‘fcFtLanguage[321].language_id
‘)
fcfreetype.c:516: error: ‘TT_MS_LANGID_BENGALI_BANGLADESH’ undeclared here (not
in a function)
fcfreetype.c:516: error: initializer element is not constant
fcfreetype.c:516: error: (near initialization for ‘fcFtLanguage[322].language_id
‘)
fcfreetype.c:517: error: ‘TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN’ undeclared here
(not in a function)
fcfreetype.c:517: error: initializer element is not constant
fcfreetype.c:517: error: (near initialization for ‘fcFtLanguage[323].language_id
‘)
fcfreetype.c:518: error: ‘TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN’ undeclared
here (not in a function)
fcfreetype.c:518: error: initializer element is not constant
fcfreetype.c:518: error: (near initialization for ‘fcFtLanguage[324].language_id
‘)
fcfreetype.c:524: error: ‘TT_MS_LANGID_HAUSA_NIGERIA’ undeclared here (not in a
function)
fcfreetype.c:524: error: initializer element is not constant
fcfreetype.c:524: error: (near initialization for ‘fcFtLanguage[325].language_id
‘)
fcfreetype.c:525: error: ‘TT_MS_LANGID_YORUBA_NIGERIA’ undeclared here (not in a
function)
fcfreetype.c:525: error: initializer element is not constant
fcfreetype.c:525: error: (near initialization for ‘fcFtLanguage[326].language_id
‘)
fcfreetype.c:527: error: ‘TT_MS_LANGID_IGBO_NIGERIA’ undeclared here (not in a f
unction)
fcfreetype.c:527: error: initializer element is not constant
fcfreetype.c:527: error: (near initialization for ‘fcFtLanguage[327].language_id
‘)
fcfreetype.c:528: error: ‘TT_MS_LANGID_KANURI_NIGERIA’ undeclared here (not in a
function)
fcfreetype.c:528: error: initializer element is not constant
fcfreetype.c:528: error: (near initialization for ‘fcFtLanguage[328].language_id
‘)
fcfreetype.c:529: error: ‘TT_MS_LANGID_GUARANI_PARAGUAY’ undeclared here (not in
a function)
fcfreetype.c:529: error: initializer element is not constant
fcfreetype.c:529: error: (near initialization for ‘fcFtLanguage[329].language_id
‘)
fcfreetype.c:530: error: ‘TT_MS_LANGID_HAWAIIAN_UNITED_STATES’ undeclared here (
not in a function)
fcfreetype.c:530: error: initializer element is not constant
fcfreetype.c:530: error: (near initialization for ‘fcFtLanguage[330].language_id
‘)
fcfreetype.c:531: error: ‘TT_MS_LANGID_LATIN’ undeclared here (not in a function
)
fcfreetype.c:531: error: initializer element is not constant
fcfreetype.c:531: error: (near initialization for ‘fcFtLanguage[331].language_id
‘)
fcfreetype.c:532: error: ‘TT_MS_LANGID_SOMALI_SOMALIA’ undeclared here (not in a
function)
fcfreetype.c:532: error: initializer element is not constant
fcfreetype.c:532: error: (near initialization for ‘fcFtLanguage[332].language_id ‘)
fcfreetype.c:539: error: ‘TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES’ undeclar ed here (not in a function)
fcfreetype.c:539: error: initializer element is not constant
fcfreetype.c:539: error: (near initialization for ‘fcFtLanguage[333].language_id ‘)
fcfreetype.c:1821:2: warning: #warning “No FT_Get_Next_Char: Please install free type version 2.1.0 or newer”
fcfreetype.c: In function ‘IA__FcFreeTypeCharSetAndSpacing’:
fcfreetype.c:2656: warning: implicit declaration of function ‘FT_Get_First_Char’
fcfreetype.c:2656: warning: nested extern declaration of ‘FT_Get_First_Char’
fcfreetype.c: In function ‘FcFontCapabilities’:
fcfreetype.c:2955: warning: implicit declaration of function ‘FT_Load_Sfnt_Table ‘
fcfreetype.c:2955: warning: nested extern declaration of ‘FT_Load_Sfnt_Table’
make[3]: *** [fcfreetype.lo] Error 1
make[3]: Leaving directory `/usr/src/fontconfig-2.4.2/src’
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/fontconfig-2.4.2/src’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/fontconfig-2.4.2′
make: *** [all] Error 2
…
theitdepartment said
@Beetle: I think you’re missing the freetype-devel package. What does ‘yum install freetype-devel’ output?
Alan Druce said
This is most succinct fix I have ever seen, and it works.
Thanks
newqtcoder said
Short question: When I try ./configure –prefix=/opt/fontconfig-2.4.2, hah, there is no ./configure file for me in the fontconfig-2.4.2 folder, how to solve this?
Thank you for any hint, I also desperately want to give it a whirl!
theitdepartment said
Are you sure you’re in the fontconfig src directory? (i.e. /usr/src/fontconfig-2.4.2) If you are, do an
ls -laand see if there is a configure script and it it’s executable. Other than that it should be pretty straight forward.newqtcoder said
Sorry for the delay, I was waiting for an noticing email which apparently didn’t get through. No, there is no file called configure, I list the answer to ls -al below. There is only a text file configure.in, and somewhere inside it says: Process this file with autoconf to create configure. But when I try
>autoconf configure.in
then it stops with:
…
…
configure.in:36: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.in:37: error: possibly undefined macro: AM_MAINTAINER_MODE
configure.in:58: error: possibly undefined macro: AM_CONFIG_HEADER
configure.in:63: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
configure.in:64: error: possibly undefined macro: AM_PROG_LIBTOOL
configure.in:76: error: possibly undefined macro: AM_CONDITIONAL
The result for ls -al is:
[root@cache2 fontconfig-2.4.2]# ls -al
total 172
drwxrwxr-x 17 root root 4096 May 15 13:59 .
drwxr-xr-x 6 root root 4096 May 13 18:59 ..
-rw-rw-r– 1 root root 62 Dec 3 2006 AUTHORS
-rwxrwxr-x 1 root root 2896 Dec 3 2006 autogen.sh
drwxr-xr-x 2 root root 4096 May 15 13:59 autom4te.cache
drwxrwxr-x 2 root root 4096 Dec 3 2006 conf.d
drwxrwxr-x 2 root root 4096 Dec 3 2006 config
-rw-rw-r– 1 root root 13956 Dec 3 2006 configure.in
-rw-rw-r– 1 root root 1110 Dec 3 2006 COPYING
drwxrwxr-x 2 root root 4096 Dec 3 2006 doc
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-arch
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-cache
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-case
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-cat
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-glyphname
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-lang
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-list
drwxrwxr-x 2 root root 4096 Dec 3 2006 fc-match
drwxrwxr-x 2 root root 4096 Dec 3 2006 fontconfig
-rw-rw-r– 1 root root 259 Dec 3 2006 fontconfig.pc.in
-rw-rw-r– 1 root root 4577 Dec 3 2006 fontconfig.spec.in
-rwxrwxr-x 1 root root 676 Dec 3 2006 fontconfig-zip.in
-rw-rw-r– 1 root root 5173 Dec 3 2006 fonts.conf.in
-rw-rw-r– 1 root root 6907 Dec 3 2006 fonts.dtd
-rw-rw-r– 1 root root 1213 Dec 3 2006 .gitignore
-rw-rw-r– 1 root root 1416 Dec 3 2006 INSTALL
-rw-rw-r– 1 root root 756 Dec 3 2006 local.conf
-rw-rw-r– 1 root root 4564 Dec 3 2006 Makefile.am
-rw-rw-r– 1 root root 0 Dec 3 2006 NEWS
-rw-rw-r– 1 root root 18347 Dec 3 2006 README
drwxrwxr-x 2 root root 4096 Dec 3 2006 src
drwxrwxr-x 2 root root 4096 Dec 3 2006 test
[root@cache2 fontconfig-2.4.2]#
love_juhee said
install fontconfig
wget http://fontconfig.org/release/fontconfig-2.4.2.tar.gz
tar -zxf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2
./configure –prefix=/opt/fontconfig-2.4.2
make
make install
setting libconfconfig.so
cd /usr/lib
old library backup
mv libfontconfig.so libfontconfig.so.b
mv libfontconfig.so.1 libfontconfig.so.1.b
link new library
ln -s /opt/fontconfig-2.4.2/lib/libfontconfig.so.1.2.0 ./libfontconfig.so.1
ln -s /opt/fontconfig-2.4.2/lib/libfontconfig.so.1.2.0 ./libfontconfig.so
check library
ll ./libfontconfig.so*
Joseph said
I have created RPMs to install qt 4.5.1, fontconfig 2.5.93 and qt-creator on CentOS 5.3.
Follow the instructions here to grab the upgrades.
Joseph said
Hmmm… the a href tag didn’t work. The post for the rpms is http://joseph.freivald.com/linux/2009/05/24/qtsdk-on-centos-53/
Aurélien said
Hello,
I just came on this webpage, as I was experiencing the same problem with Debian SID distribution. But, actually, my version of fontconfig is already 2.6.0-4, so I shouldn’t have this problem, should I?
I’ve checked, and I’ve got the /usr/lib/libfontconfig.so.1 file on my machine. Any clue?