-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Library issues with Linux AppImage observed at runtime #718
Comments
is this the problem I am having? |
This is unrelated to |
Yeah, I'm getting a possibly related issue when try to do a minimalist build:
I haven't dug into how briefcase even works yet :-) |
@nickzoic That sounds consistent with at least one of the class of errors we've been seeing on Linux; although I don't think it's been reported on Ubuntu 20 before. libgtk errors are usually tied to "recent" linux distros (Ubuntu 22.04, et al). |
Yep, I've been picking away at it & trying to work out exactly where things are going wrong ... maybe somewhere in Was there a known set of versions where it did always work on linux? |
So - it still works for me on my Ubuntu 20.04 box - but I set up that machine (a VM running in Parallels on macOS) some time ago (almost a year ago). It was originally a 20.04.2 install, but I've got all updates applied. Here's a zip file with the contents of |
There is a pretty recent linuxdeploy plugin for GTK which is doing a lot of the hard work of bundling the dependencies, maybe we could make use of it? https://github.com/linuxdeploy/linuxdeploy-plugin-gtk |
Certainly possible. If this is the fix, we may need to add a configuration item for loading linuxdeploy plugins (Toga needs the GTK plugin, but Qt-based apps won't, for example - presumably there are plugins for Qt-based apps). If there's a way to reproduce the behavior without a plugin, that would be even better; however, I have no idea if this is even possible - we'd need a much better understanding of what plugins are doing in practice. |
Yep, I got about as far as staring into the linuxdeploy source code in the hope that it'd look back into me :-) More generally, though, how is the deploy process meant to know which .so libraries it'll need? |
So - the honest answer is that I'm not 100% confident I know for sure. As I understand it, linuxdeploy looks at the binary that is being deployed, extracts the list of dynamic libraries that are linked by that binary, then does the same on those libraries, and so on until it has a complete list of libraries needed for execution; it then copies and rewrites them so that they are all present in the AppImage. The only library it doesn't do this for is libc, which is assumed to be present for bootstrapping purposes. This can fall over if the libraries are loaded dynamically - e.g., in the case of Python loading third party binary libraries. To accounts for this, you explicitly pass in other paths or libraries that you explicitly want to be processed or included. We do a lot of this to ensure that dynamic libraries are loaded. I haven't looked into the plugin system in depth, but as I understand it, the plugins exist to automate some of these inclusions, and to add into other libraries that might need to be manually excluded. I know there is a GTK plugin - but it hasn't been needed to date to get the AppImage working. I will also add that I'm not 100% wedded to AppImage. It exists, and I was able to get it to work; but my impression is that flatpak is a lot more "industry standard" when it comes to cross-platform Linux binary distribution. If the "fix" here is "add a Flatpak backend and make it the default", I'd be completely on board with that. |
Update: I've added in see https://github.com/nickzoic/beeware-briefcase/tree/718-library-issues-gtk but I still need to:
|
I'm interested that you needed to modify packages in |
So running with
Adding Adding pyproject.toml.txt <-- the I'm pretty much just cargo-culting at this point though so I might well be missing the point :-) |
Ok - so... I'm interested what the reverse behavior is. If you add those two dependencies in to |
Just tried it out, so unmodified briefcase 0.3.7 and toga 0.2.15 from pypi, run briefcase new then edit pyproject.toml and run briefcase create; briefcase build; briefcase run ... build works, but briefcase run fails with the same TypeError I mentioned in my first comment in this issue. (just tried it just in case: same with toga at cf31b7c) |
It doesn't surprise me that Toga 0.2.15 has some packaging problems; it used a different mechanism to find the GTK libraries. But if the same problem is persisting with a recent Toga trunk, then it looks like the plugin may be called for. It would be good to know what the plugin is actually doing, though... |
Weirdly, the plugin turns out to be a bash script. |
@freakboy3742 > If the "fix" here is "add a Flatpak backend and make it the default", I'd be completely on board with that. Just for fun, I've made a start on a flatpak backend at #754 ... it's a very sketchy proof of concept but it does let you run the toga "hello, world" as a flatpak. I'll open a WiP PR for it and add some notes on what needs to be done still. |
I've just had a minor breakthrough on one of these problems - the one that manifests as:
Pillow is a common example where this appears - in that instance, it's usually See #759 for an explanation and proposed fix. |
As noted on #717 and beeware/Python-Linux-support#2, it appears that manylinux isn't going to be a fix for these problems. A combination of #756 and #759 looks like it will address the bulk of the issues we're seeing; with #596 being the source of a more comprehensive fix. |
…/offset errors.
#759 looks like it won't work as a generic solution; however, there's a documentation only solution in #761. I've also reported the issue upstream: linuxdeploy/linuxdeploy#204 |
Refs #718 - Document a workaround for ELF load command address/offset errors
After a lot of investigation, it appears that #756 addresses the bulk of the GTK-related issues running on "recent" Linux releases; #761 addresses the issues related to binary modules. On that basis, I think this ticket as a "locus of Linux packaging issues" has reached the end of its useful life. If any new issues arise with Linux packaging, we can investigate further based on those specific reports. |
A large number of reports have been received (#458, #470, #481, #504, #583, #618, #625, #631, #692) relating to AppImage support on Linux. This is a consolidation ticket to cover the general problem of Linux AppImage support.
To Reproduce
Reports are most common when using third party binaries (e.g., Pillow), or GUI libraries that have third party binaries (e.g, PySide2/6). However, problems have also been observed with Toga apps when deploying on recent versions of Linux (e.g., using Ubuntu 22.04)
The problem manifests in one of two ways.
A failure to find dependencies during build time:
Missing dependencies at runtime:
The specific libraries involved vary between reports, but common themes include:
Expected behavior
It should be possible to build and run Linux AppImages on any version of Linux.
Environment:
Additional context
There are likely a number of underlying problems that all have similar manifestations. It seems highly likely that we're not driving LinuxDeploy correctly. Given the number of options and plugins that exist for linuxdeploy, and the complexity of binary compatibility on linux, that's not entirely surprising. We need a better understanding of how LinuxDeploy should be working, and then test on a wider range of configurations and systems.
#717 is related to this; it's possible that some of the reported problems may be avoided by adopting a manylinux base.
The text was updated successfully, but these errors were encountered: