Skip to content

splash: perform binary dependency analysis on Tcl/Tk shared libraries - #7679

Merged
rokm merged 3 commits into
pyinstaller:developfrom
rokm:splash-dll-dependency-scanning
Jun 5, 2023
Merged

splash: perform binary dependency analysis on Tcl/Tk shared libraries#7679
rokm merged 3 commits into
pyinstaller:developfrom
rokm:splash-dll-dependency-scanning

Conversation

@rokm

@rokm rokm commented Jun 4, 2023

Copy link
Copy Markdown
Member

Have SPLASH perform proper dependency analysis on Tcl/Tk shared libraries, in order to ensure that dependencies are always collected (otherwise they might be missing unless the user's program uses tkinter), and that they are added to splash requirements list (so that onefile builds pre-extract them before running the splash screen). Up until now, the only dependency we had to worry about was vcruntime140.dll on Windows (and even that only in context of pre-extraction). But the python.org Python 3.12b1 Windows build comes with tcl86t.dll that has additionally dependency on zlib1.dll, which we fail to pick up in our tests.

The failed tests revealed that failing to load Tcl/Tk shared libs crashes the bootloader with NULL-pointer dereference, so fix that as well. The program now reaches the user's python code, and if the latter attempts to use pyi_splash module, it will raise an exception.

Lastly, the splash tests are now ran in four variants: notkinter-onedir and notkinter-onefile (which we've had up until now), as well as tkinter-onedir and tkinter-onefile (where we use hidden import to simulate user's program depending on tkinter).

rokm added 3 commits June 5, 2023 00:10
Extend the existing splash tests (onedir, onefile) that do not
collect tkinter (and, in fact, explicitly exclude it) with a
variant that forces tkinter collection via hiddenimports.

The `tcl86t.dll` shipped with Windows build of Python 3.12b1
depends on `zlib1.dll`, and due to the lack of dependency scanning
in splash, we fail to pick it up there. Threrefore, only
`tkinter-onedir` test variant succeeds, as the `zlib1.dll`
dependency is picked up by dependency scanning in main build
process, which analyzes Tcl/Tk DLLs as dependencies of `tkinter`.

Both `notkinter` test variants fail to collect `zlib1.dll`, while
`tkinter-onefile` collects it, but fails to extract it as it is
not listed among the splash screen requirements.
Fix a crash due to NULL pointer dereference in splash tear-down
that happens due to incomplete shared library attachment; this
may happen either because Tcl or Tk shared library fails to load,
or because we fail to load a required symbol from one of the
libraries.
Perform binary dependency analysis on Tcl/Tk shared libraries, to
ensure that a) they are collected in cases when the progam does
not use `tkinter`, and b) they are made available in onefile
builds via pre-extraction.

Up until now, the only dependency we had to worry about was
`vcruntime140.dll` on Windows (and even that only for onefile
pre-extraction), but the `tcl86t.dll` that comes with Windows
build of Python 3.12b1 also depends on `zlib1.dll`.
@rokm
rokm force-pushed the splash-dll-dependency-scanning branch from c4bdc41 to ba4d182 Compare June 4, 2023 22:39
@rokm
rokm merged commit da382ed into pyinstaller:develop Jun 5, 2023
@rokm
rokm deleted the splash-dll-dependency-scanning branch June 5, 2023 14:11
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants