li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4(V)
MIT License
2.91k stars 334 forks source link

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

Open franksonet opened 11 months ago

franksonet commented 11 months ago

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
oncloudit commented 10 months ago

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

M1saka10010 commented 10 months ago

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

meicale commented 10 months ago

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

sosoayaen commented 8 months ago

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.