Skip to content

feat: support building for 32-bit ARM Linux (linux-arm)#1245

Closed
ibrahim-mubarak wants to merge 2 commits into
livekit:mainfrom
Tohands-Private-Limited:feat/linux-arm32-support
Closed

feat: support building for 32-bit ARM Linux (linux-arm)#1245
ibrahim-mubarak wants to merge 2 commits into
livekit:mainfrom
Tohands-Private-Limited:feat/linux-arm32-support

Conversation

@ibrahim-mubarak

Copy link
Copy Markdown

What

Adds support for building the SDK for 32-bit ARM Linux (armv7-unknown-linux-gnueabihf, i.e. linux-arm), targeting armv7-a + NEON hard-float as a baseline — which also covers armv8 cores running in AArch32 mode (e.g. Cortex-A32/A35 embedded SoCs).

There are no prebuilt linux-arm webrtc artifacts, so consumers build libwebrtc from source and point LK_CUSTOM_WEBRTC at it:

cd webrtc-sys/libwebrtc
./build_linux.sh --arch arm --profile release
# artifacts land in linux-arm-release/

Changes

  • webrtc-sys/libwebrtc/build_linux.sh
    • accept --arch arm; sets arm_float_abi="hard" and arm_use_neon=true (armv7+NEON baseline, same config as the other Linux builds otherwise — X11/PipeWire stay enabled, they are lazy-loaded/dlopen'd at runtime).
    • new optional CLANG_BASE_PATH env: Chromium only publishes x86-64 Linux clang binaries, so on other build hosts (e.g. aarch64) you can point this at a matching LLVM release; it is passed as clang_base_path to gn and its llvm-objcopy is used for the boringssl symbol prefixing step.
  • webrtc-sys/build.rs
    • add_gio_headers: map armdebian_bullseye_armhf-sysroot / arm-linux-gnueabihf.
    • add_lazy_load_so: select a new arm-linux-gnueabihf trampoline directory for arm.
  • webrtc-sys/src/lazy_load_deps_for/desktop_capturer/arm-linux-gnueabihf/: Implib.so-generated trampolines for the desktop-capturer X11/drm/gbm libraries (generated with implib-gen.py --target armhf against the Debian bullseye armhf sysroot libs, same procedure as the existing x86_64/aarch64 files).
  • webrtc-sys/src/video_decoder_factory.cpp: guard the AV1 format advertisement with RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY. It calls LibaomAv1EncoderSupportedScalabilityModes(), which is undefined in webrtc builds configured without AV1 (enable_libaom=false, dav1d factory off) — useful for footprint-constrained embedded builds. No change for default builds.
  • yuv-sys/build.rs: mark YuvConstants as an opaque type for bindgen. Its SIMD vector members give it an alignment bindgen cannot mirror on 32-bit ARM (the generated layout test fails with align 2 vs 8); it is only ever passed by pointer from Rust.

Testing

  • Built libwebrtc linux-arm-release from source (webrtc-sdk/webrtc @ m144_release, commit aaeeee80…751ef663 matching the webrtc-51ef663 tag) on an aarch64 Fedora host with LLVM 22.1.8 via CLANG_BASE_PATH.
  • cargo build -p livekit-ffi --release --target armv7-unknown-linux-gnueabihf succeeds against it (cross gcc 13.4, glibc 2.39 sysroot); also verified a codec-reduced webrtc build (no AV1/H26x/VP9) links cleanly with the factory guard.
  • Resulting liblivekit_ffi.so is a clean 32-bit ARM EABI5 hard-float object whose only hard deps are libc/libm/libstdc++/libgcc.
  • Verified on an embedded (Realtek Cortex-A32) sysroot under qemu-arm against livekit-server v1.13.3: SDK unit suite 332/332; integration suite (rooms, VP8 media multistream, data tracks, RPC, session stats) passes except one pre-existing large-frame data-track case that fails identically on aarch64 with the official prebuilts.
  • A companion PR to client-sdk-cpp adds the CMake-side cross-compilation support.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L4fDRyTiTphQnidL2Myptq

ibrahim-mubarak and others added 2 commits July 4, 2026 16:02
Adds an 'arm' arch to the libwebrtc linux build (armv7-a + NEON
hard-float baseline, also runs on armv8 AArch32 cores) and makes the
webrtc-sys / yuv-sys crates build for armv7-unknown-linux-gnueabihf:

- build_linux.sh: accept --arch arm; set arm_float_abi=hard and
  arm_use_neon. Also allow overriding the Chromium clang with
  CLANG_BASE_PATH for hosts Chromium ships no clang for (e.g.
  aarch64 linux), and use its llvm-objcopy for symbol prefixing.
- webrtc-sys/build.rs: map arm to the debian_bullseye_armhf sysroot
  for gio headers and to a new arm-linux-gnueabihf lazy-load dir.
- lazy_load_deps_for: add Implib.so-generated trampolines for the
  desktop-capturer X11/drm/gbm libraries on arm-linux-gnueabihf.
- yuv-sys: make YuvConstants opaque in bindgen; its SIMD alignment
  cannot be mirrored on 32-bit ARM and it is only passed by pointer.

There are no prebuilt linux-arm webrtc artifacts; consumers build
libwebrtc with build_linux.sh --arch arm and point LK_CUSTOM_WEBRTC
at the resulting linux-arm-release directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L4fDRyTiTphQnidL2Myptq
VideoDecoderFactory::GetSupportedFormats unconditionally advertised
AV1 via LibaomAv1EncoderSupportedScalabilityModes(), which is defined
in the libaom encoder object. In a libwebrtc build with
enable_libaom=false and rtc_include_dav1d_in_internal_decoder_factory
=false this leaves an undefined symbol in liblivekit_ffi. Guard the
advertisement with RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY, matching
the decoder's actual availability. No change for default builds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L4fDRyTiTphQnidL2Myptq
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@ibrahim-mubarak

Copy link
Copy Markdown
Author

Closing — will iterate on our fork first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants