Skip to content

Commit e57a238

Browse files
SamoraDCclaude
andcommitted
fix: add g++ and libstdc++6 for ONNX Runtime linking
- Add g++ to rust-builder stage for libstdc++ linking - Add libstdc++6 to runtime stage for ONNX Runtime execution - Fix LD_LIBRARY_PATH to avoid undefined variable warnings - Remove variable expansion that caused Docker warnings Fixes: cannot find -lstdc++: No such file or directory Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b5e482 commit e57a238

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
FROM rust:1.85-slim-bookworm AS rust-builder
1010

1111
# Install build dependencies + ONNX Runtime
12+
# CRITICAL: g++ is required for libstdc++ linking (ONNX Runtime dependency)
1213
RUN apt-get update && apt-get install -y \
1314
pkg-config \
1415
libssl-dev \
1516
curl \
1617
ca-certificates \
18+
g++ \
1719
&& rm -rf /var/lib/apt/lists/*
1820

1921
# Download and install ONNX Runtime for building
@@ -23,8 +25,9 @@ RUN curl -L https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VE
2325
&& tar -xzf /tmp/onnxruntime.tgz -C /opt \
2426
&& rm /tmp/onnxruntime.tgz
2527

26-
ENV ORT_LIB_LOCATION=/opt/onnxruntime-linux-x64-${ORT_VERSION}
27-
ENV LD_LIBRARY_PATH=/opt/onnxruntime-linux-x64-${ORT_VERSION}/lib:$LD_LIBRARY_PATH
28+
# Set ONNX Runtime paths for building
29+
ENV ORT_LIB_LOCATION=/opt/onnxruntime-linux-x64-1.19.2
30+
ENV LD_LIBRARY_PATH=/opt/onnxruntime-linux-x64-1.19.2/lib
2831

2932
WORKDIR /app/market-data
3033

@@ -85,16 +88,20 @@ RUN eval $(opam env) && dune build --release
8588
FROM debian:bookworm-slim AS runtime
8689

8790
# Install runtime dependencies (minimal - no Python)
91+
# CRITICAL: libstdc++6 is required for ONNX Runtime at runtime
8892
RUN apt-get update && apt-get install -y \
8993
libssl3 \
9094
ca-certificates \
9195
curl \
9296
supervisor \
97+
libstdc++6 \
9398
&& rm -rf /var/lib/apt/lists/*
9499

95100
# Copy ONNX Runtime libraries for inference
96101
COPY --from=rust-builder /opt/onnxruntime-linux-x64-1.19.2/lib /opt/onnxruntime/lib
97-
ENV LD_LIBRARY_PATH=/opt/onnxruntime/lib:$LD_LIBRARY_PATH
102+
103+
# Set LD_LIBRARY_PATH for ONNX Runtime
104+
ENV LD_LIBRARY_PATH=/opt/onnxruntime/lib
98105

99106
WORKDIR /app
100107

0 commit comments

Comments
 (0)