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

Ubuntu 24.04 armv8 に対応する #127

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
- @tnoho
- [ADD] ルート証明書を指定可能にする
- @melpon
- [ADD] Ubuntu 24.04 armv8 に対応する
- @melpon
- [FIX] HTTP Proxy 利用時の Websocket 初期化で insecure_ メンバ変数が初期化されていなかったのを修正
- @melpon

Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion buildbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand All @@ -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")
Expand Down
11 changes: 11 additions & 0 deletions multistrap/ubuntu-24.04_armv8.conf
Original file line number Diff line number Diff line change
@@ -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
65 changes: 64 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import hashlib
import logging
import multiprocessing
import os
Expand Down Expand Up @@ -31,6 +32,7 @@
install_cuda_windows,
install_llvm,
install_openh264,
install_rootfs,
install_vpl,
install_webrtc,
mkdir_p,
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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",
]
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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'))}"
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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'))}"
Expand Down