-
Notifications
You must be signed in to change notification settings - Fork 7
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
WebRTC を M121 に更新する #54
Changes from 16 commits
1790263
e329eca
1fc82be
1577a1e
4cd6858
d519122
01be8ce
0864183
8fa0fec
c763309
6f83209
7421e5f
291be2e
706d793
43ea5d3
108c476
c89cee7
3b18e8c
31fa477
4c214d1
03eb1f8
a215b95
be3a060
aec1aa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
## 背景 | ||
|
||
WebRTC を M121 に更新した際に以下のビルド・エラーが発生した | ||
|
||
``` | ||
error: use of undeclared identifier 'noinline'; did you mean 'inline' | ||
``` | ||
|
||
WebRTC に含まれる libcxx のバージョンが更新されたことが原因だと思われる | ||
|
||
## 対応 | ||
|
||
同様の問題を解消したと思われる LLVM の [PR](https://github.com/llvm/llvm-project-release-prs/pull/698) を調査したところ、 PR で追加されたファイルは存在するにも関わらず、問題が継続して発生していることがわかった | ||
(libcxx に bits/basic_string.h が含まれておらず、 cuda_wrappers 以下のファイルがインクルードされていないようだった) | ||
|
||
上記 PR を参考に、ファイルを直接修正したところエラーが解消したため、このヘッダー・ファイルをエラーが発生する箇所でインクルードすることにした | ||
オリジナルのパッチには push_macro や pop_macro が含まれているが、省いても問題が無かったため省略している | ||
|
||
*/ | ||
|
||
#undef __noinline__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,11 @@ | |
#define SORA_HWENC_NVCODEC_NVCODEC_DECODER_CUDA_H_ | ||
|
||
#include <memory> | ||
|
||
// clang-format off | ||
#include "sora/fix_cuda_noinline_macro_error.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
なので CUDA ソースの先頭で include して解消するかどうか確認して、それで済むならそうしておきたいです。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be3a060 で対応しました |
||
#include <string> | ||
// clang-format on | ||
|
||
#include "sora/cuda_context.h" | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||
import argparse | ||||
import multiprocessing | ||||
import hashlib | ||||
import glob | ||||
from typing import Callable, NamedTuple, Optional, List, Union, Dict | ||||
if platform.system() == 'Windows': | ||||
import winreg | ||||
|
@@ -351,6 +352,18 @@ def apply_patch(patch, dir, depth): | |||
with open(patch) as stdin: | ||||
cmd(['patch', f'-p{depth}'], stdin=stdin) | ||||
|
||||
# NOTE(enm10k): shutil.copytree に Python 3.8 で追加された dirs_exist_ok=True を指定して使いたかったが、 GitHub Actions の Windows のランナー (widnwos-2019) にインストールされている Python のバージョンが古くて利用できなかった | ||||
# actions/setup-python で Python 3.8 を設定してビルドしたところ、 Lyra のビルドがエラーになったためこの関数を自作した | ||||
# Windows のランナーを更新した場合は、この関数は不要になる可能性が高い | ||||
def copytree(src_dir, dst_dir): | ||||
for file_path in glob.glob(src_dir + '/**', recursive=True): | ||||
dest_path = os.path.join(dst_dir, os.path.relpath(file_path, src_dir)) | ||||
|
||||
if os.path.isdir(file_path): | ||||
os.makedirs(dest_path, exist_ok=True) | ||||
else: | ||||
shutil.copy2(file_path, dest_path) | ||||
|
||||
|
||||
@versioned | ||||
def install_webrtc(version, source_dir, install_dir, platform: str): | ||||
|
@@ -699,8 +712,8 @@ def install_bazel(version, source_dir, install_dir, platform: str): | |||
def install_cuda_windows(version, source_dir, build_dir, install_dir): | ||||
rm_rf(os.path.join(build_dir, 'cuda')) | ||||
rm_rf(os.path.join(install_dir, 'cuda')) | ||||
if version == '10.2.89-1': | ||||
url = 'http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_441.22_win10.exe' # noqa: E501 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 以前のバージョンの URL は残しておいてあげても良さそう There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 残すことにしました |
||||
if version == '11.8': | ||||
url = 'https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_522.06_windows.exe' # noqa: E501 | ||||
else: | ||||
raise f'Unknown CUDA version {version}' | ||||
file = download(url, source_dir) | ||||
|
@@ -709,7 +722,8 @@ def install_cuda_windows(version, source_dir, build_dir, install_dir): | |||
mkdir_p(os.path.join(install_dir, 'cuda')) | ||||
with cd(os.path.join(build_dir, 'cuda')): | ||||
cmd(['7z', 'x', file]) | ||||
os.rename(os.path.join(build_dir, 'cuda', 'nvcc'), os.path.join(install_dir, 'cuda', 'nvcc')) | ||||
copytree(os.path.join(build_dir, 'cuda', 'cuda_nvcc', 'nvcc'), os.path.join(install_dir, 'cuda')) | ||||
copytree(os.path.join(build_dir, 'cuda', 'cuda_cudart', 'cudart'), os.path.join(install_dir, 'cuda')) | ||||
|
||||
|
||||
@versioned | ||||
|
@@ -1272,6 +1286,7 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
'-D_LIBCPP_ABI_NAMESPACE=Cr', | ||||
'-D_LIBCPP_ABI_VERSION=2', | ||||
'-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')}", | ||||
|
@@ -1298,6 +1313,7 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
'-D_LIBCPP_ABI_NAMESPACE=Cr', | ||||
'-D_LIBCPP_ABI_VERSION=2', | ||||
'-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')}", | ||||
|
@@ -1315,6 +1331,7 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
'-D_LIBCPP_ABI_NAMESPACE=Cr', | ||||
'-D_LIBCPP_ABI_VERSION=2', | ||||
'-D_LIBCPP_DISABLE_AVAILABILITY', | ||||
'-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE', | ||||
'-nostdinc++', | ||||
f"-isystem{os.path.join(webrtc_info.libcxx_dir, 'include')}", | ||||
'-fPIC', | ||||
|
@@ -1403,14 +1420,15 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
install_vpl_args['cmake_args'].append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'ubuntu': | ||||
cmake_args = [] | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-15") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-15") | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-18") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") | ||||
path = cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include')) | ||||
cmake_args.append(f"-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES={path}") | ||||
flags = [ | ||||
'-nostdinc++', '-D_LIBCPP_ABI_NAMESPACE=Cr', '-D_LIBCPP_ABI_VERSION=2', | ||||
'-D_LIBCPP_DISABLE_AVAILABILITY', '-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS', | ||||
'-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS', '-D_LIBCPP_ENABLE_NODISCARD'] | ||||
'-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS', '-D_LIBCPP_ENABLE_NODISCARD', | ||||
'-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(flags)}") | ||||
install_vpl_args['cmake_args'] += cmake_args | ||||
install_vpl(**install_vpl_args) | ||||
|
@@ -1481,16 +1499,17 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
cmake_args.append(f'-DCMAKE_SYSROOT={sysroot}') | ||||
if platform.target.os == 'ubuntu': | ||||
if platform.target.package_name in ('ubuntu-20.04_x86_64', 'ubuntu-22.04_x86_64'): | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-15") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-15") | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-18") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") | ||||
else: | ||||
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++'))}") | ||||
path = cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include')) | ||||
cmake_args.append(f"-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES={path}") | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(['-nostdinc++'])}") | ||||
cxxflags = ['-nostdinc++', '-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'jetson': | ||||
sysroot = os.path.join(install_dir, 'rootfs') | ||||
cmake_args.append('-DCMAKE_SYSTEM_NAME=Linux') | ||||
|
@@ -1509,7 +1528,8 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
cmake_args.append('-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH') | ||||
path = cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include')) | ||||
cmake_args.append(f"-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES={path}") | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(['-nostdinc++'])}") | ||||
cxxflags = ['-nostdinc++', '-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'ios': | ||||
cmake_args += ['-G', 'Xcode'] | ||||
cmake_args.append("-DCMAKE_SYSTEM_NAME=iOS") | ||||
|
@@ -1532,7 +1552,8 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug, | |||
# https://github.com/android/ndk/issues/1618 | ||||
cmake_args.append('-DCMAKE_ANDROID_EXCEPTIONS=ON') | ||||
cmake_args.append('-DANDROID_NDK=OFF') | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(['-nostdinc++'])}") | ||||
cxxflags = ['-nostdinc++', '-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
install_blend2d_args['cmake_args'] = cmake_args | ||||
install_blend2d(**install_blend2d_args) | ||||
|
||||
|
@@ -1636,8 +1657,8 @@ def main(): | |||
cmake_args.append(f'-DCMAKE_SYSTEM_VERSION={WINDOWS_SDK_VERSION}') | ||||
if platform.target.os == 'ubuntu': | ||||
if platform.target.package_name in ('ubuntu-20.04_x86_64', 'ubuntu-22.04_x86_64'): | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-15") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-15") | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-18") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") | ||||
else: | ||||
cmake_args.append( | ||||
f"-DCMAKE_C_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang'))}") | ||||
|
@@ -1646,6 +1667,8 @@ def main(): | |||
cmake_args.append("-DUSE_LIBCXX=ON") | ||||
cmake_args.append( | ||||
f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}") | ||||
cxxflags = ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'macos': | ||||
sysroot = cmdcap(['xcrun', '--sdk', 'macosx', '--show-sdk-path']) | ||||
target = 'x86_64-apple-darwin' if platform.target.arch == 'x86_64' else 'aarch64-apple-darwin' | ||||
|
@@ -1678,6 +1701,8 @@ def main(): | |||
cmake_args.append('-DCMAKE_ANDROID_EXCEPTIONS=ON') | ||||
cmake_args.append('-DANDROID_NDK=OFF') | ||||
cmake_args.append(f"-DSORA_WEBRTC_LDFLAGS={os.path.join(install_dir, 'webrtc.ldflags')}") | ||||
cxxflags = ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'jetson': | ||||
sysroot = os.path.join(install_dir, 'rootfs') | ||||
cmake_args.append('-DCMAKE_SYSTEM_NAME=Linux') | ||||
|
@@ -1694,12 +1719,14 @@ def main(): | |||
cmake_args.append( | ||||
f"-DCMAKE_CXX_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang++'))}") | ||||
cmake_args.append('-DUSE_JETSON_ENCODER=ON') | ||||
cxxflags = ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
|
||||
# NvCodec | ||||
if platform.target.os in ('windows', 'ubuntu') and platform.target.arch == 'x86_64': | ||||
cmake_args.append('-DUSE_NVCODEC_ENCODER=ON') | ||||
if platform.target.os == 'windows': | ||||
cmake_args.append(f"-DCUDA_TOOLKIT_ROOT_DIR={cmake_path(os.path.join(install_dir, 'cuda', 'nvcc'))}") | ||||
cmake_args.append(f"-DCUDA_TOOLKIT_ROOT_DIR={cmake_path(os.path.join(install_dir, 'cuda'))}") | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvcc ディレクトリが消えると sora-cpp-sdk/.github/workflows/build.yml Line 54 in a37a764
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. キャッシュのパスを修正しました |
||||
|
||||
if platform.target.os in ('windows', 'ubuntu') and platform.target.arch == 'x86_64': | ||||
cmake_args.append('-DUSE_VPL_ENCODER=ON') | ||||
|
@@ -1792,8 +1819,8 @@ def main(): | |||
cmake_args.append(f'-DCMAKE_SYSROOT={sysroot}') | ||||
if platform.target.os == 'ubuntu': | ||||
if platform.target.package_name in ('ubuntu-20.04_x86_64', 'ubuntu-22.04_x86_64'): | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-15") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-15") | ||||
cmake_args.append("-DCMAKE_C_COMPILER=clang-18") | ||||
cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") | ||||
else: | ||||
cmake_args.append( | ||||
f"-DCMAKE_C_COMPILER={cmake_path(os.path.join(webrtc_info.clang_dir, 'bin', 'clang'))}") | ||||
|
@@ -1802,6 +1829,8 @@ def main(): | |||
cmake_args.append("-DUSE_LIBCXX=ON") | ||||
cmake_args.append( | ||||
f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}") | ||||
cxxflags = ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
if platform.target.os == 'jetson': | ||||
sysroot = os.path.join(install_dir, 'rootfs') | ||||
cmake_args.append('-DJETSON=ON') | ||||
|
@@ -1822,6 +1851,8 @@ def main(): | |||
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++'))}") | ||||
cxxflags = ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE'] | ||||
cmake_args.append(f"-DCMAKE_CXX_FLAGS={' '.join(cxxflags)}") | ||||
|
||||
if platform.target.os in ('windows', 'macos', 'ubuntu'): | ||||
cmake_args.append("-DTEST_CONNECT_DISCONNECT=ON") | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これは以前からそうだったはずです。リリースビルドだと気が付かないから放置されてただけで。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。
CHANGES.md から記述を削除しました。