-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
Always copy the python dynamic libraries into lib folder #518
Always copy the python dynamic libraries into lib folder #518
Conversation
@@ -215,7 +227,7 @@ def _GetDefaultBinExcludes(self): | |||
if sys.platform == "win32": | |||
return ["comctl32.dll", "oci.dll", "cx_Logging.pyd"] | |||
else: | |||
return ["libclntsh.so", "libwtc9.so"] | |||
return ["libclntsh.so", "libwtc9.so", "ldd"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of the addition of "ldd"? What would request its inclusion anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Alpine Linux ldd is a reference to a system library (virtual library maybe)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #513 for more reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously I had a patch #517 just for that, but I decided to put it together.
setup.py
Outdated
@@ -28,7 +28,7 @@ def build_extension(self, ext): | |||
return | |||
if sys.platform == "win32" and self.compiler.compiler_type == "mingw32": | |||
ext.sources.append("source/bases/manifest.rc") | |||
os.environ["LD_RUN_PATH"] = "${ORIGIN}:${ORIGIN}/../lib" | |||
os.environ["LD_RUN_PATH"] = "${ORIGIN}:${ORIGIN}/lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code was intended so that if you installed the executable in /usr/bin (for example) that you would then find the library in /usr/lib. This would eliminate that and require that the files be found in /usr/bin/lib -- which seems wrong! Perhaps it might be satisfactory to simply add ${ORIGIN}/lib and not replace ${ORIGIN}/../lib"?
And if we are moving all files to the subdirectory lib, should we remove ${ORIGIN}?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had been a little doubtful about this point, but some change here is needed. I tested it on ubuntu and alpine and it seemed correct. I didn't understand why it had this "$ {ORIGIN} /../ lib". And I think this "$ {ORIGIN}" could be removed yes. I'll try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to:
os.environ["LD_RUN_PATH"] = "${ORIGIN}/../lib:${ORIGIN}/lib"
The test pass on alpine linux (with this patch and other that it depend #494)
The test pass on my projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated.
This patch has multiple purposes. With it libpython*.so* is moved to the lib folder, so only the executables will be in one folder and everything else in the lib folder. I see that in some cases, and there are several issues about it, libpython is copied several times. Now it's one less (To be honest, in linux I only saw duplicate, one in root and one in lib).
With this patch it was also possible to run alpine linux on a docker (with the help of #494 and #516). It will also resolve cases where the user compiles python from sources (in alpine it is the same). Why? Because python is placed in /usr/local and not in /usr, and ldd doesn't find the dependencies, so I find the python dependencies (sys.executable) and it resolves it.
I tested on ubuntu and alpine, with one of my projects and with samples advanced, sqlite, pyqt5.
I want to do the same for windows, but I have to solve the dll hell, and if it works, will greatly improve the issue of duplicate files.