New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS does not pass DYLD_LIBRARY_PATH to subprocesses #7973
Comments
Hmm...
So I assume you are talking about I suspect this block of code in the bootloader pyinstaller/bootloader/src/pyi_utils.c Lines 930 to 956 in 126a2a0
is to blame, rather than macOS. I need to look a bit deeper, but my first impression is that we should get rid of those unsetenv's. As the comment above them states, we explicitly go to the trouble of rewriting library search paths on collected binaries to be independent of dyld environment variables, and by extension, we should be able to not care if they are set or not (i.e., should not touch them at all)... |
Awesome. I thought it was the macos security thing. This is great news thank you! |
Description of the issue
macOS does not pass the DYLD_LIBRARY_PATH env var (or other dyld-related env vars) to subprocesses: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html#//apple_ref/doc/uid/TP40016462-CH3-SW1
Therefore, on systems with a DYLD_LIBRARY_PATH set, the Python scripts in the binaries generated by pyinstaller do not have access to it, and so pyinstaller can not be used if the target system is expected to have a meaningful DYLD_LIBRARY_PATH set.
It would be nice if pyinstaller found some way to explicitly pass these environment variables through.
Thought: Unfortunately, passing them through the env parameter to e.g. Popen doesn't work; the only way I've found to pass them through is to spawn subprocesses in shell mode and embed the env vars on the command line, which also requires sanitizing the env vars to prevent arbitrary command execution. I don't know if there's another way.
Context information (for bug reports)
Output of
pyinstaller --version
:6.0.0
Version of Python: 3.9.6
Platform: macOS
How you installed Python: default macOS install
Did you also try this on another platform? Does it work there? Yes it works on Linux and Windows
try the latest development version, using the following command:
(https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
Make sure everything is packaged correctly
--noupx
or setupx=False
in your .spec-file--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.A minimal example program which shows the error
Stacktrace / full error message
N/A
Please also see https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs
for more about what would use to solve the issue.
The text was updated successfully, but these errors were encountered: