PDA

View Full Version : [CentOs 5.2] How fix libQtGui.so undefined reference FcFreeTypeQueryFace?



esutton
13th March 2009, 15:07
I'm a Linux newbie. QT Creator 1.0.0 (Qt 4.5) worked fine for Vista and OS X. Under Centos 5.2 I must be missing something.


/home/esutton/qtsdk-2009.01/qt/lib/libQtGui.so: undefined reference to `FcFreeTypeQueryFace'
collect2: ld returned 1 exit status

My best guess is libQtGui has a dependency on Fonconfig. I have fonconfig and fonconfig-devel 2.4.1.7. I could not find any newer RPMs for Centos. I tried downloaded the 2.6 tarball and configure,make, and make install without success. What else may I be missing?

Thanks in advance for any direction,

-Ed

mgbowman
15th March 2009, 19:28
CentOS 5.2 + Qt 4.5 + FcFeeTypeQueryFace (http://theitdepartment.wordpress.com/2009/03/15/centos-qt-fcfreetypequeryface/) :cool:

--mgbowman (aka theitdepartment)

esutton
16th March 2009, 12:25
Thank you *very* much for posting the link to your blog!

http://theitdepartment.wordpress.com/2009/03/

This was the perfect solution and step-by-step guide needed by a newbie like myself to solve this problem and get me going with QT. I can now build and run my QT Creator "hello world" app under Centos 5.2!

Thanks again for your assistance,

-Ed

perden
30th March 2009, 19:06
CentOS 5.2 + Qt 4.5 + FcFeeTypeQueryFace (http://theitdepartment.wordpress.com/2009/03/15/centos-qt-fcfreetypequeryface/) :cool:

--mgbowman (aka theitdepartment)

Any chance we can get an abridged version here? My company blocks wordpress.

esutton
30th March 2009, 19:26
Use an anonymous browser to defeat the evil IT Overlords.
http://www.the-cloak.com

Copied from:
http://theitdepartment.wordpress.com/2009/03/

Archive for March, 2009
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! 8-)

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.

perden
30th March 2009, 20:00
Thanks, this was the eureka that I needed to figure out my problem:

Using RHEL5, I downloaded and installed the qt-sdk-linux-x86-opensource-2009.01.bin (http://get.qtsoftware.com/qtsdk/qt-sdk-linux-x86-opensource-2009.01.bin) with no problem, but nothing would build. I figured I needed a new version of fontconfig as RHEL5 is getting old now, so I downloaded, compiled, and installed fontconfig-2.6.0 (http://cgit.freedesktop.org/fontconfig/snapshot/fontconfig-2.6.0.tar.bz2). Yet after the install it still wouldn't work! I posted here to get some inspiration, and after reading mgbowman's material copied by esutton, I decided to check where libQtGui.so was actually pulling the library from:

$ ldd ~/opt/qtsdk-2009.01/lib/libQtGui.so.4
(...)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7197000)
(...)

Apparently the Qt binary installer doesn't actually search for any of the linked libraries. It assumes that they are in /usr/lib from when Qt was originally built. Reconfiguring fontconfig with --prefix=/usr to adjust the install location did the trick.

esutton
16th June 2009, 20:55
Thank you very much for explaining the true cause of the problem and sharing your Eureka moment. Including LIBS += -L/opt/fontconfig-2.4.2/lib in all my QT project files was a silly solution.

libQtGui.so expects to find libfontconfig.so.1 located at: /usr/lib/libfontconfig.so.1 resulting in the following error:

/home/esutton/qtsdk-2009.01/qt/lib/libQtGui.so: undefined reference to `FcFreeTypeQueryFace'
collect2: ld returned 1 exit status

Solution

1. cd /usr/src
2. wget http://fontconfig.org/release/fontconfig-2.4.2.tar.gz
3. tar -zxf fontconfig-2.4.2.tar.gz
4. cd fontconfig-2.4.2
5. ./configure -prefix=/usr
6. make
7. make install

zekker
26th November 2009, 13:00
I found another solution. The problematic package is fontconfig-devel. After uninstalling it, QT compiles just fine.
System: Red Hat Enterprise 5.4 Kernel 2.6.18-164.6.1.el5 on an x86_64
fontconfig-2.4.1-7.el5 (.i386 and x86_64)

Don't know if I need that devel, but I couldn't install fontconfig-2.4.2 (I'm quite new in Linux).