Builds onnxruntime (C API, full operator set — any model works, CPU provider only)
for anira. ONNX Runtime ships only shared
libs upstream, so static is built from source (no op-reduction — every operator
ships); shared is built for macOS but repackaged from Microsoft's prebuilts
elsewhere. A WASM (Emscripten) static lib is built from source too — for anira
compiled to WebAssembly.
| File | Purpose |
|---|---|
VERSION |
Pinned upstream version (single source of truth) |
build-ort.sh |
Per-target build via onnxruntime's tools/ci_build/build.py |
repackage-shared.sh |
Restage upstream prebuilt shared libs (Linux/Win/Android) |
stage.sh |
Build/repackage + bundle, staged into the install prefix (orchestrator + CI) |
ios.sh |
Build device+sim → .xcframework (+ simulator smoke) |
include/ |
Vendored ONNX Runtime C/C++ API headers |
test/CMakeLists.txt |
CMake smoke consumer (imported target; run via the smoke action / ctest) |
test/smoke.cpp |
Forward-pass smoke (add.onnx, y = x + x → {2,4,6}) |
test/add.onnx |
Tiny model the smoke runs |
- Windows: Ninja + cl, not build.py's default
Visual Studio 17 2022generator — the runner images ship VS 18, which that generator can't find ("could not find any instance of Visual Studio"). Ninja+cl is VS-version agnostic. - Windows arm64:
onnxruntime_USE_KLEIDIAI=OFF+onnxruntime_USE_SVE=OFF— their.Smatmul microkernels are assembled byarmasm64.exe, which rejects/arch:armv8.2(error A2029). Other arm64 targets (clang) keep them. - re2 force-build. onnxruntime include-attaches re2 (
EXCLUDE_FROM_ALL) but never links it on desktop, so a normal build doesn't compile it → the static bundle missesre2::RE2. We build there2target afterbuild.py(with Ninja it builds by name) and force it from source everywhere withCMAKE_DISABLE_FIND_PACKAGE_re2=ON. onnxruntime_ENABLE_MEMLEAK_CHECKER=OFFforDebug— else it aborts at clean exit over onnxruntime's never-freed singletons.onnxruntime_ENABLE_LTO=OFF— pins MSVC/GL+/LTCGoff (the ort-builder LTCG-patch effect; the literal patch no longer applies to 1.26).- Bundle exclude narrowed to
/testdata/+libprotobuf/libprotoc(build-time only; onnxruntime runs on protobuf-lite). - Smoke linking (in
test/CMakeLists.txt): Windows static needs the matching CRT (/MD|/MDd) +advapi32+ucrt[d], and the/MDdrun needs the non-redist debug CRT DLLs next to the exe; macOS needs-framework Foundation -framework CoreFoundation; Linux needsrt/dl/m. - iOS
build.pyflag is--apple_sysroot(renamed from--ios_sysrootin 1.26). - WASM (
build-ort.sh wasm):--build_wasm_static_libbuilds one self-containedlibonnxruntime_webassembly.a(all deps bundled bybundle_static_libraryviaemar) — so the wasm leg skips the re2 force-build andbundle-static.sh;stage.shjust renames it tolibonnxruntime.a. Built with--enable_wasm_simd --enable_wasm_threads --disable_rtti(the ort-builder recipe).build.pyinstalls+activates its own pinned emsdk 4.0.23 from thecmake/external/emsdksubmodule (init'd inbuild-ort.sh) — no external emsdk needed. Threads ⇒ the consuming wasm app must link-pthreadand be served cross-origin-isolated (COOP/COEP). The CI smoke links the test against the.awithem++(proving the archive is symbol-complete — the Android arm64 compile+link gate). A forward-pass run belongs in a cross-origin-isolated browser, not headless Node (the threaded module aborts atEnvinit in Node's proxy worker), so it isn't part of the gate.
# from this directory
bash build-ort.sh macos arm64 Release build # <platform> <arch> <config> <build-dir> [kind]
bash build-ort.sh macos arm64 Release build shared # shared variant (libonnxruntime.dylib)
bash build-ort.sh wasm wasm32 Release build # WASM static lib (needs emsdk submodule)
bash ../../scripts/bundle-static.sh build/Release /tmp/out/lib/libonnxruntime.a # static only (not wasm)