mumble-voip / mumble

Mumble is an open-source, low-latency, high quality voice chat software.
https://www.mumble.info
Other
6.28k stars 1.11k forks source link

Mumble AppImage not working #3959

Closed rafaelbonifaz closed 1 year ago

rafaelbonifaz commented 4 years ago

I try to test Mumble from AppImage, but it does not work. I have try the newst versions at this time downloaded from here. That is: Mumble-1ffbbc44-x86_64.AppImage, Mumble-e0a4eb21-x86_64.AppImage, Mumble-72e1f47b-x86_64.AppImage, Mumble-f384cca9-x86_64.AppImage and Mumble-ce40787c-x86_64.AppImage

I Debian 10 I get this error:

qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
<W>2020-01-29 11:55:31.087 QSslSocket: cannot call unresolved function SSLv23_client_method
<W>2020-01-29 11:55:31.087 QSslSocket: cannot call unresolved function sk_num
Violación de segmento

In Fedora 30 I get the same error. I guess there is a QT ssl reletaded library missing.

rafaelbonifaz commented 4 years ago

From this thread, I found this image that works in Debian 10 and not in Fedora 30. The two VMs where I have tested.

In Fedora 30 I get an error of a missing library.

./Mumble-8026d1c-x86_64.AppImage: error while loading shared libraries: libjack.so.0: cannot open shared object file: No such file or directory
Krzmbrzl commented 4 years ago

The latter error with libjack is probably due to Fedora not using JackAudio and thus I doesn't have the respective shared library. However Mumble seems to have been compiled with JackAudio support and thus it tries to load it. That at least is my theory :)

davidebeatrici commented 4 years ago

Yes, the JACK library is not installed by default.

The issue was fixed in 2e1d3f112ffd3abbc6e7d899b866714119867f0f, the library is not required anymore when Mumble is built with JACK support.

rafaelbonifaz commented 4 years ago

Maybe @probonopd can help us with this error. It would be very nice to have a working AppImage for Mumble.

probonopd commented 4 years ago

Maybe @probonopd can help us with this error.

Assuning that you mean the JACK situation and not the QSsl situation:

As far as I know there is no way to build in a way that works on systems with and without JACK. So it may be best to build a version for systems without JACK and a version for systems with JACK, and make two AppImages. (If you want to be more fancy, you could probably put both into one AppImage and have a bash script that would select the one that matches the system.)

rafaelbonifaz commented 4 years ago

Assuning that you mean the JACK situation and not the QSsl situation:

I mean the QSsl situation. I have try to use the AppImages listed here: https://dl.mumble.info/snapshot/ without success. I always get the QSsl error and Mumble does not open :(

probonopd commented 4 years ago

All I can say at this point is that it is working for me on a Ubuntu 18.04 system:

<W>2020-02-04 22:15:14.072 OpenSSL Support: 1 (OpenSSL 1.1.1d  10 Sep 2019)

Maybe the OpenSSL in Debian 10 is broken in binary incompatible ways?

rafaelbonifaz commented 4 years ago

Maybe the OpenSSL in Debian 10 is broken in binary incompatible ways?

What do you mean? Compatibility between Openssl and the AppImage? Compatibility between QT and OpenSSL? I get this error, not only in Debian 10, but in Fedora 30, Fedora 31 and a very similar one in Debian 9.

I can confirm that the AppImage works fine in Ubuntu 18.04 and in an updated Manjaro Linux.

I also tested in Debian 9 and it did not worked, but I get a similar error, but with more info:

./Mumble-ce40787c-x86_64.AppImage 
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
<W>2020-02-05 08:34:11.045 ALSAInit: No cards found, not initializing
<W>2020-02-05 08:34:11.045 G15LCDEngineUnix: Unable to connect to G15Daemon.
<D>2020-02-05 08:34:11.049 libopus 1.2.1 from libopus.so.0
<W>2020-02-05 08:34:11.051 CELT bitstream 8000000b from libcelt0.so.0.7.0
<W>2020-02-05 08:34:11.062 Theme: "Mumble"
<W>2020-02-05 08:34:11.062 Style: "Lite"
<W>2020-02-05 08:34:11.063 --> qss: ":themes/Mumble/Lite.qss"
<W>2020-02-05 08:34:11.067 Locale is "es_EC" (System: "es_EC")
<W>2020-02-05 08:34:11.109 Database SQLite: "3.11.0"
<W>2020-02-05 08:34:11.115 Overlay: Removing old socket on "/run/user/1000/MumbleOverlayPipe"
<W>2020-02-05 08:34:11.115 Overlay: Listening on "/run/user/1000/MumbleOverlayPipe"
<W>2020-02-05 08:34:11.141 Updating application palette
<W>2020-02-05 08:34:11.177 GlobalShortcutX: Using XI2 2.3
<W>2020-02-05 08:34:11.337 SocketRPC: Removing old socket on "/run/user/1000/MumbleSocket"
<W>2020-02-05 08:34:11.350 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 08:34:11.350 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 08:34:11.350 PulseAudio: Starting input vchan_input
<W>2020-02-05 08:34:11.353 PulseAudio: Starting output: vchan_output
<W>2020-02-05 08:34:11.355 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 08:34:11.382 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 08:34:11.382 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 08:34:11.382 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 08:34:11.382 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 08:34:11.383 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 08:34:18.805 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 08:34:18.805 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 08:34:18.811 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 08:34:18.816 QSslSocket: cannot call unresolved function SSLv23_client_method
<W>2020-02-05 08:34:18.816 QSslSocket: cannot call unresolved function sk_num
The application (or it's libraries) caught a Segmentation Fault. Backtrace follows:
Backtrace: /tmp/.mount_Mumblez60Klu/usr/bin/../lib/libg15daemon_client.so.1(+0xe2e) [0x76272277fe2e]
Backtrace: /lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0) [0x76271f8eb0e0]
Backtrace: /tmp/.mount_Mumblez60Klu/usr/bin/../lib/libQt5Network.so.5(+0xf23db) [0x762722ec73db]
Backtrace: /tmp/.mount_Mumblez60Klu/usr/bin/../lib/libQt5Network.so.5(+0xf3247) [0x762722ec8247]
Backtrace: /tmp/.mount_Mumblez60Klu/usr/bin/../lib/libQt5Network.so.5(+0xf56b3) [0x762722eca6b3]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x5a58c8]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x457ed6]
Backtrace: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x76271ecbe2e1]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x45b259]
End of Backtrace.
<W>2020-02-05 08:34:18.825 QSslSocket: cannot call unresolved function CRYPTO_num_locks
<W>2020-02-05 08:34:18.825 QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
<W>2020-02-05 08:34:18.825 QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
<W>2020-02-05 08:34:18.825 QSslSocket: cannot call unresolved function ERR_free_strings

Thanks so much for your time!

Krzmbrzl commented 4 years ago

Googling the error message pointed me to https://github.com/amra/DocumentationAsCode/issues/2 and there it is suggested that libssl1.0-dev has to be installed to get the respective symbol definitions back again...

rafaelbonifaz commented 4 years ago

Installing libssl1.0-dev fixes the issue in Debian 9. There is no libssl1.0-dev in Debian 10, but I installed libssl-dev I get different error:


./Mumble-ce40787c-x86_64.AppImage 
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
<W>2020-02-05 09:17:58.443 ALSAInit: No cards found, not initializing
<W>2020-02-05 09:17:58.443 G15LCDEngineUnix: Unable to connect to G15Daemon.
<D>2020-02-05 09:17:58.448 libopus 1.2.1 from libopus.so.0
<W>2020-02-05 09:17:58.450 CELT bitstream 8000000b from libcelt0.so.0.7.0
<W>2020-02-05 09:17:58.462 Theme: "Mumble"
<W>2020-02-05 09:17:58.462 Style: "Lite"
<W>2020-02-05 09:17:58.462 --> qss: ":themes/Mumble/Lite.qss"
<W>2020-02-05 09:17:58.467 Locale is "es_EC" (System: "es_EC")
<W>2020-02-05 09:17:58.525 Database SQLite: "3.11.0"
<W>2020-02-05 09:17:58.531 Overlay: Listening on "/run/user/1000/MumbleOverlayPipe"
<W>2020-02-05 09:17:58.558 Updating application palette
<W>2020-02-05 09:17:58.593 GlobalShortcutX: Using XI2 2.3
<W>2020-02-05 09:17:58.793 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 09:17:58.793 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 09:17:58.793 PulseAudio: Starting input vchan_input
<W>2020-02-05 09:17:58.797 PulseAudio: Starting output: vchan_output
<W>2020-02-05 09:17:58.800 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 09:17:58.827 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 09:17:58.827 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 09:17:58.827 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 09:17:58.827 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 09:17:58.854 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 09:18:05.816 AudioInput: Opus encoder set for high quality speech
<W>2020-02-05 09:18:05.816 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-05 09:18:05.821 QSslSocket: cannot call unresolved function SSLv23_client_method
<W>2020-02-05 09:18:05.822 AudioOutput: Initialized 2 channel 44100 hz mixer
<W>2020-02-05 09:18:05.823 QSslSocket: cannot call unresolved function sk_num
<W>2020-02-05 09:18:05.828 unsupported date format detected
The application (or it's libraries) caught a Segmentation Fault. Backtrace follows:
Backtrace: /tmp/.mount_MumbleqOJX6Y/usr/bin/../lib/libg15daemon_client.so.1(+0xe2e) [0x762d64c0fe2e]
Backtrace: /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730) [0x762d621b1730]
Backtrace: /tmp/.mount_MumbleqOJX6Y/usr/bin/../lib/libQt5Network.so.5(+0x101284) [0x762d628de284]
Backtrace: /tmp/.mount_MumbleqOJX6Y/usr/bin/../lib/libQt5Network.so.5(+0xf240a) [0x762d628cf40a]
Backtrace: /tmp/.mount_MumbleqOJX6Y/usr/bin/../lib/libQt5Network.so.5(+0xf3247) [0x762d628d0247]
Backtrace: /tmp/.mount_MumbleqOJX6Y/usr/bin/../lib/libQt5Network.so.5(+0xf56b3) [0x762d628d26b3]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x5a58c8]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x457ed6]
Backtrace: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x762d61cdf09b]
Backtrace: ./Mumble-ce40787c-x86_64.AppImage() [0x45b259]
End of Backtrace.
<W>2020-02-05 09:18:05.849 QSslSocket: cannot call unresolved function CRYPTO_num_locks
<W>2020-02-05 09:18:05.849 QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
<W>2020-02-05 09:18:05.849 QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
<W>2020-02-05 09:18:05.849 QSslSocket: cannot call unresolved function ERR_free_strings

My understanding is that the libssl-dev should be installed in the Appimage so the users won't have to installed anything extra in their system. Just download, give permissions and run.

I would try Fedora 30 later.

Krzmbrzl commented 4 years ago

Yeah to my understanding an AppImage should contain everything it needs so it can run on any system no matter what's installed on it...

@probonopd do you have an idea why these SSL things don't seem to be included in the AppImage?

probonopd commented 4 years ago

SSL things are probably assumed by the author of this AppImage to be part of every target system (distribution) and are hence not bundled inside every AppImage.

Maybe we need to change this policy as long as OpenSSL breaks in ABI incompatible ways despite keeping the same MAJOR version number.

Personally, I expect any application built against version 1.x.x of a library to be able to run with subsequent versions 1.y.z of the same library. Apparently OpenSSL has not been working this way, at least until now.

Reference: https://github.com/openssl/openssl/issues/5042

Krzmbrzl commented 4 years ago

Aha. Didn't even know that was possible with AppImages ^^

Well in my opinion we should bundle everything into the AppImage to really make it independent of the target system (as long as it's Linux of course). @davidebeatrici what are your thoughts on this?

The question is, how'd we go about including things like OpenSSL? :thinking:

davidebeatrici commented 4 years ago

Ideally we should bundle everything, yes. Hopefully we don't end up with way bigger AppImage files.

@probonopd What should be done in order to achieve that?

probonopd commented 4 years ago

Well in my opinion we should bundle everything into the AppImage to really make it independent of the target system (as long as it's Linux of course).

The downside of this is that the AppImage will be larger (from my experience in the range 5 MB to 10 MB), will not honor system styles, and may have difficulties interacting with things like OpenGL drivers and possibly Jack. I am working on an experimental tool that can bundle everything. It is not trivial since e.g., glibc requires some on-the-fly patching and needs additional files to be bundled alongside it.

Let me know if I should give it a try.

davidebeatrici commented 4 years ago

The downside of this is that the AppImage will be larger (from my experience in the range 5 MB to 10 MB)

Our AppImage file currently weights 34 MB, in my opinion a size of ~50 MB is completely fine.

will not honor system styles

Aren't the styles handled by Qt at runtime?

and may have difficulties interacting with things like OpenGL drivers

In our case it shouldn't be an issue, since we don't directly make use of OpenGL. The overlay uses the functions from the target process.

and possibly Jack.

Probably not, we now load the library at runtime.

Let me know if I should give it a try.

That would be great, thank you!

probonopd commented 4 years ago

For testing purposes, I have made an experimental Mumble 1.3.0 AppImage based on the Mumble package in Alpine Linux using musl libc. The toolset and process used is still a work in progress and subject to change, so I would be interested in whether you think the result is worthwhile.

https://github.com/probonopd/mumble/releases/download/everything/Mumble-1.3.0-everything-x86_64.AppImage

It is well possible that I am still missing things that need to be bundled or symlinked. Especially I am not sure whether the audio setup is currently working (or what is missing in case it is not).

Comparison

Existing Mumble AppImage Experimental Mumble AppImage
Built on glibc-based system (Ubuntu Xenial; oldest still-supported LTS release from 2016) musl libc based system (Alpine Linux; bleeding edge rolling release from 2020)
Built using linuxdeployqt appimagetool from experimental go-appimage implementation
Can be launched on glibc-based systems that have a glibc version no older than the build system glibc-based systems regardless of glibc version (tested on Ubuntu 14.04, Xubuntu 18.04)
Bundles Dependencies that cannot be expected to come with each distribution by default Complete userland: All dependencies apart from the kernel, including musl libc and the ld-linux loader
Advantages Re-uses core system libraries like glibc (more efficient, at least in theory) Does not rely on any system libraries (more robust, less dependent on the Linux distribution)
Disadvantages Cannot run on systems older than the build system Difficulties to use e.g., OpenGL, JACK, Theming? (to be investigated). Larger (at least in theory)
Size 34 MB 34 MB (interesting!)

Code (to be further simplified)

#############################################
# Download and extract minimal Alpine system
#############################################

FILE=$(wget -q "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/latest-releases.yaml" -O - | grep "file:" | head -n 1 | cut -d " " -f 4)
wget -c "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/$FILE"
mkdir -p ./miniroot
cd ./miniroot
tar xf ../"$FILE"
cd -

#############################################
# Prepare chroot
#############################################

sudo mount -o bind /dev miniroot/dev
sudo mount -t proc none miniroot/proc
sudo mount -t sysfs none miniroot/sys
sudo cp -p /etc/resolv.conf miniroot/etc/
sudo chroot miniroot /bin/sh <<\EOF

#############################################
# Now inside chroot
#############################################

# Get uploadtool, which is needed by the experimental appimagetool from the go-appimage repository
apk add wget squashfs-tools desktop-file-utils curl appstream libc6-compat
wget -c https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh -O uploadtool
chmod +x uploadtool 
export PATH=$(readlink -f .):$PATH

# Build patchelf, which is needed by the experimental appimagetool from the go-appimage repository
apk add alpine-sdk bash util-linux wget autoconf gettext automake
wget https://github.com/NixOS/patchelf/archive/0.9.tar.gz # 0.10 cripples my files
tar xf *.tar.gz 
cd patchelf-*/
./bootstrap.sh
./configure --prefix=/usr
make -j$(nproc)
sudo make install
cd -

# Turn Alpine Mumble package into an AppDir
# alternatively, we could build Mumble ourselves here
apk add mumble alsa-plugins alsa-plugins-pulse
apk fetch mumble
export VERSION=$(ls mumble-*.apk | cut -d - -f 2)
mkdir -p appdir ; cd appdir
tar xfv ../mumble-*.apk 
cd -

# Build experimental appimagetool from the go-appimage repository
export GOPATH=/home/me/go
apk add go squashfs-tools desktop-file-utils
mkdir -p /home/me/go/src/github.com/probonopd/
cd /home/me/go/src/github.com/probonopd/
git clone https://github.com/probonopd/go-appimage
cd -
go get -x  /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/
go build /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/

# Deploy dependencies into the AppDir
/home/me/go/bin/appimagetool -s deploy appdir/usr/share/applications/*.desktop
LD_LIBRARY_PATH='' find appdir -type f -exec ldd {} 2>&1 \; | grep '=>' | grep -v appdir

# Turn AppDir into AppImage
apk add imagemagick
convert -resize 128x128 appdir/usr/share/icons/hicolor/scalable/apps/mumble.svg appdir/mumble.png
wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64
./appimagetool appdir/

#############################################
# Exit chroot and clean up
#############################################

exit
EOF
sudo umount miniroot/proc miniroot/sys miniroot/dev

sudo find . -type f -name 'Mumble*.AppImage' -exec mv {} . \;
ls -lh Mumble-1.3.0-x86_64.AppImage # 34M
rafaelbonifaz commented 4 years ago

@probonopd thanks a lot!!! I made basic testing (open and run), and it works in: Debian 10, Debian 9, Fedora 30, Fedora 31, Ubuntu 18.04, Manjaro (curent) and Linux MX. I would try tomorrow to do some calls to check if everything is working!

probonopd commented 4 years ago

Thanks @rafaelbonifaz. Did you (or anyone else) have a chance to verify functionality, i.e., that it works and not just launches?

rafaelbonifaz commented 4 years ago

Sorry for the delay. We tried in a Manjaro installation. It lunches, but the audio did not work. This is the output on the shell:

./Mumble-1.3.0-everything-x86_64.AppImage
Run experimental self-contained bundle
<W>2020-02-17 17:23:30.242 CodecInit: Failed to load Opus, it will not
be available for encoding/decoding audio.
<W>2020-02-17 17:23:30.244 CELT bitstream 8000000b from libcelt0.so.0.7.0
<W>2020-02-17 17:23:30.245 CELT bitstream 80000010 from
/usr/lib/mumble/libcelt0.so.0.11.0
<W>2020-02-17 17:23:30.249 Theme: "Mumble"
<W>2020-02-17 17:23:30.249 Style: "Lite"
<W>2020-02-17 17:23:30.249 --> qss: ":themes/Mumble/Lite.qss"
<W>2020-02-17 17:23:30.250 Locale is "en_US" (System: "en_US")
<W>2020-02-17 17:23:30.284 TextToSpeech: Compiled without support for
speech-dispatcher
<W>2020-02-17 17:23:30.351 Database SQLite: "3.31.1"
<W>2020-02-17 17:23:30.355 Overlay: Listening on
"/run/user/1000/MumbleOverlayPipe"
<W>2020-02-17 17:23:30.417 Updating application palette
<W>2020-02-17 17:23:30.439 GlobalShortcutX: Using XI2 2.3
libGL error: MESA-LOADER: failed to open i965 (search paths
/usr/lib/xorg/modules/dri)
libGL error: failed to load driver: i965
libGL error: MESA-LOADER: failed to open i965 (search paths
/usr/lib/xorg/modules/dri)
libGL error: failed to load driver: i965
libGL error: MESA-LOADER: failed to open swrast (search paths
/usr/lib/xorg/modules/dri)
libGL error: failed to load driver: swrast
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libcelt0.so.0.7:
Cannot load library /usr/lib/mumble/libcelt0.so.0.7: (Error relocating
/usr/lib/mumble/libcelt0.so.0.7: __fprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libcelt0.so.0.7.0:
Cannot load library /usr/lib/mumble/libcelt0.so.0.7.0: (Error relocating
/usr/lib/mumble/libcelt0.so.0.7.0: __fprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load liblink.so: Cannot
load library /usr/lib/mumble/liblink.so: (Error relocating
/usr/lib/mumble/liblink.so: __snprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libmumble.so: Cannot
load library /usr/lib/mumble/libmumble.so: (Error relocating
/usr/lib/mumble/libmumble.so: __vfprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libmumble.so.1:
Cannot load library /usr/lib/mumble/libmumble.so.1: (Error relocating
/usr/lib/mumble/libmumble.so.1: __vfprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libmumble.so.1.3:
Cannot load library /usr/lib/mumble/libmumble.so.1.3: (Error relocating
/usr/lib/mumble/libmumble.so.1.3: __vfprintf_chk: symbol not found)
<W>2020-02-17 17:23:30.588 Plugins: Failed to load libmumble.so.1.3.0:
Cannot load library /usr/lib/mumble/libmumble.so.1.3.0: (Error
relocating /usr/lib/mumble/libmumble.so.1.3.0: __vfprintf_chk: symbol
not found)
<W>2020-02-17 17:23:30.588 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-02-17 17:23:30.588 ALSAAudioOutput: Initialized
<W>2020-02-17 17:23:30.588 ALSAAudioInput: Initing audiocapture default.
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library
/usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading
shared library libpulse.so.0: No such file or directory (needed by
/usr/lib/alsa-lib/libasound_module_pcm_pulse.so))
<W>2020-02-17 17:23:30.589 ALSAAudio: snd_pcm_open(&capture_handle,
device_name.data(), SND_PCM_STREAM_CAPTURE, 0): No such device or address
<W>2020-02-17 17:23:30.589 ALSAAudioInput: Actual buffer 48000 hz, 1
channel 3840 samples [480 per period]
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library
/usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading
shared library libpulse.so.0: No such file or directory (needed by
/usr/lib/alsa-lib/libasound_module_pcm_pulse.so))
<W>2020-02-17 17:23:30.590 ALSAAudio: snd_pcm_open(&pcm_handle,
device_name.data(), SND_PCM_STREAM_PLAYBACK, 0): No such device or address
<W>2020-02-17 17:23:30.590 ALSAAudioOutput: Actual buffer 48000 hz, 1
channel 2880 samples [480 per period]
<W>2020-02-17 17:23:34.000 Database SQLite: "3.31.1"
<W>2020-02-17 17:23:34.001 OpenSSL Support: 1 (OpenSSL 1.1.1d  10 Sep 2019)
<W>2020-02-17 17:23:34.033 ServerHandler: TLS cipher preference is
"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-SHA:AES128-SHA"

Also I tested in a Debian 10 installation and it did not start. I use QuebOs and it's Virtual Machines do not have all the packages a normal installation does. Here I got the following message


./Mumble-1.3.0-everything-x86_64.AppImage 
Run experimental self-contained bundle
<W>2020-02-18 13:20:53.495 ALSAInit: No cards found, not initializing
<W>2020-02-18 13:20:53.502 CodecInit: Failed to load Opus, it will not be available for encoding/decoding audio.
<W>2020-02-18 13:20:53.505 CELT bitstream 8000000b from libcelt0.so.0.7.0
<W>2020-02-18 13:20:53.509 CELT bitstream 80000010 from libcelt0.so.0.11.0
<W>2020-02-18 13:20:53.514 Theme: "Mumble"
<W>2020-02-18 13:20:53.514 Style: "Lite"
<W>2020-02-18 13:20:53.514 --> qss: ":themes/Mumble/Lite.qss"
<W>2020-02-18 13:20:53.515 Locale is "es_EC" (System: "es_EC")
<W>2020-02-18 13:20:53.532 TextToSpeech: Compiled without support for speech-dispatcher
<W>2020-02-18 13:20:53.565 Database SQLite: "3.31.1"
<W>2020-02-18 13:20:53.568 Overlay: Listening on "/run/user/1000/MumbleOverlayPipe"
<W>2020-02-18 13:20:53.591 Updating application palette
<W>2020-02-18 13:20:53.618 GlobalShortcutX: Using XI2 2.3
MESA-LOADER: failed to open swrast (search paths /usr/lib/xorg/modules/dri)
libGL error: failed to load driver: swrast
<W>2020-02-18 13:20:53.806 Plugins: Failed to load libcelt0.so.0.7.0: Cannot load library /usr/lib/mumble/libcelt0.so.0.7.0: (Error relocating /usr/lib/mumble/libcelt0.so.0.7.0: __fprintf_chk: symbol not found)
<W>2020-02-18 13:20:53.807 Plugins: Failed to load liblink.so: Cannot load library /usr/lib/mumble/liblink.so: (Error relocating /usr/lib/mumble/liblink.so: __snprintf_chk: symbol not found)
Violación de segmento

The last thing it would be really nice is that Mumble app image could work together with torsocks. That is running Mumble this way torsocks mumble and all Mumble traffic would go via the Tor Network. In theory you can also setup the Mumble proxy use socks, but it has never work for me in Linux.

Anyway, when I try to run Mumble AppImage with Tor I get this error. Hopefully you can helps us with this too.

torsocks ./Mumble-1.3.0-everything-x86_64.AppImage 
Run experimental self-contained bundle
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __snprintf_chk: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __fdelt_chk: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __strtok_r: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __strdup: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __strndup: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __memcpy_chk: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __vsnprintf_chk: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __strncpy_chk: symbol not found
Error relocating /usr/lib/x86_64-linux-gnu/torsocks/libtorsocks.so: __fprintf_chk: symbol not found
probonopd commented 4 years ago

Further inspection shows:

We are getting

ALSA lib conf.c:3650:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/usr/lib/alsa-lib/libasound_module_conf_pulse.so: Error loading shared library libasound_module_conf_pulse.so: No such file or directory).

Why? Apparently libasound.so.2 which we are bunding is using dlopen() to load additional libraries:

me@host:~$ strings squashfs-root/usr/lib/libasound.so.2 | grep dlopen
__snd_dlopen
__snd_dlopen_old

me@host:~$ strings squashfs-root/usr/lib/libasound.so.2 | grep /usr
/usr/share/alsa
/usr/lib/alsa-lib
/usr/lib/alsa-lib/smixer
/usr/share/alsa/ucm2
/usr/share/alsa/ucm

It looks like libasound_module_conf_pulse.so normally gets loaded using dlopen, hence it is not caught (yet) by go-appimagetool and is missing in the AppImage.

The approach given by @TheAssassin in https://github.com/probonopd/linuxdeployqt/issues/237 shows:

me@host:~$ strings squashfs-root/usr/lib/libasound.so.2 | grep -oP '^.*\.so[\.\d]*'
%s/libasound_module_ctl_%s.so
%s/libasound_module_pcm_%s.so
%s/libasound_module_rate_%s.so
libasound.so.2.0.0.
libc.musl-x86_64.so.1
libasound.so.2

Note that libasound_module_conf_pulse.so is not in there. https://github.com/mmtrt/Wine_Appimage/blob/master/deployscript/bionic-wine-staging-lol-deploy.sh has

# Sound Library
export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/pulseaudio":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HERE/usr/lib/i386-linux-gnu/alsa-lib":$LD_LIBRARY_PATH

So, would it be the right thing to do to deploy (bundle) the alsa-lib subdirectory whenever we encounter libasound.so.*?

What about the share/alsa subdirectory? libasound.so.* refers to it as well.

What about the the pulseaudio subdirectory?

Would it be the right thing to do to deploy (bundle) the pulseaudio subdirectory whenever we encounter libpulse.so.*?

What about the /usr/lib/pulse-* directory?

probonopd commented 4 years ago

Currently I am stuck at libasound_module_conf_pulse.so trying to be loaded from a fixed absolute path at /usr/lib/alsa-lib/ (even if I bundle it locally inside the AppImage) which I don't know how to override (e.g., by setting an environment variable) at runtime.

Does anyone know how to achieve this?

Is ALSA_PLUGIN_DIR working in ALSA by default?

Would https://github.com/flatpak/freedesktop-sdk-images/blob/1.6/alsa-lib-plugin-path.patch need to be applied for this to work?

Krzmbrzl commented 4 years ago

Now that sounds like a dendency-hell xD

I just thought whether we might have a better time if we were to try and compile everything statically into our executable for creating the AppImage... Do you think that'd be easier? :thinking:

probonopd commented 4 years ago

Worth a try, but I will need to solve this maze for other apps anyway...

Krzmbrzl commented 4 years ago

Does anyone know how to achieve this?

I assume you have tried modifying LD_LIBRARY_PATH?

I will need to solve this maze for other apps anyway...

Alright then let's get this figured out, :)

probonopd commented 4 years ago

I assume you have tried modifying LD_LIBRARY_PATH?

Yes... I'm assuming they are dlopen()ed and that does not respect LD_LIBRARY_PATH when an absolute path is fed to it.

Krzmbrzl commented 4 years ago

https://stackoverflow.com/a/17716576/3907364 mentions some tags that can be part of the calling executable which influence the way dlopen searches... :thinking:

probonopd commented 4 years ago

Thanks for the hint @Krzmbrzl, so if we could get it to dlopen() libasound_module_conf_pulse.so instead of /usr/lib/alsa-lib/libasound_module_conf_pulse.so it might work. But how to do this?

I did not find out yet where alsa gets this /usr/lib/ from. Can you figure it out from its source code?

Krzmbrzl commented 4 years ago

But how to do this?

According to the answer on SO I posted above, it should work by a) setting DT_RPATH or DT_RUNPATH for the alsa executable. Though I think this is not something that can be attached afterwards b) Seting the LD_LIBRARY_PATH variable. You said you already tried that one. Did you actually check the value of this variable at runtime from within the program? It may be that you only thought you have set it but didn't (for some reason).

I did not find out yet where alsa gets this /usr/lib/ from.

That's the default behaviour of dlopen. It's also part of the linked SO answer: dlopen looks for either of abovementioned variables and if this doesn't succeed, it checks /etc/ld.so.cache and if that doesn't result in a match, it searches /lib and after that /usr/lib

probonopd commented 4 years ago

It says

If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname. Otherwise, the dynamic linker searches for the library as follows (see ld.so(8) for further details):

I belive that is what we are running into. Investigating right now.

Running the AppImage gives:

me@host:~$ ./miniroot/Mumble-1.3.0-x86_64.AppImage 
Run experimental self-contained bundle
(...)
<W>2020-03-07 14:47:32.420 AudioInput: 40000 bits/s, 48000 hz, 480 sample
<W>2020-03-07 14:47:32.420 ALSAAudioOutput: Initialized
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: No such file or directory)
<W>2020-03-07 14:47:32.424 ALSAAudio: snd_pcm_open(&pcm_handle, device_name.data(), SND_PCM_STREAM_PLAYBACK, 0): No such device or address
<W>2020-03-07 14:47:32.424 ALSAAudioOutput: Actual buffer 48000 hz, 1 channel 2880 samples [480 per period]
<W>2020-03-07 14:47:32.424 ALSAAudioInput: Initing audiocapture default.
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: No such file or directory)
<W>2020-03-07 14:47:32.424 ALSAAudio: snd_pcm_open(&capture_handle, device_name.data(), SND_PCM_STREAM_CAPTURE, 0): No such device or address
(...)

So what is actually tried to be loaded?

As per strace, only one place is even tried for libasound_module_pcm_pulse (unlike the other libraries which are tried to be opened from various locations including the one libasound_module_pcm_pulse is residing in):

strace -f ./miniroot/appdir/AppRun 2>&1 | grep alsa-lib
(...)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/opus.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libcelt0.so.0.7.0.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libcelt0.so.0.11.0.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libXcursor.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libXcursor.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15546] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libXcursor", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15569] open("/usr/lib/alsa-lib/libasound_module_conf_pulse.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 15569] access("/usr/lib/alsa-lib/libasound_module_conf_pulse.so", X_OK) = -1 ENOENT (No such file or directory)
[pid 15569] open("/usr/lib/alsa-lib/libasound_module_pcm_pulse.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15569] writev(2, [{iov_base="Cannot open shared library /usr/"..., iov_len=76}, {iov_base="(null): Error loading shared lib"..., iov_len=111}], 2Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: No such file or directory) = 187
[pid 15570] open("/usr/lib/alsa-lib/libasound_module_pcm_pulse.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 15570] writev(2, [{iov_base="Cannot open shared library /usr/"..., iov_len=76}, {iov_base="(null): Error loading shared lib"..., iov_len=111}], 2Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: No such file or directory) = 187
[pid 15573] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libresolv.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 15573] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/libresolv", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 15573] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/resolv.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 15573] open("/home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/resolv", O_RDONLY|O_CLOEXEC <unfinished ...>
(...)

We can see that other libraries are being searched in /home/me/miniroot/appdir/usr/bin/../lib/alsa-lib/ but not libasound_module_pcm_pulse. Why?

Unfortunately there is no LD_DEBUG=libs in musl, so I don't know how to find out why it is not trying to load the library from all the places in rpath/runpath/LD_LIBRARY_PATH...

That's the default behaviour of dlopen. It's also part of the linked SO answer: dlopen looks for either of abovementioned variables and if this doesn't succeed, it checks /etc/ld.so.cache and if that doesn't result in a match, it searches /lib and after that /usr/lib

If that were the case, then we should see libasound_module_pcm_pulse being searched in various locations before being searched in /usr/lib, which is not what we are seeing. Hence I am assuming that the /usr/lib/ path is being passed to dlopen() by some ALSA code.

probonopd commented 4 years ago

libasound.so.2 has absolute /usr paths compiled in like this:

me@host:~$ strings ./miniroot/appdir/usr/lib/libasound.so.2 | grep usr
/usr/share/alsa
/usr/lib/alsa-lib
/usr/lib/alsa-lib/smixer
/usr/share/alsa/ucm2
/usr/share/alsa/ucm

Maybe we also need to bundle the whole /usr/share/alsa? But then, how to tell ALSA to load it from our private location? I guess that Flatpak must have solved this somehow?

Here is a similar question: https://gitter.im/ubuntu/snappy-playpen/archives/2016/07/17?at=578b46eb9f79ee4f2bcc61e7

Krzmbrzl commented 4 years ago

Okay now I see why you are confused - I don't get what's going on either.

I think that if this path is really hard-coded into the library and these strings aren't hints only, then we don't have a chance of convincing alsa to load the bundled libraries...

I guess at this point it might be best, if we were to create an issue in the alsa GitHub project and ask them if and how something like this is possible :thinking:

probonopd commented 4 years ago

Exporting ALSA_CONFIG_DIR seems to have no effect when trying to change /usr/share/alsa to a private location.

However, setting ALSA_CONFIG_PATH can be used to point to (the absolute path of) an alsa.conf file.

probonopd commented 4 years ago

The troublesome line seems to be

https://github.com/alsa-project/alsa-lib/blob/ed156a218644e3334bc452ef2bc948409735c330/src/dlmisc.c#L283

This looks intriguing, "Handle the plugin dir not being on the default dlopen search path", can you make sense of

https://github.com/alsa-project/alsa-lib/blob/ed156a218644e3334bc452ef2bc948409735c330/src/dlmisc.c#L75-L110

I guess we want to use "the default dlopen search path" and this code prevents it? Possibly this is caused by

https://github.com/alsa-project/alsa-lib/commit/b906db19ef9f4fb7886003072e550391cc1ac651

Which says

The Ubuntu package currently uses ld.so.conf.d fragments to add /usr/lib/alsa-lib and /usr/lib{32,64}/alsa-lib to the dlopen search path. These don't belong on the global search path, and it becomes much more problematic to put them there with the advent of multiarch because each architecture then needs its own distinct config file to add the separate path... which is then also put in the global library namespace. Instead, let ALSA make use of the already defined ALSA_PLUGIN_DIR to look up plugins.

Wouldn't the right thing to do be to:

cc @perexg @vorlonofportland @tiwai (TL;DR: We want to bundle a private copy of ALSA with our application, so that the ALSA from the Linux distribution is not used at all. Yet it seems ALSA is relying on some absolute paths compiled in with no clear way to pass in a different location for ALSA at runtime. How to do this?)

probonopd commented 4 years ago

We are getting somewhere:

sudo sed -i -e 's|/usr/lib/alsa|\x00usr/lib/alsa|g' ./miniroot/appdir/usr/lib/libasound.so.2

results now in

ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library /libasound_module_pcm_pulse.so ((null): Error loading shared library /libasound_module_pcm_pulse.so: No such file or directory)
<W>2020-03-07 15:58:34.350 ALSAAudio: snd_pcm_open(&pcm_handle, device_name.data(), SND_PCM_STREAM_PLAYBACK, 0): No such device or address
<W>2020-03-07 15:58:34.353 ALSAAudioOutput: Actual buffer 48000 hz, 1 channel 2880 samples [480 per period]
<W>2020-03-07 15:58:34.353 ALSAAudioInput: Initing audiocapture default.
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library /libasound_module_pcm_pulse.so ((null): Error loading shared library /libasound_module_pcm_pulse.so: No such file or directory)
<W>2020-03-07 15:58:34.353 ALSAAudio: snd_pcm_open(&capture_handle, device_name.data(), SND_PCM_STREAM_CAPTURE, 0): No such device or address

I am almost sure that if we could get rid of the extra / then it would work... and I suspect this extra / is caused by

https://github.com/alsa-project/alsa-lib/blob/ed156a218644e3334bc452ef2bc948409735c330/src/dlmisc.c#L88

Krzmbrzl commented 4 years ago

You could do sudo sed -i -e 's|/usr/lib/alsa|.\x00sr/lib/alsa|g' ./

Then the resulting path should be

./alsa...

And thus it should search in the current directory as this is now a relative path. Then we inky have to make sure that we put the library in the correct spot in the current dir :point_up:

probonopd commented 4 years ago

Great idea, but somehow I could not made that to work...

Krzmbrzl commented 4 years ago

What does the error message say? Or didn't it even start?

EDIT: You did notice that I intentionally left out the u from usr in order to not change the string's size right?

probonopd commented 4 years ago

It said it can't find the file there.

not change the string's size

Sure, otherwise it would crash immediately.

probonopd commented 4 years ago

The patch described in https://github.com/alsa-project/alsa-lib/issues/34 has been committed to ALSA master, which means that there is now a ALSA_PLUGIN_DIR variable that is used instead of a hardcoded path to the ALSA plugins.

davidebeatrici commented 4 years ago

Awesome!

huizichin commented 4 years ago

~/Downloads/AppImage$ ./Mumble-3eaee7c6-x86_64.AppImage qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings qt.network.ssl: QSslSocket: cannot resolve sk_new_null qt.network.ssl: QSslSocket: cannot resolve sk_push qt.network.ssl: QSslSocket: cannot resolve sk_free qt.network.ssl: QSslSocket: cannot resolve sk_num qt.network.ssl: QSslSocket: cannot resolve sk_pop_free qt.network.ssl: QSslSocket: cannot resolve sk_value qt.network.ssl: QSslSocket: cannot resolve SSL_library_init qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf qt.network.ssl: QSslSocket: cannot resolve SSLeay qt.network.ssl: QSslSocket: cannot resolve SSLeay_version qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init

2020-07-01 15:04:52.772 QSslSocket: cannot call unresolved function SSLv23_client_method 2020-07-01 15:04:52.772 QSslSocket: cannot call unresolved function sk_num Segmentation fault (core dumped) Appimage does not work
llsjk commented 2 years ago

For testing purposes, I have made an experimental Mumble 1.3.0 AppImage based on the Mumble package in Alpine Linux using musl libc. The toolset and process used is still a work in progress and subject to change, so I would be interested in whether you think the result is worthwhile.

https://github.com/probonopd/mumble/releases/download/everything/Mumble-1.3.0-everything-x86_64.AppImage

It is well possible that I am still missing things that need to be bundled or symlinked. Especially I am not sure whether the audio setup is currently working (or what is missing in case it is not).

Comparison Existing Mumble AppImage Experimental Mumble AppImage Built on glibc-based system (Ubuntu Xenial; oldest still-supported LTS release from 2016) musl libc based system (Alpine Linux; bleeding edge rolling release from 2020) Built using linuxdeployqt appimagetool from experimental go-appimage implementation Can be launched on glibc-based systems that have a glibc version no older than the build system glibc-based systems regardless of glibc version (tested on Ubuntu 14.04, Xubuntu 18.04) Bundles Dependencies that cannot be expected to come with each distribution by default Complete userland: All dependencies apart from the kernel, including musl libc and the ld-linux loader Advantages Re-uses core system libraries like glibc (more efficient, at least in theory) Does not rely on any system libraries (more robust, less dependent on the Linux distribution) Disadvantages Cannot run on systems older than the build system Difficulties to use e.g., OpenGL, JACK, Theming? (to be investigated). Larger (at least in theory) Size 34 MB 34 MB (interesting!)

Code (to be further simplified)

#############################################
# Download and extract minimal Alpine system
#############################################

FILE=$(wget -q "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/latest-releases.yaml" -O - | grep "file:" | head -n 1 | cut -d " " -f 4)
wget -c "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/$FILE"
mkdir -p ./miniroot
cd ./miniroot
tar xf ../"$FILE"
cd -

#############################################
# Prepare chroot
#############################################

sudo mount -o bind /dev miniroot/dev
sudo mount -t proc none miniroot/proc
sudo mount -t sysfs none miniroot/sys
sudo cp -p /etc/resolv.conf miniroot/etc/
sudo chroot miniroot /bin/sh <<\EOF

#############################################
# Now inside chroot
#############################################

# Get uploadtool, which is needed by the experimental appimagetool from the go-appimage repository
apk add wget squashfs-tools desktop-file-utils curl appstream libc6-compat
wget -c https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh -O uploadtool
chmod +x uploadtool 
export PATH=$(readlink -f .):$PATH

# Build patchelf, which is needed by the experimental appimagetool from the go-appimage repository
apk add alpine-sdk bash util-linux wget autoconf gettext automake
wget https://github.com/NixOS/patchelf/archive/0.9.tar.gz # 0.10 cripples my files
tar xf *.tar.gz 
cd patchelf-*/
./bootstrap.sh
./configure --prefix=/usr
make -j$(nproc)
sudo make install
cd -

# Turn Alpine Mumble package into an AppDir
# alternatively, we could build Mumble ourselves here
apk add mumble alsa-plugins alsa-plugins-pulse
apk fetch mumble
export VERSION=$(ls mumble-*.apk | cut -d - -f 2)
mkdir -p appdir ; cd appdir
tar xfv ../mumble-*.apk 
cd -

# Build experimental appimagetool from the go-appimage repository
export GOPATH=/home/me/go
apk add go squashfs-tools desktop-file-utils
mkdir -p /home/me/go/src/github.com/probonopd/
cd /home/me/go/src/github.com/probonopd/
git clone https://github.com/probonopd/go-appimage
cd -
go get -x  /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/
go build /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/

# Deploy dependencies into the AppDir
/home/me/go/bin/appimagetool -s deploy appdir/usr/share/applications/*.desktop
LD_LIBRARY_PATH='' find appdir -type f -exec ldd {} 2>&1 \; | grep '=>' | grep -v appdir

# Turn AppDir into AppImage
apk add imagemagick
convert -resize 128x128 appdir/usr/share/icons/hicolor/scalable/apps/mumble.svg appdir/mumble.png
wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64
./appimagetool appdir/

#############################################
# Exit chroot and clean up
#############################################

exit
EOF
sudo umount miniroot/proc miniroot/sys miniroot/dev

sudo find . -type f -name 'Mumble*.AppImage' -exec mv {} . \;
ls -lh Mumble-1.3.0-x86_64.AppImage # 34M

Maybe a stupid question, but why do I get: `2022-02-23 12:55:59 (5.27 MB/s) - 'runtime-x86_64' saved [189632/189632]

/bin/sh: ./appimagetool: not found`

probonopd commented 2 years ago

Do you have appimagetool in your current working directory? go build /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/ should have built it.

llsjk commented 2 years ago

Do you have appimagetool in your current working directory? go build /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/ should have built it.

I will check and come back to you. So it must be built by the script?

llsjk commented 2 years ago

The contents of the directory: miniroot/home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool is:

-rw-r--r-- 1 root root 53165 Feb 23 14:55 appdirtool.go
-rw-r--r-- 1 root root 25828 Feb 23 14:55 appimagetool.go
-rw-r--r-- 1 root root   270 Feb 23 14:55 appimagetool_test.go
-rw-r--r-- 1 root root  9168 Feb 23 14:55 cli.go
-rw-r--r-- 1 root root  1414 Feb 23 14:55 exclude.go
-rw-r--r-- 1 root root  1775 Feb 23 14:55 genexclude.go
-rw-r--r-- 1 root root  1893 Feb 23 14:55 README.md
-rw-r--r-- 1 root root 11724 Feb 23 14:55 setupsigning.go
probonopd commented 2 years ago

This is the source code, you need to run the compiled appimagetool.

llsjk commented 2 years ago

This is the source code, you need to run the compiled appimagetool.

So I can build it with go build /home/me/go/src/github.com/probonopd/go-appimage/src/appimagetool/?

Krzmbrzl commented 1 year ago

Given that we no longer build or provide an AppImage, I think this can be closed.