Tk Source Code

View Ticket
Login
Ticket UUID: 3e5d09f0e49755b2c6d9a7a5b94c990968bb9734
Title: tk.pc omits private pkg-config dependency for static linking
Type: Bug Version: 9.0.4
Submitter: anonymous Created on: 2026-08-20 14:52:52
Subsystem: 84. Unix Build Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-08-26 16:38:29
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2026-08-26 16:38:29
Description:
When Tk is built with X11, Xft, etc, enabled, these libraries are included in Libs.private in tk.pc but are not represented in Requires.private.

As a result, consumers of Tk using pkg-config for static linking obtain the direct flags (-ltk, -lX11, -lXft, etc.) but not the transitive static dependencies from x11.pc, xft.pc, and similar pkg-config files. This can result in undefined references when linking the final executable or shared library.
User Comments: jan.nijtmans added on 2026-08-26 16:38:29:

Fixed now [24b953d09562dd68|here].

For 9.1, tk.pc is not 100% correct yet (e.g., -lharfbuzz and -lXrender are missing), but that should be handled during further development there. At least the Requires.private line in 9.1 contains x11, xft and fontconfig now.


jan.nijtmans added on 2026-08-26 12:53:55:

Another question related: If Requires.private is present, should Libs.private then still be included?


anonymous added on 2026-08-25 16:47:45:
Adding x11 and xft to Requires.private would address this but the inclusion should be made conditional on the configuration results similar to how @XFT_LIBS@ @XLIBSW@ control the entries in Libs.private. 

In my particular use case I am not building with xft enabled so Requires.private should only contain x11.

jan.nijtmans added on 2026-08-23 16:46:00:

Does [38163e96688249f8|this] help for you?

Thanks for the report!