Closed danyeaw closed 3 years ago
Hello,
It is likely that libffi.so.5
shipped in the AppImage comes from the vanilla Python install. If I am correct the ctypes
package from the standard library uses it as well.
Which package provides gi
? I don't see it explicitly in the list of bundled packages? Is it pygobject
? In this case I don't see any binary wheel on PyPI for this package. I only see a tarball. This would imply that the _gi
package is built from source by pip
BUT this occurs on the Ubuntu 20.04 runner which would explain that _gi
is looking explicitly for libffi.so.7
, i.e. the runner library it was linked to at compile time. In order that the AppImage runs on many linuses one needs to build this package using a manylinux Docker image, not directly the GitHub runner.
Bundling source packages with C extensions is not yet supported by the python-appimage
app builder. Only binary wheels should be used, i.e. packages pre-built using a manylinux Docker image as recommended in PEP 513 and the following.
My apologies since this is not clearly stated in the README.
Thanks for the quick response @niess!
Yes pygobject
provides gi
, and yes it is built from source and linked against the GTK libraries. No problem that this isn't currently supported, definitely understand that this is much more of an advanced use case.
For anyone coming across this issue in the future, I was able to get an AppImage built of a PyGObject app by taking these steps:
./dist/app-name/app-name
prior to proceeding on.export PATH="${HERE}/${PATH:+:$PATH}"
. This adds the /
directory to the path in the AppImage which is where PyInstaller will put your app-name executable. Place the AppRun script file in dist/AppRun/ and make sure it has chmod +x
applied to it so that it is executable../appdir-lint.sh dist/AppRun
to make sure that all of the previous steps got you to a valid AppImage structure../appimagetool-x86_64.AppImage dist/AppRun dist/app-name-x86_64.AppImage
to build your AppImageProbably a blog post is in order :smile:. @amolenaar FYI.
@danyeaw Sorry, I'll have to update the README to make this point clear
Thank you for the walk-through. Does the resulting AppImage run on any Linux? E.g. CentOS6? Usually one needs to build the application / package with Docker using a manylinux like image in order to get such binary compatibility? But maybe pyinstaller does this under the hood? Or maybe it fetches highly compatible versions of the various binary deps.
The 1st note of the pyinstaller docs clearly states that the result is (of course) OS dependent. But it does not indicates if its "Linux version/flavour" dependent as well?
I didn't think about the compatibility, thanks for pointing that out. I figured if it ran on Ubuntu and openSUSE then it would run on most distros. I spun up a CentOS7 VM and I get the following error when I tried to launch it:
Error loading Python lib 'libpython3.9.so.1.0': dlopen: /lib64/libm.so.6: version GLIBC 2.29 not found.
python-gobject packages weren't released until CentOS8, so I am not sure if I am going to be able to use the manylinux docker image to build this. Maybe if I can get Gaphor running on Ubuntu 14.04 (Trusty) it could be used to improve compatibility using Travis CI (:-1:) or a docker image.
@danyeaw Then it looks like pyinstaller
is doing the compilation on the host as well. Consequently your AppImage won't run on a Linux that uses an earlier version of GLIBC than the host one (2.29 in your case).
In order to solve this issue you could build the app binaries (C extension modules & shared libraries) with a Docker image of an older Linux distro, e.g. manylinux2010 or manylinux2014 if manylinux1 does not support your app. For example as in the L25-38 of this workflow.
@niess manylinux2014 is built on centos7. I just realized that we are using features of GTK 3.24 and centos7 ships with 3.22.
Thanks for the great library! :heart:
I am trying to bundle Gaphor with is a PyGObject app in to an AppImage. Everything works fine locally (openSUSE Tumbleweed), but when I build it using Ubuntu 20.04 with the GitHub Actions runner the AppImage fails to load.
Taking a look inside the AppImage:
libffi.so.5 is bundled, but not libffi.so.7. I also tried to
apt-get install libffi7
on the runner to make sure it is installed.This is the output of running the build: