ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 152 forks source link

arm64 build #398

Closed benthetechguy closed 1 year ago

benthetechguy commented 1 year ago

Expected Behavior

Builds on arm64

Current Behavior

Fails to build on arm64, vcpkg seems to be trying to build abseil for x64

Steps to Reproduce

  1. Install Debian on arm64
  2. Install dependencies (sudo apt install build-essential golang libglvnd-dev libsecret-1-dev libicu-dev libopengl-dev zip pkg-config cmake ninja-build qt6-declarative-dev qt6-svg-dev qt6-wayland-dev)
  3. Run make build

Version Information

Current master

Build Log

Full log attached, important part here:

Elapsed time to handle abseil:arm64-linux: 18.74 s
Installing 4/20 abseil:x64-linux...
Building abseil[core]:x64-linux...
-- Downloading https://github.com/abseil/abseil-cpp/archive/215105818dfde3174fe799600bb0f3cae233d0bf.tar.gz -> abseil-abseil-cpp-215105818dfde3174fe799600bb0f3cae233d0bf.tar.gz...
-- Extracting source /home/ben/proton-bridge/extern/vcpkg/downloads/abseil-abseil-cpp-215105818dfde3174fe799600bb0f3cae233d0bf.tar.gz
-- Applying patch fix-cxx-standard.patch
-- Using source at /home/ben/proton-bridge/extern/vcpkg/buildtrees/abseil/src/cae233d0bf-0b16e4be7c.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:129 (message):
    Command failed: /usr/bin/cmake --build . --config Debug --target install -- -v -j9
    Working Directory: /home/ben/proton-bridge/extern/vcpkg/buildtrees/abseil/x64-linux-dbg
    See logs for more information:
      /home/ben/proton-bridge/extern/vcpkg/buildtrees/abseil/install-x64-linux-dbg-out.log

Call Stack (most recent call first):
  installed/arm64-linux/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/arm64-linux/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/abseil/portfile.cmake:31 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

error: building abseil:x64-linux failed with: BUILD_FAILED

build.log install-x64-linux-dbg-out.log

benthetechguy commented 1 year ago

Here's probably the issue: https://github.com/ProtonMail/proton-bridge/blob/73bb0ed03e043428759df10678ef734a132e3d51/internal/frontend/bridge-gui/bridge-gui/build.sh#L74-L85

As far as this script is concerned, ARM only exists on macOS.

If I simply replace x64 with arm64 in that line, I get this error: Error: sentry-native[core] is only supported on 'osx | (!arm & !uwp)'. Thanks, Microsoft.

benthetechguy commented 1 year ago

If I edit the sentry-native package file in vcpkg to remove this arbitrary restriction, in addition to changing x64 to arm64 in build.sh, it seems to build fine until the end where I run into the same problems as #346.

Thus, if I can get vcpkg upstream to remove that restriction, it looks like all that's left to solve the ARM-specific part of this is to fix your logic in build.sh to properly support architectures other than x86 on platforms other than just macOS.

TheFranconianCoder commented 1 year ago

Just a week ago I was able to build in a chroot on a Raspberry Pi with a 64bit Raspberry Pi OS (Debian bullseye).

Manually installed Go 1.20.5.

And with apt: apt install build-essential pkgconf libsecret-1-dev git

Then just: make build-nogui

Do you intentionally try to build the GUI variant?

benthetechguy commented 1 year ago

Yes. One should be able to build the full application, not just nogui.

TheFranconianCoder commented 1 year ago

Before I started building for ARM, I was in contact with the support. It's currently the official status, that only "nogui" builds are supported. Answer I got:

At the moment, you should be able to compile Bridge for ARM64, however, without the GUI.

benthetechguy commented 1 year ago

I'm not doubting that. I'm simply pointing out that all you would need to do to upgrade the "official status" to full GUI support would be to fix the logic in build.sh. The only other special thing that ARM needs to build is for VCPKG_FORCE_SYSTEM_BINARIES=1 to be set which is yet again vcpkg's fault.

LBeernaertProton commented 1 year ago

Unfortunately, we don't support arm64 builds of Linux.

The non-gui version should compile correctly on arm64 starting with version 3.1.

benthetechguy commented 1 year ago

My question is why? You have to change one single line and it works. Why not support it if it's this simple?

LBeernaertProton commented 1 year ago

Even if it may be a simple as a one line change, if we fully wish to commit to supporting this new platform combo, it will require expanding our internal workflow to test, build, and verify the application on target hardware.

andirsun commented 10 months ago

@LBeernaertProton Could this change in the future ? I am using Fedora on my macbook m1 pro and I can not use it.

LBeernaertProton commented 10 months ago

@andirsun If this ever changes, it will be communicated.

In the mean time, you can follow the instructions in this thread.

benthetechguy commented 10 months ago

In the mean time, I will provide ARM64 builds of proton-bridge with my one-line GUI patch: proton-bridge_3.5.4_arm64.tar.gz

andirsun commented 9 months ago

@benthetechguy Did not work for me sadly, do you think we can create a unofficial flatpak for the arm64 version ?

benthetechguy commented 9 months ago

It worked for me in Debian on my M1 Mac Mini. I have no experience in making Flatpaks, but nothing's stopping you. I will say definitely make your own repo instead of using Flathub.

andirsun commented 9 months ago

@benthetechguy I am using fedora on macbook pro m1.

~/Downloads/proton-bridge_3.5.4_arm64(1) 
❯ ./bridge-gui 
./bridge-gui: error while loading shared libraries: libmd4c.so.0: cannot open shared object file: No such file or directory
benthetechguy commented 9 months ago

Ah, you need to set LD_LIBRARY_PATH to include the bundled libraries.

ArchitektApx commented 1 month ago

Until Proton provides official aarch64/arm64 builds, i'll provide ready to install deb/rpms built with qt6.7 over at https://github.com/ArchitektApx/proton-bridge/releases

benthetechguy commented 1 month ago

Ah I kind of forgot my promise to build every version arm64, thanks for taking over