Skip to content

Commit 3ca5b93

Browse files
authored
Merge pull request #117 from artiz/claude/docs-consistency-sweep
Claude/docs consistency sweep
2 parents f2f725a + 42fd7c3 commit 3ca5b93

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,61 @@ CUDA 12 runtime + cuDNN 9 on the machine; the `ort` crate downloads the
572572
matching ONNX Runtime binaries at build time and copies the provider
573573
libraries next to the binary.
574574

575+
> **Link fails with `undefined symbol: __isoc23_strtol` (Ubuntu ≤ 22.04,
576+
> Debian ≤ 12)?** The static ONNX Runtime binaries `ort` downloads are built
577+
> against glibc ≥ 2.38 (`__isoc23_*` first appears there). On an older glibc,
578+
> link dynamically against Microsoft's official release instead (built on
579+
> glibc 2.28, so it runs anywhere recent) — same ONNX Runtime version the
580+
> pinned `ort` expects:
581+
>
582+
> ```bash
583+
> curl -fLO https://github.com/microsoft/onnxruntime/releases/download/v1.24.2/onnxruntime-linux-x64-gpu-1.24.2.tgz
584+
> tar xf onnxruntime-linux-x64-gpu-1.24.2.tgz
585+
> export ORT_LIB_LOCATION=$PWD/onnxruntime-linux-x64-gpu-1.24.2/lib
586+
> export ORT_PREFER_DYNAMIC_LINK=1
587+
> cargo build --release -p docling-cli --features cuda
588+
> # dynamic linking: libonnxruntime.so must be findable at runtime, too
589+
> export LD_LIBRARY_PATH=$ORT_LIB_LOCATION:$LD_LIBRARY_PATH
590+
> ```
591+
>
592+
> (`ort-sys` re-runs on these env changes — no `cargo clean` needed.)
593+
>
594+
> The alternative is a newer glibc itself. There is no safe way to upgrade
595+
> *only* glibc on a stable distro — every binary on the system links it, no
596+
> backports exist, and installing a 24.04 `.deb` on 22.04 is the classic way
597+
> to get a machine that no longer boots (`ls` and `apt` need glibc too). The
598+
> real options, honest to hacky:
599+
>
600+
> 1. **Upgrade the distro** — this *is* "upgrading glibc":
601+
> `sudo do-release-upgrade` (22.04 → 24.04 ships glibc 2.39). The only way
602+
> to get it system-wide; afterwards the static binaries link as-is.
603+
> 2. **Build in a newer-glibc container** (when the OS must stay put):
604+
> ```bash
605+
> docker run --rm -it --gpus all -v $PWD:/w -w /w \
606+
> nvidia/cuda:12.6.2-cudnn-devel-ubuntu24.04 bash
607+
> # inside: apt-get update && apt-get install -y curl build-essential
608+
> # curl https://sh.rustup.rs -sSf | sh -s -- -y && . ~/.cargo/env
609+
> # cargo build --release -p docling-cli --features cuda
610+
> ```
611+
> Mind that the produced binary then needs glibc ≥ 2.38 **at runtime
612+
> too** — run it in the same (or a same-based) image.
613+
> 3. **A parallel glibc under `/opt`** (last resort — works, but every run
614+
> depends on the rpath below):
615+
> ```bash
616+
> curl -fLO https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.xz && tar xf glibc-2.39.tar.xz
617+
> mkdir glibc-build && cd glibc-build
618+
> ../glibc-2.39/configure --prefix=/opt/glibc-2.39 && make -j$(nproc) && sudo make install
619+
> ```
620+
> The system glibc is untouched; link the build against the parallel one:
621+
> ```bash
622+
> export RUSTFLAGS="-C link-arg=-Wl,--dynamic-linker=/opt/glibc-2.39/lib/ld-linux-x86-64.so.2 \
623+
> -C link-arg=-Wl,-rpath,/opt/glibc-2.39/lib"
624+
> cargo build --release -p docling-cli --features cuda
625+
> ```
626+
> The binary resolves glibc from `/opt` and everything else (libstdc++,
627+
> CUDA) from the system — correct, since glibc is backwards-compatible,
628+
> but fragile: anything run without that interpreter/rpath fails cryptically.
629+
575630
Then either:
576631
577632
```bash

0 commit comments

Comments
 (0)