Attention is currently required from: Timur Davydov, laforge, neels.
Hello Jenkins Builder, fixeria, neels, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/41813?usp=email
to look at the new patch set (#11).
The following approvals got outdated and were removed: Verified+1 by Jenkins Builder
Change subject: Add Emscripten build support and JS callback logging backend ......................................................................
Add Emscripten build support and JS callback logging backend
This change enables building libosmocore for sandboxed, non-POSIX environments, specifically WebAssembly targets produced via the Emscripten toolchain.
The broader motivation is to allow partial execution of selected Osmocom components in isolated runtime environments where direct access to hardware and traditional operating system facilities (filesystem, sockets, privileged execution) is not available.
One intended use case is running a GSM 2G base station where the radio-facing components are executed inside a web environment, while the remaining Osmocom stack and core network components continue to run unchanged on a conventional backend server. In this model, highly stripped-down variants of osmo-bts and osmo-trx are built as static WebAssembly libraries and executed in the browser, while depending on core libraries such as libosmocore, libosmo-netif, and libosmo-abis.
A practical advantage of this approach is that no deployment or privileged setup is required on the radio endpoint side. A user can instantiate a radio endpoint with minimal configuration, while all stateful logic and operational complexity remains centralized on the backend. Multiple such radio endpoints may connect to the same backend core network, effectively forming a single logical network from the core network perspective, independent of the physical location of the radio endpoints.
Existing libosmocore build logic and platform assumptions rely on the availability of POSIX APIs and OS services which are not present in WebAssembly runtimes. This currently prevents libosmocore from being built for such targets without targeted, build-time adjustments. This patch introduces the minimal set of changes required to enable such builds, without affecting native platforms.
As part of this groundwork, a minimal callback-based logging hook is introduced. When building for Emscripten, this hook allows forwarding log messages to an external environment via a user-provided JavaScript callback. This enables integration with browser-side logging or UI infrastructure without introducing new logging backends or runtime dependencies. For all other build targets, the hook resolves to a no-op implementation and does not alter existing logging behavior.
No runtime behavior, protocol semantics, or network interactions are changed by this patch. All modifications are strictly limited to build-time and platform-specific code paths and are only active when targeting Emscripten. Native builds and existing deployment scenarios remain unaffected.
This patch is intended as groundwork. Follow-up changes, proposed separately and incrementally, may extend similar support to other Osmocom components such as libosmo-netif, libosmo-abis, osmo-bts, and osmo-trx, while keeping all such changes optional and isolated from native builds.
Change-Id: Ia8d5f4bb6570b5e055826f3a051e5e5896866e31 --- M .gitignore M configure.ac M include/osmocom/core/logging.h M src/core/Makefile.am M src/core/libosmocore.map A src/core/logging_emscripten.c M src/core/netdev.c M src/core/osmo_io_internal.h M src/core/stats_tcp.c M src/core/tun.c M src/vty/logging_vty.c 11 files changed, 189 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/41813/11