-
-
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
Improved the resolution of dependencies in darwin MachO files. #590
Improved the resolution of dependencies in darwin MachO files. #590
Conversation
Hi, I'm new maintainer of cx-freeze. Can you resolve the conflicts to continue the review? |
Hi Marcelo,
Congratulations on taking over as maintainer. I’m a bit tied-up at the moment, but will put this on my todo list.
Best,
Ian
… On Jul 9, 2020, at 9:19 AM, Marcelo Duarte ***@***.***> wrote:
Hi, I'm new maintainer of cx-freeze. Can you resolve the conflicts to continue the review?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#590 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AE5F6UIBBFKLPEAEW6G6QXLR2W7VNANCNFSM4KWAZBLQ>.
|
70bdb74
to
cf27462
Compare
FYI -- resolved the conflicts. |
@cainesi print(sys.argv) #traceback |
[Sorry, didn't mean to close -- was a mis-click!] Hi Marcelo -- would you mind sending me a copy of the script, so I can see what is actually being done that triggers this error. My guess is that you have two packages that (i) are both being included in the zip file, and (ii) each separately includes a MachO file with the same name. If a package is being included in the zip file, then any binaries it references get copied into a specific directory. So if we are trying to copy two libraries with the same name, there will be problems. (I think this was always an issue, but before my changes it was just sort of silently ignored-- maybe on the assumption that the two files would likely be equivalent anyway.) I suppose in this case (as a stop-gap) we could print a warning message telling the user to remove one of the packages from the zip and try again? A better but more complicated change would be to rename one of the libraries, and then trace through to make sure all the binary linkage data was updated correctly.
[...]
|
Why do you close? |
Sorry, closed by mistake. |
Is a very simple test. My GA used to test is not good. #samples.py
#setup.py
python setup.py build |
In my test it not use crypto, but two crypto libraries are found. Python itself uses a crypto library, but I think that it uses only one. |
Thanks Marcelo, The two conflicting files that cx-freeze is trying to include are "/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib" and "/usr/local/Cellar/openssl/1.0.2t/lib/libcrypto.1.0.0.dylib". It seems like those are probably both installed by Homebrew. I'm not very familiar with Homebrew, but I just googled it and it looks like the files in /usr/local/opt/ are just sym-links of the files in /usr/local/Cellar/ (and the opt directory there so that libraries can have version-independent paths). So I guess what is happening is that cx-freeze, when it is tracing through all the binary dependencies, gets to the libcrypto.1.0.0.dylib library in two different ways resulting in the two different paths above. It thinks those are actually different files, and fails out. If you look on my fork of the project, I have another branch that prints out a detailed report of why each file is being included (e.g., what it is a dependency of) ("trace_includes" branch). When I run that, it looks like libcrypto is a dependency of three files:
But I'm using macports, and on my machine those three ways of getting to libcrypto all result in the same path... |
@cainesi I'll release a version in a few days, but I'll leave you PR for the next, because of a need to test it in some way. I don't have a mac, then I'm trying to test in GA but I have errors not related to your patch. Then, I'll dedicate myself to release this version and the next to issues and improvements on the mac side. I also want to ask you to put the samples in a separate PR. "looks like the files in /usr/local/opt/ are just sym-links of the files in /usr/local/Cellar/ " |
b6b1d7c
to
3f08428
Compare
I've removed the new samples and implemented the os.path.realpath fix in the latest commit. Let me know if if fixes your issue. Incidentally-- would you prefer to have the pull request squashed down into a single commit? |
This PR doesn't work correctly with the latest master because of the following new code that was added to
The problem is that the logic of the PR assumes that _GetDependentFiles would only be called from _CopyFile (where a DarwinFile object would already have been created for the file for which dependencies are being determined). I'm not sure that the code above is necessary--wouldn't the same dependencies be found when we did the _CopyFile later in the function? |
Initially I have implemented only on Windows (#640), and fixed some issues, including the use of pyside2/shiboken2. I isn't always necessary, only in some circumstances. It can be detected and copied in some systems, in others no, then I force the copy. |
Okay, I think I can revise the PR to work around that then. I am a bit curious how the person in #701 could have ended up with the wrong Python version on OSX. The Console base file links to Python, so that should have brought it in? I wonder if maybe the person had built the extension with a different version of Python, resulting in a bad link in that binary? |
cx-freeze needs to find the shared library to copy to build folder. In some systems, Python is static linked and distribute the dynamic lib (See this: conda-forge/python-feedstock#222) It is possible, in that case, as it has an official python 382 with shared lib and pyenv python 384 static linked (without distributing a shared lib). |
Made revisions pursuant to requests from Marcelo.
…o include same file twice via two different symbolic paths.
3f08428
to
1c8d9e7
Compare
The PR should now accommodate the additional _GetDependencies calls in _FreezeExecutable. I left this as separate commits for now to ease review. But would you mind if I squashed it into a single commit before this gets accepted? |
Then I'll take a look.
|
Hi @anthony-tuininga, How are you? |
@cainesi I will merge your patches and publish a new version as soon as I can. |
Some type annotations not compatible with supported python 3.5 version |
Thanks for the heads-up. I have no more revisions on this pull request. (I've been focused on the Windows side more, recently.) Cannot comment on the python3.5 issue--have not been using that for a while. The type annotations are obviously not critical (though I like them!) if you want some removed to maintain compatibility. |
@cainesi I'll fix annotations later, when (if) @marcelotduarte will merge my PR |
This improves the resolution of dependences between dynamic libraries on OSX, by keeping track of the rpaths set in each file in the chain of dependencies and searching through the rpaths to find the correct dependent files.
(This fixes a problem I was having with cx_Freeze not finding certain dependencies in PyQt5.)