-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Pillow sample on macOS #1033
Comments
The problem is that you're trying to run the result of the build_exe command. On OSX, you cx_freeze generally needs to update the dynamic links in the object files to make the frozen application run, but that does not happen until the bdist_mac command creates an application bundle. The contents of the directory created by build_exe will often end up working anyways, since the dynamic links will still be pointing to the relevant files on the file system, but that is sort of an accident (and depends on the links). In your case, PIL._imaging.cpython-38-darwin.so was trying to load "@loader_path/.dylibs/libopenjp2.2.4.0.dylib". "@loader_path" is the directory of the linking object file. Since PIL._imaging.cpython-38-darwin.so is now in exe.macosx-10.14-x86_64-3.8/lib, rather than its original location, the link broke. On my computer I get the same error when I try this, but the application bundle created by bdist_mac does work. (This issue is unrelated to the WARNING at the top of the log.) |
In my tests, the following samples are tested in osx:
The pillow sample is the only one that fails.
I do not agree with this. Maybe it's like that today, but I don't think it was like that originally. For example, on windows, build_exe works in all cases, it can run, and if you want you can use bdist_msi. You can use another app like innosetup to distribute, using the build. I think on mac it should be the same, bdist_mac is an option, not a must. |
At least for the OSX, it looks like it has been that way since the very first version of macdist.py, about 10 years ago. The key thing is that setRelativeReferencePaths() is part of bdist_mac. I agree that there is no reason that we could not move that code over to the build_exe command (but only triggering on OSX), so that the relative references are fixed up at that point. The other platforms do not have the same issue as far as I know. The situation is confusing for users, since the executable in the exe/ directory will often still work, because the dynamic links happen to still work after the files are moved into exe/ (though it is hit or miss, and the links might not be pointing to the "correct" copy of the libraries included in that directory). And sometimes the exe/ directory will work even when the .app bundle doesn't (e.g., because we're failing to copy something into the .app bundle). |
It is confusing to me ;-) |
I talked to @anthony-tuininga who said: |
Hi Marcelo. No problem. I think it should be relatively easy to change the code so that the build_exe output runs correctly. I'll put that on my todo list for when I have a chance to turn back to this. |
To Reproduce
Build and run the pillow sample on macOS
Expected behavior
Build and run.
Desktop (please complete the following information):
Additional context
Part of my log:
@cainesi You can test in your enviroment and maybe find a solution?
The text was updated successfully, but these errors were encountered: