Tk Source Code

View Ticket
Login
Ticket UUID: 3606644
Title: Static build misses fontconfig
Type: Bug Version: current: 8.6.0
Submitter: taylor_venable Created on: 2013-03-03 01:32:58
Subsystem: 84. Unix Build Assigned To: jan.nijtmans
Priority: 8 Severity: Important
Status: Closed Last Modified: 2014-01-23 22:30:10
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2014-01-23 22:30:10
Description:
After configuring with --disable-shared, compilation fails due to missing symbols provided by fontconfig. The config.log file is attached. The resulting error is:

gcc -O2  -pipe    -Wl,--export-dynamic  tkAppInit.o -L/home/taylor/Source/Tcl-Tk/tk8.6.0/unix -ltk8.6 -L/home/taylor/Source/Tcl-Tk/tcl8.6.0/unix -ltcl8.6  -lpthread -lXft  -lX11 -lXss -lXext -ldl -lz  -lpthread -lieee -lm  \
        -Wl,-rpath,/usr/local/lib -o wish
/usr/bin/ld: /home/taylor/Source/Tcl-Tk/tk8.6.0/unix/libtk8.6.a(tkUnixRFont.o): undefined reference to symbol 'FcCharSetDestroy'
/usr/bin/ld: note: 'FcCharSetDestroy' is defined in DSO /usr/lib/libfontconfig.so.1 so try adding it to the linker command line
/usr/lib/libfontconfig.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [wish] Error 1

Editing the Makefile to add "-lfontconfig" to the definition of XFT_LIBS causes it to work.

In a non-static build, everything is fine. This is on Arch Linux, with fontconfig 2.10.2 installed.
User Comments: jan.nijtmans added on 2014-01-23 22:30:10:

Fixed in core-8-5-branch [b91497ebb7] and trunk [320dbce662]


dkf added on 2014-01-12 22:00:48:

Looks like a reasonable analysis and suggested solution.


anonymous added on 2014-01-10 15:42:36:
This problem is actually affecting shared builds, too!

At least when building under modern Linux versions like Fedora 20: The real problem is that tkUnixRFont.c has calls to functions from the fontconfig library which is a DEPENDENT library of libXft.so. However, tk does not link to the fontconfig library explicitly. Instead, it is using the implicit dependency from libXft.so when 'wish' is linked.
This implicit linking is no longer done on my system and a shared build fails with above mentioned error message, too: see here for details:
http://fedoraproject.org/wiki/UnderstandingDSOLinkChange

So the obvious fix for both shared and static tk builds is to add the dependency to fontconfig package, too, in case Xft is found & used.

taylor_venable added on 2013-03-03 08:32:58:

File Added - 461151: config.log

Attachments: