Repository navigation
Proper Linux compiler support/documentation #303
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
Changes from all commits
c6b24e6
078ed9c
9f41d97
14b2ef1
a9b98b0
6cb4a4a
9e995cf
ccd9d6c
5441bdb
8999525
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 |
|---|---|---|
|
|
@@ -43,25 +43,37 @@ runs: | |
| fi | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| build-essential cmake ninja-build pkg-config \ | ||
| llvm-dev libclang-dev clang \ | ||
| build-essential cmake ninja-build pkg-config git git-lfs curl \ | ||
| libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \ | ||
| libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \ | ||
| libxrandr-dev libxi-dev libxkbcommon-dev \ | ||
| libasound2-dev libpulse-dev \ | ||
| libssl-dev \ | ||
| libprotobuf-dev protobuf-compiler \ | ||
| libabsl-dev \ | ||
| libcurl4-openssl-dev \ | ||
| libglib2.0-dev libssl-dev libcurl4-openssl-dev \ | ||
| libwayland-dev libdecor-0-dev \ | ||
| wget ca-certificates gnupg lsb-release \ | ||
| "${extra_packages[@]}" | ||
|
|
||
| # libwebrtc ships hermetic libc++ headers that require a newer clang than | ||
| # Ubuntu provides. The submodule script exports CC/CXX for later steps. | ||
| - name: Install clang for libwebrtc | ||
| - name: Install Clang 21 | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: client-sdk-rust/.github/scripts/install-clang.sh | ||
|
Collaborator
Author
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. Context: this one upstream downloads a ton more than we need, this was taking a few minutes in CI. The below list is the subset of things we need. I may advocate for moving the upstream script to do this eventually |
||
| run: | | ||
| set -eux | ||
| sudo install -m 0755 -d /etc/apt/keyrings | ||
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \ | ||
| | sudo tee /etc/apt/keyrings/llvm.asc >/dev/null | ||
| sudo chmod a+r /etc/apt/keyrings/llvm.asc | ||
| codename=$(lsb_release -cs) | ||
| echo "deb [signed-by=/etc/apt/keyrings/llvm.asc] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-21 main" \ | ||
| | sudo tee /etc/apt/sources.list.d/llvm-21.list >/dev/null | ||
| sudo apt-get update | ||
| sudo apt-get install -y clang-21 | ||
|
alan-george-lk marked this conversation as resolved.
Resolved
|
||
|
|
||
| source scripts/setup-linux-toolchain.sh | ||
| { | ||
| echo "CC=$CC" | ||
| echo "CXX=$CXX" | ||
| echo "LIBCLANG_PATH=$LIBCLANG_PATH" | ||
| } >> "$GITHUB_ENV" | ||
|
|
||
| - name: Install base deps (macOS) | ||
| if: runner.os == 'macOS' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,28 @@ detect_os() { | |
|
|
||
| OS_TYPE="$(detect_os)" | ||
|
|
||
| configure_macos_toolchain() { | ||
|
Collaborator
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. just want to make sure, is this needed for this linux clang thing? or some other improvement ? and it seems configure_macos_toolchain() unconditionally overwrites CC/CXX with the xcrun paths, whereas the Linux path honors pre-set CC/CXX (setup-linux-toolchain.sh:70-79).
Collaborator
Author
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. This is mildly related to the Linux work but not directly. We can remove this if you prefer, but the idea was given our docs callout Xcode's installation of Clang, we should do some hardening to find the toolchain in Happy to adjust direction here/or remove it, thoughts? |
||
| if ! command -v xcrun >/dev/null 2>&1; then | ||
| echo "ERROR: xcrun is unavailable. Install Xcode Command Line Tools." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| CC="$(xcrun --find clang)" | ||
| CXX="$(xcrun --find clang++)" | ||
| export CC CXX | ||
|
alan-george-lk marked this conversation as resolved.
Resolved
|
||
|
|
||
| echo "==> macOS compiler: $("${CXX}" --version | awk 'NR == 1 { print; exit }')" | ||
| echo "==> CC=${CC}" | ||
| echo "==> CXX=${CXX}" | ||
| } | ||
|
|
||
| configure_build_toolchain() { | ||
| case "${OS_TYPE}" in | ||
| linux) source "${PROJECT_ROOT}/scripts/setup-linux-toolchain.sh" ;; | ||
| macos) configure_macos_toolchain ;; | ||
| esac | ||
| } | ||
|
|
||
| usage() { | ||
| cat <<EOF | ||
| Usage: | ||
|
|
@@ -94,6 +116,22 @@ validate_capture_value() { | |
| done | ||
| } | ||
|
|
||
| canonicalize_path() { | ||
| local path="$1" | ||
| local resolved directory | ||
|
|
||
| if resolved="$(readlink -f "${path}" 2>/dev/null)" && [[ -n "${resolved}" ]]; then | ||
| printf '%s\n' "${resolved}" | ||
| return | ||
| fi | ||
|
|
||
| if directory="$(cd "$(dirname "${path}")" 2>/dev/null && pwd -P)"; then | ||
| printf '%s/%s\n' "${directory}" "$(basename "${path}")" | ||
| else | ||
| printf '%s\n' "${path}" | ||
| fi | ||
| } | ||
|
|
||
| parse_opts() { | ||
| shift || true | ||
| while [[ $# -gt 0 ]]; do | ||
|
|
@@ -174,6 +212,26 @@ parse_opts() { | |
| } | ||
|
|
||
| configure() { | ||
| if [[ -f "${BUILD_DIR}/CMakeCache.txt" ]]; then | ||
| local cached_cc cached_cxx selected_cc selected_cxx | ||
| cached_cc="$(awk -F= '$1 == "CMAKE_C_COMPILER:FILEPATH" { print $2; exit }' \ | ||
| "${BUILD_DIR}/CMakeCache.txt")" | ||
| cached_cxx="$(awk -F= '$1 == "CMAKE_CXX_COMPILER:FILEPATH" { print $2; exit }' \ | ||
| "${BUILD_DIR}/CMakeCache.txt")" | ||
| selected_cc="$(canonicalize_path "${CC}")" | ||
| selected_cxx="$(canonicalize_path "${CXX}")" | ||
| if [[ -n "${cached_cc}" && "$(canonicalize_path "${cached_cc}")" != "${selected_cc}" ]] \ | ||
| || [[ -n "${cached_cxx}" && "$(canonicalize_path "${cached_cxx}")" != "${selected_cxx}" ]]; then | ||
| echo "ERROR: ${BUILD_DIR} was configured with a different compiler:" >&2 | ||
| echo " cached CC=${cached_cc}" >&2 | ||
| echo " cached CXX=${cached_cxx}" >&2 | ||
| echo " selected CC=${CC}" >&2 | ||
| echo " selected CXX=${CXX}" >&2 | ||
| echo "Run './build.sh clean' and retry." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "==> Configuring CMake (${BUILD_TYPE}) using preset ${PRESET}..." | ||
| local -a extra_args=("-DLIVEKIT_CAPTURE=${CAPTURE_OVERRIDE}") | ||
| if [[ -n "${LIVEKIT_VERSION}" ]]; then | ||
|
|
@@ -351,6 +409,8 @@ clean() { | |
| else | ||
| echo " (skipping) Unknown build system or not configured" | ||
| fi | ||
| rm -f "${debug_dir}/CMakeCache.txt" | ||
| rm -rf "${debug_dir}/CMakeFiles" | ||
| else | ||
| echo " (skipping) build-debug does not exist." | ||
| fi | ||
|
|
@@ -365,6 +425,8 @@ clean() { | |
| else | ||
| echo " (skipping) Unknown build system or not configured" | ||
| fi | ||
| rm -f "${release_dir}/CMakeCache.txt" | ||
| rm -rf "${release_dir}/CMakeFiles" | ||
| else | ||
| echo " (skipping) build-release does not exist." | ||
| fi | ||
|
|
@@ -400,6 +462,11 @@ fi | |
|
|
||
| cmd="$1" | ||
| parse_opts "$@" | ||
| case "${cmd}" in | ||
| debug|debug-examples|debug-tests|debug-all|release|release-examples|release-tests|release-all|build-all) | ||
| configure_build_toolchain | ||
| ;; | ||
| esac | ||
| case "${cmd}" in | ||
| debug) | ||
| BUILD_TYPE="Debug" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.