From f03606ee604a83bc04e8ef01239a60a3637ff418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:09:11 +0200 Subject: [PATCH 1/9] Disable WebRTC on aarch64 Linux --- cmake/macros/TargetWebRTC.cmake | 3 +++ cmake/ports/hifi-deps/CONTROL | 2 +- libraries/shared/src/shared/WebRTC.h | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/macros/TargetWebRTC.cmake b/cmake/macros/TargetWebRTC.cmake index d215b0698e..58f8a43028 100644 --- a/cmake/macros/TargetWebRTC.cmake +++ b/cmake/macros/TargetWebRTC.cmake @@ -13,6 +13,9 @@ macro(TARGET_WEBRTC) # set(WEBRTC_LIBRARY_DEBUG ${INSTALL_DIR}/debug/lib/libwebrtc.a) # set(WEBRTC_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libwebrtc.a) # select_library_configurations(WEBRTC) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + # WebRTC is basically impossible to build on aarch64 Linux. + # I am looking at https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing for an alternative. else() set(WEBRTC_INCLUDE_DIRS "${VCPKG_INSTALL_ROOT}/include/webrtc") target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${WEBRTC_INCLUDE_DIRS}) diff --git a/cmake/ports/hifi-deps/CONTROL b/cmake/ports/hifi-deps/CONTROL index ff689c7a2a..1fed0476c0 100644 --- a/cmake/ports/hifi-deps/CONTROL +++ b/cmake/ports/hifi-deps/CONTROL @@ -1,4 +1,4 @@ Source: hifi-deps Version: 0.1.5-github-actions Description: Collected dependencies for High Fidelity applications -Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android), zlib +Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android|!(linux&arm)), zlib diff --git a/libraries/shared/src/shared/WebRTC.h b/libraries/shared/src/shared/WebRTC.h index 2f0e444bff..2c683151f8 100644 --- a/libraries/shared/src/shared/WebRTC.h +++ b/libraries/shared/src/shared/WebRTC.h @@ -23,9 +23,14 @@ // I don't yet have a working libwebrtc for android // # define WEBRTC_ENABLED 1 // # define WEBRTC_POSIX 1 -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64) # define WEBRTC_ENABLED 1 # define WEBRTC_POSIX 1 +#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) +// WebRTC is basically impossible to build on aarch64 Linux. +// I am looking at https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing for an alternative. +// # define WEBRTC_ENABLED 1 +// # define WEBRTC_POSIX 1 #endif #if defined(WEBRTC_ENABLED) From fb24c84d86bedca9fd0e0dd397b6eb9042877e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:11:01 +0200 Subject: [PATCH 2/9] Disable unsupported dependencies on aarch64 Linux --- plugins/CMakeLists.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 195021e2fe..fbe9e6b03d 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -12,14 +12,17 @@ list(REMOVE_ITEM PLUGIN_SUBDIRS "CMakeFiles") set(CMAKE_BUILD_TYPE "Release") # client-side plugins if (NOT SERVER_ONLY AND NOT ANDROID) - set(DIR "oculus") - add_subdirectory(${DIR}) + if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + set(DIR "oculus") + add_subdirectory(${DIR}) + set(DIR "openvr") + add_subdirectory(${DIR}) + set(DIR "oculusLegacy") + add_subdirectory(${DIR}) + endif() + set(DIR "hifiSdl2") add_subdirectory(${DIR}) - set(DIR "openvr") - add_subdirectory(${DIR}) - set(DIR "oculusLegacy") - add_subdirectory(${DIR}) if (USE_SIXENSE) set(DIR "hifiSixense") @@ -32,8 +35,12 @@ if (NOT SERVER_ONLY AND NOT ANDROID) add_subdirectory(${DIR}) set(DIR "hifiKinect") add_subdirectory(${DIR}) - set(DIR "steamClient") - add_subdirectory(${DIR}) + + if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + set(DIR "steamClient") + add_subdirectory(${DIR}) + endif() + set(DIR "hifiLeapMotion") add_subdirectory(${DIR}) From f4f4137aa852d04389a4f45f8e69f59e7e3a760d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:20:48 +0200 Subject: [PATCH 3/9] Fix VCPKG package for aarch64 linux --- hifi_vcpkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 642ed1253e..3ec86dfd5a 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -109,8 +109,8 @@ endif() elif 'Linux' == system and 'aarch64' == machine: self.exe = os.path.join(self.path, 'vcpkg') self.bootstrapCmds = [ os.path.join(self.path, 'bootstrap-vcpkg.sh'), '-disableMetrics' ] - self.vcpkgUrl = 'http://motofckr9k.ddns.net/vircadia_packages/vcpkg-2020.11-1_arm64.tar.xz' - self.vcpkgHash = 'f39fa1c34d2ba820954b8ce4acc05e3d0ce5fa5efe5440516ba910ff222c85c658ba4bbfc92b3fa6cbb594f99be115cda69ebe44ed38d4d3988058fb1faefbb3' + self.vcpkgUrl = self.assets_url + '/dependencies/vcpkg/vcpkg-linux_aarch64_2021.05.12.tar.xz' + self.vcpkgHash = '7abb7aa96200e3cb5a6d0ec1c6ee63aa7886df2d1fecf8f9ee41ebe4d2cea0d4143274222c4941cb7aca61e4048229fdfe9eb2cd36dd559dd26db871a3b3ed61' self.hostTriplet = 'arm64-linux' else: self.exe = os.path.join(self.path, 'vcpkg') From 8041f27713efc306bd3f690c7b7b5e3ed6b9abb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:22:03 +0200 Subject: [PATCH 4/9] Allow installing VCPKG inside working directory for GHA builds --- hifi_vcpkg.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 3ec86dfd5a..48d5645119 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -61,7 +61,10 @@ endif() self.noClean = True else: defaultBasePath = os.path.expanduser('~/vircadia-files/vcpkg') - self.basePath = os.getenv('HIFI_VCPKG_BASE', defaultBasePath) + if 'CI_WORKSPACE' in os.environ: + self.basePath = os.path.join(os.getenv('CI_WORKSPACE'), 'vircadia-files/vcpkg') + else: + self.basePath = os.getenv('HIFI_VCPKG_BASE', defaultBasePath) if self.args.android: self.basePath = os.path.join(self.basePath, 'android') if (not os.path.isdir(self.basePath)): From d2002a538f78e275f1c602311c97b93bfd7d44aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:23:06 +0200 Subject: [PATCH 5/9] Add aarch64 GitHub Actions self hosted runner --- .github/workflows/pr_build.yml | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 219daa0c4b..5b1bca3c63 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -46,6 +46,10 @@ jobs: - os: ubuntu-18.04 build_type: android apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 + # Do not change the names of self-hosted runners without knowing what you are doing, as they correspond to labels that have to be set on the runner. + - os: self-hosted_debian-11_aarch64 + build_type: full + apt-dependencies: qtbase5-dev qtbase5-private-dev qtwebengine5-dev qtwebengine5-dev-tools qtmultimedia5-dev libqt5opengl5-dev qtscript5-dev libqt5scripttools5 libqt5webchannel5-dev libqt5websockets5-dev qtxmlpatterns5-dev-tools qttools5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qml-module-qtwebchannel build-essential cmake curl freeglut3-dev git libasound2 libasound2-dev libdouble-conversion-dev libdrm-dev libfontconfig1 libgl1-mesa-dev libglvnd-dev libharfbuzz-dev libjack-dev libjack0 libnspr4 libnss3 libpcre2-16-0 libpulse0 libsdl2-dev libssl-dev libudev-dev libxcb-xinerama0-dev libxcb-xinput0 libxcomposite1 libxcursor1 libxi-dev libxmu-dev libxrandr-dev libxslt1.1 libxtst6 make mesa-common-dev mesa-utils nodejs npm patchelf python2 python3 python3-distro xdg-user-dirs zlib1g-dev ninja-build zip fail-fast: false runs-on: ${{matrix.os}} if: github.event.action != 'labeled' || github.event.label.name == 'rebuild' @@ -59,10 +63,19 @@ jobs: echo "APP_TARGET_NAME=$APP_NAME" >> $GITHUB_ENV # Linux build variables - if [[ "${{ matrix.os }}" = "ubuntu-"* ]]; then + if [[ "${{ matrix.os }}" = "ubuntu-"* || "${{ matrix.os }}" = *"debian"* ]]; then echo "PYTHON_EXEC=python3" >> $GITHUB_ENV echo "INSTALLER_EXT=*" >> $GITHUB_ENV - echo "CMAKE_BUILD_EXTRA=-- -j3" >> $GITHUB_ENV + if [ "${{ matrix.os }}" = "self-hosted_debian-11_aarch64" ]; then + echo "CMAKE_BUILD_EXTRA=-- -j4" >> $GITHUB_ENV + else + echo "CMAKE_BUILD_EXTRA=-- -j3" >> $GITHUB_ENV + fi + if [ "${{ matrix.os }}" = "self-hosted_debian-11_aarch64" ]; then + echo "VIRCADIA_USE_SYSTEM_QT=true" >> $GITHUB_ENV + echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV + echo "CI_WORKSPACE=${{runner.workspace}}" >> $GITHUB_ENV + fi if [ "${{ matrix.build_type }}" = "full" ]; then echo "CMAKE_EXTRA=-DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV else @@ -97,6 +110,7 @@ jobs: mkdir $HIFI_ANDROID_PRECOMPILED echo "INSTALLER_EXT=apk" >> $GITHUB_ENV fi + # Configuration is broken into two steps because you can't set an env var and also reference it in the same step - name: Configure Build Environment 2 shell: bash @@ -114,8 +128,9 @@ jobs: else echo "ARTIFACT_PATTERN=*.$INSTALLER_EXT" >> $GITHUB_ENV fi + - name: Clear Working Directory - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') || matrix.os == 'self-hosted_debian-11_aarch64' shell: bash working-directory: ${{runner.workspace}} run: rm -rf ./* @@ -123,9 +138,10 @@ jobs: with: submodules: false fetch-depth: 1 + - name: Install dependencies shell: bash - if: startsWith(matrix.os, 'ubuntu') + if: startsWith(matrix.os, 'ubuntu') || contains(matrix.os, 'debian') run: | echo "Installing Python Modules:" pip3 install distro || exit 1 @@ -135,13 +151,16 @@ jobs: echo "Installing apt packages" sudo apt install -y ${{ matrix.apt-dependencies }} || exit 1 + - name: Create Build Environment shell: bash run: cmake -E make_directory "${{runner.workspace}}/build" + - name: Configure CMake working-directory: ${{runner.workspace}}/build shell: bash run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release $CMAKE_EXTRA + - name: Compress cmake logs if: always() shell: bash @@ -152,7 +171,12 @@ jobs: TAR=tar fi - find "$HOME/vircadia-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz" + if [ ${{ env.CI_WORKSPACE }} ]; then + find "$CI_WORKSPACE/vircadia-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz" + else + find "$HOME/vircadia-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz" + fi + - name: Archive cmake logs if: always() uses: actions/upload-artifact@v2 @@ -160,26 +184,31 @@ jobs: name: cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz path: ${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz if-no-files-found: error + - name: Build Application if: matrix.build_type == 'full' || matrix.build_type == 'client' working-directory: ${{runner.workspace}}/build shell: bash run: cmake --build . --config $BUILD_TYPE --target $APP_TARGET_NAME $CMAKE_BUILD_EXTRA + - name: Build Domain Server if: matrix.build_type == 'full' working-directory: ${{runner.workspace}}/build shell: bash run: cmake --build . --config $BUILD_TYPE --target domain-server $CMAKE_BUILD_EXTRA + - name: Build Assignment Client if: matrix.build_type == 'full' working-directory: ${{runner.workspace}}/build shell: bash run: cmake --build . --config $BUILD_TYPE --target assignment-client $CMAKE_BUILD_EXTRA + - name: Build Console if: matrix.build_type == 'full' || matrix.os == 'windows-latest' working-directory: ${{runner.workspace}}/build shell: bash run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA + - name: Build Installer if: matrix.build_type != 'android' working-directory: ${{runner.workspace}}/build @@ -218,6 +247,7 @@ jobs: working-directory: ${{runner.workspace}}/vircadia run: | /usr/local/lib/android/sdk/tools/bin/sdkmanager --uninstall 'cmake;3.18.1' + - name: Build for Android + Quest if: matrix.build_type == 'android' shell: bash @@ -230,6 +260,7 @@ jobs: ./gradlew -m tasks -PHIFI_ANDROID_PRECOMPILED=$HIFI_ANDROID_PRECOMPILED # Build! ./build_android.sh + - name: Output system stats if: ${{ always() }} working-directory: ${{runner.workspace}}/build @@ -237,11 +268,13 @@ jobs: run: | echo "Disk usage:" df -h + - name: Output Installer Logs if: failure() && matrix.os == 'windows-latest' shell: bash working-directory: ${{runner.workspace}}/build run: cat ./_CPack_Packages/win64/NSIS/NSISOutput.log + - name: Upload Artifact shell: bash working-directory: ${{runner.workspace}}/build From bc1044692a1a1a6f56b8a2a7317370fbd04215c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 16 Sep 2021 06:23:25 +0200 Subject: [PATCH 6/9] Add experimental debian 10 aarch64 qt package --- hifi_qt.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hifi_qt.py b/hifi_qt.py index f832d5f940..b736a1433b 100644 --- a/hifi_qt.py +++ b/hifi_qt.py @@ -169,11 +169,9 @@ endif() elif distro.id() == 'debian': u_major = int( distro.major_version() ) - u_minor = int( distro.minor_version() ) if u_major == 10: - #self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz' - self.__no_qt_package_error() + self.qtUrl = 'https://data.moto9000.moe/vircadia_packages/qt5-install-5.15.2-debian-10-aarch64.tar.xz' elif u_major > 10: self.__no_qt_package_error() else: From a9d8c9904b9ee4874e15fd18f297927e24e0bb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Fri, 24 Sep 2021 17:11:29 +0200 Subject: [PATCH 7/9] Update to code review --- .github/workflows/pr_build.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 5b1bca3c63..7426fa82e0 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -66,16 +66,14 @@ jobs: if [[ "${{ matrix.os }}" = "ubuntu-"* || "${{ matrix.os }}" = *"debian"* ]]; then echo "PYTHON_EXEC=python3" >> $GITHUB_ENV echo "INSTALLER_EXT=*" >> $GITHUB_ENV - if [ "${{ matrix.os }}" = "self-hosted_debian-11_aarch64" ]; then - echo "CMAKE_BUILD_EXTRA=-- -j4" >> $GITHUB_ENV - else - echo "CMAKE_BUILD_EXTRA=-- -j3" >> $GITHUB_ENV - fi + echo "CMAKE_BUILD_EXTRA=-- -j$(nproc)" >> $GITHUB_ENV if [ "${{ matrix.os }}" = "self-hosted_debian-11_aarch64" ]; then echo "VIRCADIA_USE_SYSTEM_QT=true" >> $GITHUB_ENV - echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV echo "CI_WORKSPACE=${{runner.workspace}}" >> $GITHUB_ENV fi + if [ "${{ matrix.os }}" =~ "aarch64" ]; then + echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV + fi if [ "${{ matrix.build_type }}" = "full" ]; then echo "CMAKE_EXTRA=-DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV else @@ -130,7 +128,7 @@ jobs: fi - name: Clear Working Directory - if: startsWith(matrix.os, 'windows') || matrix.os == 'self-hosted_debian-11_aarch64' + if: startsWith(matrix.os, 'windows') || contains(matrix.os, 'self-hosted') shell: bash working-directory: ${{runner.workspace}} run: rm -rf ./* From 78248ee6cac691cbdf6f69798737a7a27d15e4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Sun, 26 Sep 2021 08:13:45 +0200 Subject: [PATCH 8/9] Apparently using regex for finding a word doesn't work. --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 7426fa82e0..32295e0a0b 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -71,7 +71,7 @@ jobs: echo "VIRCADIA_USE_SYSTEM_QT=true" >> $GITHUB_ENV echo "CI_WORKSPACE=${{runner.workspace}}" >> $GITHUB_ENV fi - if [ "${{ matrix.os }}" =~ "aarch64" ]; then + if [ "${{ matrix.os }}" = *"aarch64" ]; then echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV fi if [ "${{ matrix.build_type }}" = "full" ]; then From 48d6f348ce369cd1708c32a275feaf3c7ec27050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Sun, 26 Sep 2021 08:30:15 +0200 Subject: [PATCH 9/9] I hate this --- .github/workflows/pr_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 32295e0a0b..20619983c5 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -71,7 +71,7 @@ jobs: echo "VIRCADIA_USE_SYSTEM_QT=true" >> $GITHUB_ENV echo "CI_WORKSPACE=${{runner.workspace}}" >> $GITHUB_ENV fi - if [ "${{ matrix.os }}" = *"aarch64" ]; then + if [[ "${{ matrix.os }}" = *"aarch64" ]]; then echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV fi if [ "${{ matrix.build_type }}" = "full" ]; then