Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-07-20
22:39
Fix [5916e48806]: tcl.pc: hardcoded depedencies, missing build flags check-in: dc95705f59 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2023-07-11
09:30 • Closed ticket [5916e48806]: tcl.pc: hardcoded depedencies, missing build flags</... artifact: 562cf1b749 user: jan.nijtmans
09:20
Fix [5916e48806]: tcl.pc: hardcoded depedencies, missing build flags check-in: 4b11db28e6 user: jan.nijtmans tags: core-8-branch
2023-06-26
20:59 • Add attachment 5916e48806-ltm-8.7.diff to ticket [5916e48806d93dd9|5916... artifact: f7831cd780 user: chrstphrchvz
20:54 • Ticket [5916e48806] tcl.pc: hardcoded depedencies, missing build flags statu... artifact: 406280d376 user: chrstphrchvz
2023-04-29
22:24 • New ticket [5916e48806]. artifact: edde64be1d user: chrstphrchvz

tcl.pc: hardcoded depedencies, missing build flags

Closed / Fixed5916e48806d93dd9b24f8f73c3f4d7ed74b04eb3Created 4 years agoUpdated 3 years ago
Descriptionwiki2023-04-29 22:24:48
I am not very familiar with pkg-config, but there seem to be a few issues with the installed tcl.pc file.
  1. My understanding is that the only time libtommath (on 8.7 and later) or zlib should be specified Requires.private field of tcl.pc is if they are installed on the system with pkg-config data, and Tcl is built to use them.
  2. If pkg-config-supporting copies of the libraries are not present, then pkg-config will complain when tcl.pc is used:

    Package zlib was not found in the pkg-config search path.
    Perhaps you should add the directory containing `zlib.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'zlib', required by 'tcl', not found
    
    

    Package libtommath was not found in the pkg-config search path. Perhaps you should add the directory containing `libtommath.pc' to the PKG_CONFIG_PATH environment variable Package 'libtommath', required by 'tcl', not found

  3. If Tcl has built against external copies of these libraries, but they do not provide pkg-config data, then presumably tcl.pc is responsible for providing any necessary build flags.

  4. If external libtommath is used, then -DTCL_WITH_EXTERNAL_TOMMATH should be specified in the cflags field of tcl.pc.

    Python, for its official binary distributions, would likely prefer to continue having Tcl build with its bundled libtommath, since nothing else in CPython uses libtommath. Defining TCL_NO_TOMMATH_H allows Tkinter to build against Tcl with bundled libtommath. But handling the case of Tcl built with external libtommath seems to require knowing whether TCL_WITH_EXTERNAL_TOMMATH is defined; and Tkinter, by default, tries to use pkg-config to get Tcl/Tk build flags, rather than from TEA/tclConfig.sh/TCL_DEFS as usually done by Tcl/Tk software.

  5. If Tcl was built using bundled versions of these libraries, then there is nothing which should be put in tcl.pc for them--at least not in Requires.private or linking flags.

Referenced by2
chrstphrchvzwiki2023-06-26 20:54:00

I am attaching a brief patch for 8.7 and later, which I would consider the bare minimum for improving tcl.pc to correctly indicate bundled or external libtommath dependency. It appears to work with Tkinter.

The approach in the patch assumes that if external libtommath is used, then it was installed with pkg-config data; maybe it often is, but that is not guaranteed. (MacPorts, for example, only recently began installing libtommath.pc: https://github.com/macports/macports-ports/pull/18424) Ideally, if a dependency is listed in tcl.pc, then that should mean Tcl used pkg-config to detect it and retrieve its build flags (e.g. -lz, -ltommath); only when a dependency is not detected by pkg-config should Tcl try providing build flags.

jan.nijtmanswiki2023-07-11 09:30:19

Fixed [here]. Looks good to me.

Log in (anonymous is fine) to add a comment.

Attachments: