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

Linux ARM64 Support for CMake #2699

Open
thurask opened this issue Dec 22, 2024 · 1 comment
Open

Linux ARM64 Support for CMake #2699

thurask opened this issue Dec 22, 2024 · 1 comment
Assignees
Labels
enhancement New features or enhancements of existing ones

Comments

@thurask
Copy link

thurask commented Dec 22, 2024

I'm attempting to get MEGASync built from source on Raspberry Pi OS Bookworm ARM64 on a Raspberry Pi 5, as currently configured the build breaks because there is no ARM64 Linux target for CMake inside the SDK. I whipped up a quick CMake triplet file that does build with default options, cmake/vcpkg_overlay_triplets/arm64-linux.cmake:

set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)

if(PORT MATCHES "ffmpeg")
    # build this library as dynamic (usually because it is LGPL licensed)
    set(VCPKG_LIBRARY_LINKAGE dynamic)
else()
    # build this library statically (much simpler installation, debugging, etc)
        set(VCPKG_LIBRARY_LINKAGE static)
endif()

As well as the necessary edit to cmake/modules/vcpkg_management.cmake:

--- a/cmake/modules/vcpkg_management.cmake
+++ b/cmake/modules/vcpkg_management.cmake
@@ -28,6 +28,8 @@ macro(process_vcpkg_libraries overlays_path)
         else()
             if (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l" OR (NOT CMAKE_SYSTEM_PROCESSOR AND HOST_ARCH MATCHES "armv7l"))
                 set(VCPKG_TARGET_TRIPLET "arm-linux")
+            elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR (NOT CMAKE_SYSTEM_PROCESSOR AND HOST_ARCH MATCHES "aarch64"))
+                set(VCPKG_TARGET_TRIPLET "arm64-linux")
             else()
                 set(VCPKG_TARGET_TRIPLET "x64-linux-mega")
             endif()

In order for this to build the only deviations from the README instructions are to:

  1. Preface the build command with VCPKG_FORCE_SYSTEM_BINARIES, i.e. VCPKG_FORCE_SYSTEM_BINARIES=1 cmake -DVCPKG_ROOT=vcpkg -DCMAKE_BUILD_TYPE=Release -S sdk -B build_dir
  2. Install additional prerequisites of cmake and ninja-build because of above; I also installed kernel headers just in case.

Without the force system binaries VCPKG complains that it's necessary on ARM and S390 platforms.

Build output attached.
cmake_config.txt
cmake_make.txt

@thurask thurask added the enhancement New features or enhancements of existing ones label Dec 22, 2024
@thurask thurask changed the title ARM64 Support for CMake Linux ARM64 Support for CMake Dec 22, 2024
@thurask
Copy link
Author

thurask commented Dec 22, 2024

After applying the above changes to the SDK while building MEGASync I run into the issue with Google Breakpad (meganz/MEGAsync#801), but once that and this are resolved it should be enough to build ARM64 MEGASync on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or enhancements of existing ones
Projects
None yet
Development

No branches or pull requests

2 participants