From c278db0a43bb936b5a274731ea9944880f78fbfe Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 21:17:06 +0000 Subject: [PATCH 01/20] Add arm64-linux build --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21deb35..3716c43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,16 @@ jobs: cmake_args: >- -DDEBUG_ASSERTIONS_FATAL=ON -DBATTERY=OFF + - name: Linux (arm64) + os: ubuntu-latest + triplet: arm64-linux-release + host_triplet: x64-linux-release + overlay_ports: vcpkg/overlay/ports + ccache_path: ~/.ccache + cpack_generator: TGZ + package_extension: tar.gz + cmake_args: >- + -DBATTERY=OFF name: '${{ matrix.name }}' runs-on: '${{ matrix.os }}' From e961ad0435bf9b52d392243a005d10e21e8efc48 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 21:32:54 +0000 Subject: [PATCH 02/20] Install cross-compiler on Ubuntu --- scripts/install-ubuntu-deps | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 3e6a1ca..a355cc0 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -30,3 +30,23 @@ sudo apt-get install -y \ mesa-common-dev \ nasm \ ninja-build + +host="$VCPKG_DEFAULT_HOST_TRIPLET" +target="$VCPKG_DEFAULT_TRIPLET" + +if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then + echo "==> Determining cross-compilation tools for $target..." + cross_pkgs=() + case "$target" in + arm64-linux) + cross_pkgs+=(gcc-aarch64-linux-gnu) + ;; + *) + echo "Unsupported target triplet: $target" + exit 1 + ;; + esac + + echo "==> Installing cross-compilation tools with APT..." + sudo apt-get install -y "${cross_pkgs[@]}" +fi From 1bfebf6d9e71d16e3da9665251ee89bed6ee890a Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 21:35:11 +0000 Subject: [PATCH 03/20] Install C++ cross-compiler too --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index a355cc0..ad8d003 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -39,7 +39,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then cross_pkgs=() case "$target" in arm64-linux) - cross_pkgs+=(gcc-aarch64-linux-gnu) + cross_pkgs+=(gcc-aarch64-linux-gnu g++-aarch64-linux-gnu) ;; *) echo "Unsupported target triplet: $target" From 737f75ef8c41c31e1a74251b2941d0a4e6fea9a4 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 22:27:34 +0000 Subject: [PATCH 04/20] Disable `RUN_HAVE_POSIX_REGEX` via overlay triplet --- .github/workflows/build.yml | 2 +- overlay/triplets/arm64-linux-release.cmake | 11 +++++++++++ vars/vcpkg.sh | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 overlay/triplets/arm64-linux-release.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3716c43..a350fbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: ARTIFACT_BASE_NAME: 'mixxx-${{ matrix.triplet }}${{ matrix.suffix }}' VCPKG_DEFAULT_TRIPLET: '${{ matrix.triplet }}' VCPKG_DEFAULT_HOST_TRIPLET: '${{ matrix.host_triplet }}' - VCPKG_OVERLAY_TRIPLETS: vcpkg/overlay/triplets + VCPKG_OVERLAY_TRIPLETS: overlay/triplets:vcpkg/overlay/triplets VCPKG_OVERLAY_PORTS: '${{ matrix.overlay_ports }}' steps: diff --git a/overlay/triplets/arm64-linux-release.cmake b/overlay/triplets/arm64-linux-release.cmake new file mode 100644 index 0000000..63b1506 --- /dev/null +++ b/overlay/triplets/arm64-linux-release.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) + +set(VCPKG_BUILD_TYPE release) + +if("${PORT}" STREQUAL "benchmark") + set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DRUN_HAVE_POSIX_REGEX=0) +endif() diff --git a/vars/vcpkg.sh b/vars/vcpkg.sh index b6a2446..29bd905 100644 --- a/vars/vcpkg.sh +++ b/vars/vcpkg.sh @@ -4,5 +4,5 @@ if [ -z "$VCPKG_ROOT" ]; then export VCPKG_ROOT="$rootdir/vcpkg" fi -export VCPKG_OVERLAY_TRIPLETS="$VCPKG_ROOT/overlay/triplets" +export VCPKG_OVERLAY_TRIPLETS="$rootdir/overlay/triplets:$VCPKG_ROOT/overlay/triplets" export VCPKG_OVERLAY_PORTS="$VCPKG_ROOT/overlay/osx:$VCPKG_ROOT/overlay/ports" From 200dc3dda699ab4efbbe4b2993dd324b7378fa59 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 23:25:17 +0000 Subject: [PATCH 05/20] Split Ubuntu dependencies into host and target dependencies --- scripts/install-ubuntu-deps | 88 +++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index ad8d003..8292fd4 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -7,46 +7,60 @@ if ! command -v apt-get >/dev/null; then exit 1 fi -echo "==> Installing system dependencies with APT..." +triplet_to_arch() { + if [ -n "$1" ]; then + case "$1" in + x64-*) echo amd64;; + arm64-*) echo aarch64;; + *) + echo "Unsupported triplet: $1" + return 1 + ;; + esac + fi +} + +echo "==> Updating APT..." sudo apt-get update -sudo apt-get install -y \ - autoconf-archive \ - autotools-dev \ - ccache \ - cmake \ - libasound2-dev \ - '^libxcb.*-dev' \ - libx11-xcb-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libsleef-dev \ - libudev-dev \ - libupower-glib-dev \ - libtool \ - libxrender-dev \ - libxi-dev \ - libxkbcommon-dev \ - libxkbcommon-x11-dev \ - mesa-common-dev \ - nasm \ + +echo "==> Installing host dependencies with APT..." +host_deps=( + autoconf-archive + autotools-dev + ccache + cmake + libtool + nasm ninja-build +) +sudo apt-get install -y "${host_deps[@]}" -host="$VCPKG_DEFAULT_HOST_TRIPLET" -target="$VCPKG_DEFAULT_TRIPLET" - -if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then - echo "==> Determining cross-compilation tools for $target..." - cross_pkgs=() - case "$target" in - arm64-linux) - cross_pkgs+=(gcc-aarch64-linux-gnu g++-aarch64-linux-gnu) - ;; - *) - echo "Unsupported target triplet: $target" - exit 1 - ;; - esac +host_arch="$(triplet_to_arch "$VCPKG_DEFAULT_HOST_TRIPLET")" +target_arch="$(triplet_to_arch "$VCPKG_DEFAULT_TRIPLET")" +if [[ -n "$host_arch" && -n "$target_arch" && "$host_arch" != "$target_arch" ]]; then echo "==> Installing cross-compilation tools with APT..." - sudo apt-get install -y "${cross_pkgs[@]}" + sudo apt-get install -y "g++-$target_arch-linux-gnu" + + echo "==> Adding architecture $target_arch to dpkg..." + sudo dpkg --add-architecture "$target_arch" + sudo apt-get update fi + +echo "==> Installing target dependencies with APT..." +target_deps=( + libasound2-dev + '^libxcb.*-dev' + libx11-xcb-dev + libgl1-mesa-dev + libglu1-mesa-dev + libsleef-dev + libudev-dev + libupower-glib-dev + libxrender-dev + libxi-dev + libxkbcommon-dev + libxkbcommon-x11-dev + mesa-common-dev +) +sudo apt-get install -y "${target_deps/%/:$target_arch}" From 3f9570dd21ea404a6dc118f138d1e7c5428f56bb Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 23:28:14 +0000 Subject: [PATCH 06/20] Fix arm64 Debian architecture name --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 8292fd4..42a6416 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -11,7 +11,7 @@ triplet_to_arch() { if [ -n "$1" ]; then case "$1" in x64-*) echo amd64;; - arm64-*) echo aarch64;; + arm64-*) echo arm64;; *) echo "Unsupported triplet: $1" return 1 From 358edab5bc44051c0bb6fe4a5d3d8c0559250803 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 23:34:35 +0000 Subject: [PATCH 07/20] Handle the different architecture naming conventions --- scripts/install-ubuntu-deps | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 42a6416..9acc0ab 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -7,15 +7,22 @@ if ! command -v apt-get >/dev/null; then exit 1 fi -triplet_to_arch() { +triplet_to_deb_arch() { if [ -n "$1" ]; then case "$1" in x64-*) echo amd64;; arm64-*) echo arm64;; - *) - echo "Unsupported triplet: $1" - return 1 - ;; + *) echo "Unsupported triplet: $1"; return 1;; + esac + fi +} + +triplet_to_gcc_arch() { + if [ -n "$1" ]; then + case "$1" in + x64-*) echo x86-64;; + arm64-*) echo aarch64;; + *) echo "Unsupported triplet: $1"; return 1;; esac fi } @@ -35,15 +42,18 @@ host_deps=( ) sudo apt-get install -y "${host_deps[@]}" -host_arch="$(triplet_to_arch "$VCPKG_DEFAULT_HOST_TRIPLET")" -target_arch="$(triplet_to_arch "$VCPKG_DEFAULT_TRIPLET")" +host="$VCPKG_DEFAULT_HOST_TRIPLET" +target="$VCPKG_DEFAULT_TRIPLET" + +target_deb_arch="$(triplet_to_deb_arch "$target")" +target_gcc_arch="$(triplet_to_gcc_arch "$target")" -if [[ -n "$host_arch" && -n "$target_arch" && "$host_arch" != "$target_arch" ]]; then +if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Installing cross-compilation tools with APT..." - sudo apt-get install -y "g++-$target_arch-linux-gnu" + sudo apt-get install -y "g++-$target_gcc_arch-linux-gnu" - echo "==> Adding architecture $target_arch to dpkg..." - sudo dpkg --add-architecture "$target_arch" + echo "==> Adding target architecture to dpkg..." + sudo dpkg --add-architecture "$target_deb_arch" sudo apt-get update fi @@ -63,4 +73,4 @@ target_deps=( libxkbcommon-x11-dev mesa-common-dev ) -sudo apt-get install -y "${target_deps/%/:$target_arch}" +sudo apt-get install -y "${target_deps/%/:$target_deb_arch}" From b273b69d8bb1bf170ea93c88d632183c717bfbb0 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 23:53:13 +0000 Subject: [PATCH 08/20] Choose target mirror as needed --- scripts/install-ubuntu-deps | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 9acc0ab..2216339 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -27,6 +27,15 @@ triplet_to_gcc_arch() { fi } +deb_arch_to_mirror() { + if [ -n "$1" ]; then + case "$1" in + amd64|i386) echo "http://archive.ubuntu.com/ubuntu";; + *) echo "http://ports.ubuntu.com/ubuntu-ports";; + esac + fi +} + echo "==> Updating APT..." sudo apt-get update @@ -47,12 +56,15 @@ target="$VCPKG_DEFAULT_TRIPLET" target_deb_arch="$(triplet_to_deb_arch "$target")" target_gcc_arch="$(triplet_to_gcc_arch "$target")" +target_mirror="$(deb_arch_to_mirror "$target_deb_arch")" if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Installing cross-compilation tools with APT..." sudo apt-get install -y "g++-$target_gcc_arch-linux-gnu" - echo "==> Adding target architecture to dpkg..." + echo "==> Adding target architecture to APT..." + ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" + echo "deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe" >> /etc/apt/sources.list sudo dpkg --add-architecture "$target_deb_arch" sudo apt-get update fi From c010094ded0ee6b655e60d480bdaa2630ecc7c99 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 18 Nov 2023 23:56:26 +0000 Subject: [PATCH 09/20] Update sources.list with sudo --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 2216339..ff02992 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -64,7 +64,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target architecture to APT..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - echo "deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe" >> /etc/apt/sources.list + sudo bash -c "echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe' >> /etc/apt/sources.list" sudo dpkg --add-architecture "$target_deb_arch" sudo apt-get update fi From 4d391f9e577e69153e90d84763a1d8924241e986 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:06:29 +0000 Subject: [PATCH 10/20] Insert target repository at the top --- scripts/install-ubuntu-deps | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index ff02992..e639eb9 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -64,7 +64,8 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target architecture to APT..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - sudo bash -c "echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe' >> /etc/apt/sources.list" + sudo bash -c "{ echo 'deb[arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list } > /etc/apt/sources.list.new" + sudo mv /etc/apt/sources.list{.new,} sudo dpkg --add-architecture "$target_deb_arch" sudo apt-get update fi From ffa9845bfb570b82ac6a2f5663fc524f28aa6967 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:11:19 +0000 Subject: [PATCH 11/20] Fix typo --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index e639eb9..236f82b 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -64,7 +64,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target architecture to APT..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - sudo bash -c "{ echo 'deb[arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list } > /etc/apt/sources.list.new" + sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} sudo dpkg --add-architecture "$target_deb_arch" sudo apt-get update From b5fbae44c8d2885504ab4c685b1ece9a8f99992d Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:46:46 +0000 Subject: [PATCH 12/20] Fix target mirror setup (hopefully) --- scripts/install-ubuntu-deps | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 236f82b..6831a0b 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -54,6 +54,7 @@ sudo apt-get install -y "${host_deps[@]}" host="$VCPKG_DEFAULT_HOST_TRIPLET" target="$VCPKG_DEFAULT_TRIPLET" +host_deb_arch="$(trplet_to_deb_arch "$host")" target_deb_arch="$(triplet_to_deb_arch "$target")" target_gcc_arch="$(triplet_to_gcc_arch "$target")" target_mirror="$(deb_arch_to_mirror "$target_deb_arch")" @@ -62,12 +63,18 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Installing cross-compilation tools with APT..." sudo apt-get install -y "g++-$target_gcc_arch-linux-gnu" - echo "==> Adding target architecture to APT..." - ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" - sudo mv /etc/apt/sources.list{.new,} - sudo dpkg --add-architecture "$target_deb_arch" - sudo apt-get update + if [ -z "$(dpkg --print-foreign-architectures | grep "$target_arch")" ]; then + echo "==> Adding target mirror to APT sources..." + ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" + sudo sed -i "s/deb http/deb [arch=$host_deb_arch] http/" /etc/apt/sources.list + sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" + sudo mv /etc/apt/sources.list{.new,} + cat /etc/apt/sources.list + + echo "==> Adding target architecture to APT..." + sudo dpkg --add-architecture "$target_deb_arch" + sudo apt-get update + fi fi echo "==> Installing target dependencies with APT..." From 97550b0df12dcbe0f72f18a8392d47e676c342ca Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:49:15 +0000 Subject: [PATCH 13/20] Fix typo --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 6831a0b..fddce7a 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -54,7 +54,7 @@ sudo apt-get install -y "${host_deps[@]}" host="$VCPKG_DEFAULT_HOST_TRIPLET" target="$VCPKG_DEFAULT_TRIPLET" -host_deb_arch="$(trplet_to_deb_arch "$host")" +host_deb_arch="$(triplet_to_deb_arch "$host")" target_deb_arch="$(triplet_to_deb_arch "$target")" target_gcc_arch="$(triplet_to_gcc_arch "$target")" target_mirror="$(deb_arch_to_mirror "$target_deb_arch")" From 2bb204ca3a71bc0983cfd13d85abeb4a51c0258a Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:51:10 +0000 Subject: [PATCH 14/20] Fix typo and handle absent target deb arch --- scripts/install-ubuntu-deps | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index fddce7a..0f4664d 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -93,4 +93,8 @@ target_deps=( libxkbcommon-x11-dev mesa-common-dev ) -sudo apt-get install -y "${target_deps/%/:$target_deb_arch}" +if [ -n "$target_deb_arch" ]; then + sudo apt-get install -y "${target_deps[@]/%/:$target_deb_arch}" +else + sudo apt-get install -y "${target_deps[@]}" +fi From 676660125271785d6a9741541262bcd183ce2e8d Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:53:20 +0000 Subject: [PATCH 15/20] Make host arch substitution more generic --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 0f4664d..487dcde 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -66,7 +66,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then if [ -z "$(dpkg --print-foreign-architectures | grep "$target_arch")" ]; then echo "==> Adding target mirror to APT sources..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - sudo sed -i "s/deb http/deb [arch=$host_deb_arch] http/" /etc/apt/sources.list + sudo sed -i "s/deb ([a-z])/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} cat /etc/apt/sources.list From 7139ab62f9bd3c221318993524da3a28ecade499 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 00:56:59 +0000 Subject: [PATCH 16/20] Fix another typo --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 487dcde..9e457ca 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -66,7 +66,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then if [ -z "$(dpkg --print-foreign-architectures | grep "$target_arch")" ]; then echo "==> Adding target mirror to APT sources..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" - sudo sed -i "s/deb ([a-z])/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list + sudo sed -i "s/deb \([a-z]\)/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} cat /etc/apt/sources.list From 28e38587038e3b04bb11355c6c0c29d4c12469d8 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 01:05:01 +0000 Subject: [PATCH 17/20] Add updates repo too --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 9e457ca..7974028 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -67,7 +67,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target mirror to APT sources..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" sudo sed -i "s/deb \([a-z]\)/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list - sudo bash -c "{ echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version main multiverse universe'; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" + sudo bash -c "{ for repo_suffix in '' '-updates'; do echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version$repo_suffix main multiverse universe'; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} cat /etc/apt/sources.list From 204df0e6ab6efc5e159bda8cc1c3b9b6eb793230 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 01:07:57 +0000 Subject: [PATCH 18/20] Add missing escape --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 7974028..7ca37ed 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -67,7 +67,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target mirror to APT sources..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" sudo sed -i "s/deb \([a-z]\)/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list - sudo bash -c "{ for repo_suffix in '' '-updates'; do echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version$repo_suffix main multiverse universe'; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" + sudo bash -c "{ for repo_suffix in '' '-updates'; do echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version\$repo_suffix main multiverse universe'; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} cat /etc/apt/sources.list From b34e4046cc9623ebeb1e0806544587b033e61606 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 01:10:30 +0000 Subject: [PATCH 19/20] Fix quotes --- scripts/install-ubuntu-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index 7ca37ed..d2fedf4 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -67,7 +67,7 @@ if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then echo "==> Adding target mirror to APT sources..." ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)" sudo sed -i "s/deb \([a-z]\)/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list - sudo bash -c "{ for repo_suffix in '' '-updates'; do echo 'deb [arch=$target_deb_arch] $target_mirror $ubuntu_version\$repo_suffix main multiverse universe'; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" + sudo bash -c "{ for repo_suffix in '' '-updates'; do echo \"deb [arch=$target_deb_arch] $target_mirror $ubuntu_version\$repo_suffix main multiverse universe\"; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new" sudo mv /etc/apt/sources.list{.new,} cat /etc/apt/sources.list From f68883d2b52c32af38a71362e70a00168e486987 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 19 Nov 2023 20:40:51 +0000 Subject: [PATCH 20/20] Install libraries for host architecture too --- scripts/install-ubuntu-deps | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install-ubuntu-deps b/scripts/install-ubuntu-deps index d2fedf4..7706861 100755 --- a/scripts/install-ubuntu-deps +++ b/scripts/install-ubuntu-deps @@ -94,7 +94,9 @@ target_deps=( mesa-common-dev ) if [ -n "$target_deb_arch" ]; then - sudo apt-get install -y "${target_deps[@]/%/:$target_deb_arch}" + # We need the packages for the host architecture too, since some packages + # (e.g. Qt) have to be built for the host too during cross compilation + sudo apt-get install -y "${target_deps[@]}" "${target_deps[@]/%/:$target_deb_arch}" else sudo apt-get install -y "${target_deps[@]}" fi