Skip to content
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

Anydesk arm64 #2455

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,20 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n

[ -f "$package" ] || error "install_packages(): Local package does not exist! ($package)"

#determine the package name from the filename
packagename="$(dpkg-deb -I "$package" | grep "^ Package:" | awk '{print $2}')"
packageversion="$(dpkg-deb -I "$package" | grep "^ Version:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$package'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$package'"
#determine the package name, package version, and architecture from the file
local dpkg_deb_output="$(dpkg-deb -I "$filename")"
local packagename="$(echo "$dpkg_deb_output" | grep "^ Package:" | awk '{print $2}')"
local packageversion="$(echo "$dpkg_deb_output" | grep "^ Version:" | awk '{print $2}')"
local packagearch="$(echo "$dpkg_deb_output" | grep "^ Architecture:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$filename'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$filename'"
[ -z "$packagearch" ] && error "install_packages(): failed to determine a package-architecture for the file '$filename'"
unset dpkg_deb_output

#foreign arch: add :armhf or :arm64 to the packagename if this local package is of a foreign architecture
if [ "$packagearch" != "$(dpkg --print-architecture)" ];then
packagename+=":$packagearch"
fi

#add this local package to the pi-apps-local-packages repository
repo_add "$package" || return 1
Expand All @@ -429,11 +438,20 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n

wget -O "$filename" "$package" || return 1

#determine the package name from the filename
packagename="$(dpkg-deb -I "$filename" | grep "^ Package:" | awk '{print $2}')"
packageversion="$(dpkg-deb -I "$filename" | grep "^ Version:" | awk '{print $2}')"
#determine the package name, package version, and architecture from the file
local dpkg_deb_output="$(dpkg-deb -I "$filename")"
local packagename="$(echo "$dpkg_deb_output" | grep "^ Package:" | awk '{print $2}')"
local packageversion="$(echo "$dpkg_deb_output" | grep "^ Version:" | awk '{print $2}')"
local packagearch="$(echo "$dpkg_deb_output" | grep "^ Architecture:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$filename'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$filename'"
[ -z "$packagearch" ] && error "install_packages(): failed to determine a package-architecture for the file '$filename'"
unset dpkg_deb_output

#foreign arch: add :armhf or :arm64 to the packagename if this local package is of a foreign architecture
if [ "$packagearch" != "$(dpkg --print-architecture)" ];then
packagename+=":$packagearch"
fi

#add this local package to the pi-apps-local-packages repository
repo_add "$filename" || return 1
Expand Down
42 changes: 42 additions & 0 deletions apps/AnyDesk/install-64
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

version=6.3.0-1

function check-armhf() {
ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}

#add armhf architecture (multiarch)
check-armhf
if [[ "$ARMHF" == *"armhf"* ]]; then
echo "armhf arcitecture already added..."
else
sudo dpkg --add-architecture armhf
check-armhf
if [[ "$ARMHF" != *"armhf"* ]]; then
error "armhf architecture should be added by now, but it isn't!"
fi
fi

unset rpi_arm_userspace
# only install the libraspberrypi0 arm32 package if the user already has the libraspberrypi0 arm64 package installed
if package_installed libraspberrypi0 ; then
rpi_arm_userspace="libraspberrypi0:armhf"
fi
Botspot marked this conversation as resolved.
Show resolved Hide resolved

install_packages https://download.anydesk.com/rpi/anydesk_${version}_armhf.deb libgles-dev:armhf libegl-dev:armhf libpolkit-gobject-1-0:armhf $rpi_arm_userspace patchelf || exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likely unnecessary dependencies
development libraries are nearly never required for a package
control file for anydesk already pulls in egl and glvnd libraries which pull in everything else needed

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the libs installed by libraspberrypi0:armhf:

/usr/lib/arm-linux-gnueabihf/libbcm_host.so.0
/usr/lib/arm-linux-gnueabihf/libdebug_sym.so.0
/usr/lib/arm-linux-gnueabihf/libdtovl.so.0
/usr/lib/arm-linux-gnueabihf/libvchiq_arm.so.0
/usr/lib/arm-linux-gnueabihf/libvcos.so.0

I am not sure that the default deps pull those in, at least for armhf

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am referring to libgles-dev:armhf libegl-dev:armhf

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without those 2 installed, and then reinstalling the anydesk package and allowing it to pull in deps:

$ anydesk
anydesk: error while loading shared libraries: libGLESv2.so: cannot open shared object file: No such file or directory

Copy link
Owner Author

@Botspot Botspot Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I get it. AnyDesk should be able to use libGLESv2.so.2 provided by libgles2, instead of specifically needing libGLESv2.so that is only provided by the -dev package.
Looks like this can be fixed with more elf patching.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... odd

/usr/lib/arm-linux-gnueabihf/libGLESv2.so	[libgles-dev](https://packages.debian.org/bookworm/libgles-dev) [armhf]

its not normal that a package uses this library.

those dependencies need to stay then

Copy link
Collaborator

@theofficialgman theofficialgman Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Botspot you missed my response ^
you need to revert those -dev changes from 9b0ce0a . they are needed. I checked as seen in the above comment

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is patching the elf to use the non-dev libs not sufficient?


#make anydesk search armhf libs first
sudo patchelf --set-rpath /usr/lib/arm-linux-gnueabihf /usr/bin/anydesk

#libraspberrypi0:armhf provides libs with so.0, but it is not multiarch compatible
#so patch anydesk to use equivalent .so libs from libraspberrypi-dev:armhf

sudo patchelf --replace-needed libbcm_host.so libbcm_host.so.0 /usr/bin/anydesk
sudo patchelf --replace-needed libvcos.so libvcos.so.0 /usr/bin/anydesk
sudo patchelf --replace-needed libvchiq_arm.so libvchiq_arm.so.0 /usr/bin/anydesk

# Solve error: "anydesk: error while loading shared libraries: libbrcmGLESv2.so: cannot open shared object file: No such file or directory"

sudo patchelf --replace-needed libbrcmGLESv2.so libGLESv2.so /usr/bin/anydesk
sudo patchelf --replace-needed libbrcmEGL.so libEGL.so /usr/bin/anydesk
14 changes: 14 additions & 0 deletions apps/AnyDesk/uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

purge_packages || exit 1

if [ "$arch" == 64 ];then
# remove armhf architecture if no packages from it are currently installed
apt list --installed | awk '$3 == "armhf" { print }' | grep -q installed || sudo dpkg --remove-architecture armhf

#unlink libs
IFS=' '
for i in /usr/lib/arm-linux-gnueabihf/libbcm_host.so /usr/lib/arm-linux-gnueabihf/libvcos.so /usr/lib/arm-linux-gnueabihf/libvchiq_arm.so /usr/lib/arm-linux-gnueabihf/libbrcmGLESv2.so /usr/lib/arm-linux-gnueabihf/libbrcmEGL.so ;do
if [ -L $i ];then
sudo rm -f $i
fi
done

fi

#remove symlinked libraries
if [ -L /usr/lib/libbrcmGLESv2.so ];then
sudo rm -f /usr/lib/libbrcmGLESv2.so
Expand Down
Loading