diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0da9393..c35f038f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,12 +160,19 @@ jobs: - name: ubuntu-20.04_x86_64 runs-on: ubuntu-20.04 os: ubuntu + arch: x86_64 - name: ubuntu-22.04_x86_64 runs-on: ubuntu-22.04 os: ubuntu + arch: x86_64 - name: ubuntu-24.04_x86_64 runs-on: ubuntu-24.04 os: ubuntu + arch: x86_64 + - name: ubuntu-24.04_armv8 + runs-on: ubuntu-24.04 + os: ubuntu + arch: armv8 - name: android runs-on: ubuntu-22.04 os: android @@ -216,7 +223,7 @@ jobs: Pin-Priority: 990 EOF - name: Install deps for ${{ matrix.platform.name }} - if: matrix.platform.os == 'ubuntu' + if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'x86_64' run: | source VERSION sudo apt-get update @@ -238,6 +245,12 @@ jobs: # Intel Media SDK のために libva-dev, libdrm-dev を入れる DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libva-dev libdrm-dev + - name: Install deps for ${{ matrix.platform.name }} + if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'armv8' + run: | + sudo apt-get -y install multistrap binutils-aarch64-linux-gnu + # multistrap に insecure なリポジトリからの取得を許可する設定を入れる + sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap - name: Install deps for Android if: matrix.platform.os == 'android' run: | @@ -283,13 +296,13 @@ jobs: python3 $app/${{ matrix.platform.name }}/run.py --local-sora-cpp-sdk-dir .. cp _build/${{ matrix.platform.name }}/release/$app/$app examples_${{ matrix.platform.name }} done - if: matrix.platform.os == 'ubuntu' + if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'x86_64' - name: Upload Examples Artifact uses: actions/upload-artifact@v4 with: name: examples_${{ matrix.platform.name }} path: examples/examples_${{ matrix.platform.name }} - if: matrix.platform.os == 'ubuntu' + if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'x86_64' create-release: name: Create Release @@ -319,6 +332,9 @@ jobs: - uses: ./.github/actions/download with: platform: ubuntu-24.04_x86_64 + - uses: ./.github/actions/download + with: + platform: ubuntu-24.04_armv8 - uses: ./.github/actions/download with: platform: android diff --git a/CHANGES.md b/CHANGES.md index 0cf5e1fd..54777f36 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,8 @@ - @tnoho - [ADD] ルート証明書を指定可能にする - @melpon +- [ADD] Ubuntu 24.04 armv8 に対応する + - @melpon - [FIX] HTTP Proxy 利用時の Websocket 初期化で insecure_ メンバ変数が初期化されていなかったのを修正 - @melpon diff --git a/CMakeLists.txt b/CMakeLists.txt index dd0e3660..ed33a818 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,11 @@ elseif (SORA_TARGET STREQUAL "ubuntu-24.04_x86_64") set(SORA_TARGET_OS_VERSION "24.04") set(SORA_TARGET_ARCH "x86_64") set(SORA_TARGET_DEF "SORA_CPP_SDK_UBUNTU_2404") +elseif (SORA_TARGET STREQUAL "ubuntu-24.04_armv8") + set(SORA_TARGET_OS "ubuntu") + set(SORA_TARGET_OS_VERSION "24.04") + set(SORA_TARGET_ARCH "armv8") + set(SORA_TARGET_DEF "SORA_CPP_SDK_UBUNTU_2404") endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/VERSION b/VERSION index d8e281fa..ca134f7e 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ SORA_CPP_SDK_VERSION=2024.8.0-canary.7 -WEBRTC_BUILD_VERSION=m128.6613.2.0 +WEBRTC_BUILD_VERSION=m128.6613.3.1 BOOST_VERSION=1.86.0 CMAKE_VERSION=3.30.3 CUDA_VERSION=11.8.0-1 diff --git a/buildbase.py b/buildbase.py index b91e070b..6223e5db 100644 --- a/buildbase.py +++ b/buildbase.py @@ -1564,6 +1564,8 @@ def _check_platform_target(self, p: PlatformTarget): self._check(p.arch == "armv8") elif p.os in ("ios", "android"): self._check(p.arch is None) + elif p.os == "ubuntu": + self._check(p.arch in ("x86_64", "armv8")) else: self._check(p.arch in ("x86_64", "arm64")) @@ -1590,7 +1592,8 @@ def __init__(self, target_os, target_osver, target_arch): if target.os == "ubuntu": self._check(build.os == "ubuntu") self._check(build.arch == "x86_64") - self._check(build.osver == target.osver) + if target.arch == "x86_64": + self._check(build.osver == target.osver) if target.os == "raspberry-pi-os": self._check(build.os == "ubuntu") self._check(build.arch == "x86_64") diff --git a/multistrap/ubuntu-24.04_armv8.conf b/multistrap/ubuntu-24.04_armv8.conf new file mode 100644 index 00000000..4b18038e --- /dev/null +++ b/multistrap/ubuntu-24.04_armv8.conf @@ -0,0 +1,11 @@ +[General] +noauth=true +unpack=true +bootstrap=Ports +aptsources=Ports + +[Ports] +packages=libstdc++-13-dev libc6-dev libxext-dev libdbus-1-dev +source=http://ports.ubuntu.com +suite=noble +components=main universe diff --git a/run.py b/run.py index 587d6fd8..f60896ef 100644 --- a/run.py +++ b/run.py @@ -1,4 +1,5 @@ import argparse +import hashlib import logging import multiprocessing import os @@ -31,6 +32,7 @@ install_cuda_windows, install_llvm, install_openh264, + install_rootfs, install_vpl, install_webrtc, mkdir_p, @@ -80,12 +82,20 @@ def get_common_cmake_args( args.append("-DCMAKE_C_COMPILER=clang-18") args.append("-DCMAKE_CXX_COMPILER=clang++-18") else: + sysroot = os.path.join(install_dir, "rootfs") args.append( f"-DCMAKE_C_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang'))}" ) args.append( f"-DCMAKE_CXX_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang++'))}" ) + args.append("-DCMAKE_SYSTEM_NAME=Linux") + args.append("-DCMAKE_SYSTEM_PROCESSOR=aarch64") + args.append(f"-DCMAKE_SYSROOT={sysroot}") + args.append("-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu") + args.append("-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu") + args.append(f"-DCMAKE_FIND_ROOT_PATH={sysroot}") + args.append("-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER") path = cmake_path(os.path.join(webrtc_info.libcxx_dir, "include")) args.append(f"-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES={path}") cxxflags = ["-nostdinc++", "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE"] @@ -132,6 +142,19 @@ def install_deps( with cd(BASE_DIR): version = read_version_file("VERSION") + # multistrap を使った sysroot の構築 + if platform.target.os == "ubuntu" and platform.target.arch == "armv8": + conf = os.path.join(BASE_DIR, "multistrap", f"{platform.target.package_name}.conf") + # conf ファイルのハッシュ値をバージョンとする + version_md5 = hashlib.md5(open(conf, "rb").read()).hexdigest() + install_rootfs_args = { + "version": version_md5, + "version_file": os.path.join(install_dir, "rootfs.version"), + "install_dir": install_dir, + "conf": conf, + } + install_rootfs(**install_rootfs_args) + # Android NDK if platform.target.os == "android": install_android_ndk_args = { @@ -300,10 +323,28 @@ def install_deps( "-D_LIBCPP_DISABLE_AVAILABILITY", "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE", "-nostdinc++", + "-std=gnu++17", f"-isystem{os.path.join(webrtc_info.libcxx_dir, 'include')}", "-fPIC", ] install_boost_args["toolset"] = "clang" + if platform.target.arch == "armv8": + sysroot = os.path.join(install_dir, "rootfs") + install_boost_args["cflags"] += [ + f"--sysroot={sysroot}", + "--target=aarch64-linux-gnu", + f"-I{os.path.join(sysroot, 'usr', 'include', 'aarch64-linux-gnu')}", + ] + install_boost_args["cxxflags"] += [ + f"--sysroot={sysroot}", + "--target=aarch64-linux-gnu", + f"-I{os.path.join(sysroot, 'usr', 'include', 'aarch64-linux-gnu')}", + ] + install_boost_args["linkflags"] += [ + f"-L{os.path.join(sysroot, 'usr', 'lib', 'aarch64-linux-gnu')}", + f"-B{os.path.join(sysroot, 'usr', 'lib', 'aarch64-linux-gnu')}", + ] + install_boost_args["architecture"] = "arm" build_and_install_boost(**install_boost_args) @@ -469,6 +510,7 @@ def install_deps( "ubuntu-20.04_x86_64", "ubuntu-22.04_x86_64", "ubuntu-24.04_x86_64", + "ubuntu-24.04_armv8", "ios", "android", ] @@ -498,6 +540,8 @@ def main(): platform = Platform("ubuntu", "22.04", "x86_64") elif args.target == "ubuntu-24.04_x86_64": platform = Platform("ubuntu", "24.04", "x86_64") + elif args.target == "ubuntu-24.04_armv8": + platform = Platform("ubuntu", "24.04", "armv8") elif args.target == "ios": platform = Platform("ios", None, None) elif args.target == "android": @@ -572,12 +616,20 @@ def main(): cmake_args.append("-DCMAKE_C_COMPILER=clang-18") cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") else: + sysroot = os.path.join(install_dir, "rootfs") cmake_args.append( f"-DCMAKE_C_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang'))}" ) cmake_args.append( f"-DCMAKE_CXX_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang++'))}" ) + cmake_args.append("-DCMAKE_SYSTEM_NAME=Linux") + cmake_args.append("-DCMAKE_SYSTEM_PROCESSOR=aarch64") + cmake_args.append(f"-DCMAKE_SYSROOT={sysroot}") + cmake_args.append("-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu") + cmake_args.append("-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu") + cmake_args.append(f"-DCMAKE_FIND_ROOT_PATH={sysroot}") + cmake_args.append("-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER") cmake_args.append("-DUSE_LIBCXX=ON") cmake_args.append( f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}" @@ -684,7 +736,7 @@ def main(): os.path.join(sora_build_dir, "bundled", "sora.lib"), os.path.join(install_dir, "sora", "lib", "sora.lib"), ) - elif platform.target.os == "ubuntu": + elif platform.target.os == "ubuntu" and platform.target.arch == "x86_64": shutil.copyfile( os.path.join(sora_build_dir, "bundled", "libsora.a"), os.path.join(install_dir, "sora", "lib", "libsora.a"), @@ -776,12 +828,23 @@ def main(): cmake_args.append("-DCMAKE_C_COMPILER=clang-18") cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") else: + sysroot = os.path.join(install_dir, "rootfs") cmake_args.append( f"-DCMAKE_C_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang'))}" ) cmake_args.append( f"-DCMAKE_CXX_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang++'))}" ) + cmake_args.append("-DCMAKE_SYSTEM_NAME=Linux") + cmake_args.append("-DCMAKE_SYSTEM_PROCESSOR=aarch64") + cmake_args.append(f"-DCMAKE_SYSROOT={sysroot}") + cmake_args.append("-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu") + cmake_args.append("-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu") + cmake_args.append(f"-DCMAKE_FIND_ROOT_PATH={sysroot}") + cmake_args.append("-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER") + cmake_args.append("-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH") + cmake_args.append("-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH") + cmake_args.append("-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH") cmake_args.append("-DUSE_LIBCXX=ON") cmake_args.append( f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}"