指点成金-最美分享吧

登录

GLIBC_2.29 not found

佚名 举报

篇首语:本文由小编为大家整理,主要介绍了GLIBC_2.29 not found相关的知识,希望对你有一定的参考价值。

GLIBC_2.29 not found

(Jin Qing’s Column, Nov. 4, 2021)

My Rust program failed when running in docker:

root@a26b49c91efb:/myapp# ldd libmyapp_py.so./libmyapp_py.so: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29" not found (required by ./libmyapp_py.so)

The problem is because I build in “rust:1.56”, and run in “debian:buster-slim” which is quite old. Run dpkg -l libc-bin shows the libc version is 2.28:

C:\Users\jinqing01>docker run debian:buster-slim dpkg -l libc-binUnable to find image "debian:buster-slim" locallybuster-slim: Pulling from library/debianb380bbd43752: Already existsDigest: sha256:544c93597c784cf68dbe492ef35c00de7f4f6a990955c7144a40b20d86a3475fStatus: Downloaded newer image for debian:buster-slimDesired=Unknown/Install/Remove/Purge/Hold| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)||/ Name           Version      Architecture Description+++-==============-============-============-=================================ii  libc-bin       2.28-10      amd64        GNU C Library: Binaries

Using the latest “debian:bookworm-slim” solved the problem.

Dockerfile:

FROM rust:1.56 as chefRUN cargo install cargo-chefWORKDIR /myappFROM chef AS plannerCOPY . .RUN cargo chef prepare --recipe-path recipe.jsonFROM chef AS builderCOPY --from=planner /myapp/recipe.json recipe.json# Build dependenciesRUN cargo chef cook --release --recipe-path recipe.json# Build applicationCOPY . .RUN cargo build --releaseFROM debian:bookworm-slim AS runtimeWORKDIR /myappRUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/*RUN pip3 install protobufCOPY --from=builder /myapp/target/release/*.so /myapp/COPY --from=builder /myapp/target/release/myapp /myapp/COPY --from=builder /myapp/tests /myapp/testsCMD ["myapp"]

以上是关于GLIBC_2.29 not found的主要内容,如果未能解决你的问题,请参考以下文章