-
-
Notifications
You must be signed in to change notification settings - Fork 635
Description
Hi! In today's release (20250808) of python-build-standalone we've split out _tkinter, libtcl, and libtk into their own dynamic libraries (astral-sh/python-build-standalone#676). This should address issues like #2540 where tkinter didn't work right. I'm opening this mostly because we're now generating three new .so files and I don't know if you need to adjust something on your end to pick them up. But also, if you see any issues with the new setup, please let me know, either here or by opening an issue in python-build-standalone.
Details on the implementation, if it's helpful:
_tkinteris now a separate extension module and no longer statically linked into bin/python and libpython (so any user code using_tkinterwill need to bundle the dynamic library and unpack it at runtime)- There are separate
libtcl8.6.soandlibtk8.6.so(or.dylib) libraries inside ourlibdirectory. - On Linux,
bin/python3has aDT_RPATHpointing it at thelibdirectory, soimport _tkinterfinds our copies of libtcl and libtk. Users oflibpython3.x.sowill need to set up rpaths or something on their own. (If it's helpful can add an rpath tolibpython3.x.so, or tweak theDT_NEEDEDin_tkinterto use$ORIGIN/../../libtcl8.6.soetc. (though that trick would only work for gllibc, not musl). - On macOS,
lib/python3.x/lib-dynload/_tkinter.cpython-3x-darwin.sohas anLC_RPATHpointing at@loader_path/../../, and the install name of libtcl and theLC_LOAD_DYLIBentry in_tkinteris@rpath/libtcl8.6.so.dylib, and the same for libtk. So if you maintain thelib/directory structure you shouldn't need to fiddle with library paths on your own. - libX11 and friends are now statically linked into
libtkon Linux. At some point I might make these dynamic libraries and/or attempt to look for the system version.
Also, speaking of changes to dynamic libraries, as of a few months ago, our Linux builds statically link libpython into the interpreter, so you no longer need lib/libpython3.x.so.1 to run bin/python. We still ship libpython for the sake of people embedding Python into a larger program. At some point I want to split this out but I haven't yet figured out how to coordinate that transition.