Open lvc opened 6 years ago
Just noticed that you are the man behind abi-laboratory.pro. Awesome project! 👍 If you have some time, I'd love to hear your opinions on https://gitlab.com/probono/platformissues and an upcoming talk about them I am currently working on
Let's have a look:
# Get the AppImage
wget -c https://download.opensuse.org/repositories/home:/linuxbuild/AppImage/hw-probe-latest-x86_64.AppImage
# Extract the AppImage
chmod +x ./hw-probe-latest-x86_64.AppImage
./hw-probe-latest-x86_64.AppImage --appimage-extract
# See what is going on
sudo strace -f squashfs-root/AppRun -all 2>&1 | grep usb.ids
# gives:
# [pid 5953] openat(AT_FDCWD, "/usr/share/usb.ids", O_RDONLY) = -1 ENOENT (No such file or directory)
# Search where this comes from
grep -r '/usr/share/usb.ids' squashfs-root/
# gives:
# Binary file squashfs-root/usr/bin/lsusb matches
# Patch
sed -i -e 's|/usr/share/|././/share/|g' squashfs-root/usr/bin/lsusb
# Check whether it works
sudo strace -f squashfs-root/AppRun -all 2>&1 | grep usb.ids
# gives:
# [pid 7470] openat(AT_FDCWD, "././/share/usb.ids", O_RDONLY) = 3
This works because the standard AppRun
launcher, before executing the payload application, does a chdir()
into usr/
inside the AppDir. This allows us to binary-patch the string /usr
with the same-length string ././
which means "here", and it will work as long as the payload software does not do chdir()
on its own.
So, in your appimage.yml you could add
sed -i -e 's|/usr/share/|././/share/|g' $BUILD_APPDIR/usr/bin/lsusb
torwards the end, and it should work. Or somewhat more drastic
find $BUILD_APPDIR/usr/ -type f -executable -exec sed -i -e "s|/usr|././|g" {} \;
which should also solve it for lspci
as well.
Now, the question is, why does binpatch: true
and union: true
not work for you? The former should do the binary patching, and the latter should use LD_PRELOAD to rewrite the paths... possibly https://github.com/AppImage/AppImages/blob/master/YML.md#keys-that-enable-ability-to-relocate are not (yet?) implemented on OBS. OBS uses its own version of the tooling, so there might be subtle differences.
cc @adrianschroeter
Hi,
This has solved my issue. Thanks a lot!
Now I have a great portable app! The reason of using the AppImage was in absence of dependencies for my app in most Linux distributions (even in modern ones) and differences in the installing procedures and package formats. With AppImage installing my app is easier than installing from a package repository!
However I've experienced several problems with creating the image:
1) The first one is that OBS currently can't use external ingredients. I've followed the https://github.com/AppImage/docs.appimage.org/blob/master/source/packaging-guide/obs.md and tried to use build:
git:
property of the appimage.yml
but build service always returns Can't resolve github.com
when building the image. I've placed source files in the OBS home project and referenced to them from the appimage.yml
file instead.
2) Missed app.desktop
blocks building of the image and log files were empty. It took some time to understand from the AppImageKit source code that desktop file is necessary for building the image.
3) I've found that it's easier to create the image by adding appimage.yml
and app.desktop
directly to my home OBS project near RPM specs and other stuff rather than from AppImageTemplate in a separate project and build together with other packages.
4) Editing of project meta data doesn't work for me in the web site form (adding repository
tag to package
). It only works via osc
tool.
5) Need to set SSL_CERT_DIR=../var/lib/ca-certificates/pem
to download or upload anything by curl
in my app.
6) The issue with executing lsusb
and lspci
(solved here).
BTW
There is a broken redirect link on this page https://github.com/AppImage/AppImageKit/wiki/Using-Open-Build-Service to the obs.md
.
@lvc we're moving to https://docs.appimage.org at the moment, we will fix the links there.
Now I have a great portable app! The reason of using the AppImage was in absence of dependencies for my app in most Linux distributions (even in modern ones) and differences in the installing procedures and package formats. With AppImage installing my app is easier than installing from a package repository!
That's the goal of AppImage. I think your projects and ours fit very well together, as we both care about establishing a platform rather than a fragmented ecosystem...
git:
property of theappimage.yml
but build service always returnsCan't resolve github.com
This may well be an OBS bug? cc @adrianschroeter
It took some time to understand from the AppImageKit source code that desktop file is necessary for building the image.
Where in https://github.com/AppImage/docs.appimage.org/blob/master/source/packaging-guide/obs.md could we make this clear? What would have helped you?
I've found that it's easier to create the image by adding
appimage.yml
andapp.desktop
directly to my home OBS project
Yes, you don't need to use AppImageTemplate
but it's a convenient "scaffolding" for people starting from scratch.
Editing of project meta data doesn't work for me in the web site form (adding repository tag to package). It only works via
osc
tool.
Again, most likely a OBS bug. Please report it in the OBS bug tracker. cc @adrianschroeter
Need to set SSL_CERT_DIR=../var/lib/ca-certificates/pem to download or upload anything by curl in my app.
Why? Most likely because of this. Workaround: Patch whatever consumes certificates (e.g., libgnutls
) to look in all known places. Example: https://github.com/darealshinji/vlc-AppImage/issues/1#issuecomment-321041496
Just noticed that you are the man behind abi-laboratory.pro. Awesome project! +1 If you have some time, I'd love to hear your opinions on https://gitlab.com/probono/platformissues and an upcoming talk about them I am currently working on
Interesting! Thank you.
Hi,
I'm trying to build an AppImage on OBS for a script that executes
lsusb
: https://build.opensuse.org/package/show/home:linuxbuild/hw-probeI run the resulting AppImage by:
lsusb
trying to find/usr/share/usb.ids
file on a host system instead of the localusb.ids
file in the AppImage directory. But on the host system such file doesn't exist and lsusb has failed.Why
binreloc
doesn't relocate it? I've tried bothbinpatch: true
andunion: true
.How can I fix settings to force relocating of
lsusb
?The same issue affects
lspci
.Thank you.