chatglm.cpp icon indicating copy to clipboard operation
chatglm.cpp copied to clipboard

Error when run with docker: error while loading shared libraries: libggml.so

Open franksonet opened this issue 2 years ago • 4 comments

Environment:

MacOS M1 pro

Model:

chatglm2-6b量化模型

Error:

Run with docker

docker run -it --rm -v $PWD:/opt liplusx/chatglm.cpp:main \
    ./build/bin/main -m /opt/chatglm2-ggml.bin -p "你好"

Error:

./build/bin/main: error while loading shared libraries: libggml.so: cannot open shared object file: No such file or directory

franksonet avatar Oct 11 '23 05:10 franksonet

same error in centos 7.6 with both Building Locally and Pre Build Option.

oncloudit avatar Nov 03 '23 06:11 oncloudit

same error in debian11(wsl) with both Building Locally and Pre Build Option.

M1saka10010 avatar Nov 11 '23 19:11 M1saka10010

Same error on WSL2(ubuntu 22.04) with pre build docker image.

meicale avatar Nov 12 '23 09:11 meicale

Cause of the Issue: The corresponding executable file main couldn't find the libggml.so file in the system during runtime. Indeed, in the Dockerfile, only the final executable file was copied to the final image, while the dynamic library libggml.so was missed.

Solution: Modify the Dockerfile. Below the line where the main executable is copied, also copy the libggml.so. The Dockerfile should be updated as follows:

COPY --from=build /chatglm.cpp/build/bin/main /chatglm.cpp/build/bin/main
COPY --from=build /chatglm.cpp/build/lib/libggml.so /chatglm.cpp/build/lib/libggml.so

Rebuild this image and restart to fix this error.

sosoayaen avatar Dec 18 '23 13:12 sosoayaen