起因是试图将另一台arm64 kylin计算机上用gcc docker 容器编译的llama.cpp文件复制到这台机器上用结果运行报错, 想用apt安装动态库也报错了更新目录失败。aaakylin-pc:~/bin$ ./llama-cli -v ./llama-cli: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory aaakylin-pc:~/bin$ sudo apt install libssl3 输入密码 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 E: 无法定位软件包 libssl3 aaakylin-pc:~/bin$ sudo apt update 0% [已连接到 archive.kylinos.cn] ^C将所需的libssl.so.3和libcrypto.so.3从另一台机器复制过来结果又报本机的glibc、glibcxx版本过旧。aaakylin-pc:~/bin$ export LD_LIBRARY_PATH/home/aaa/bin/lib3 aaakylin-pc:~/bin$ ./llama-cli -v ./llama-cli: /lib/aarch64-linux-gnu/libstdc.so.6: version GLIBCXX_3.4.32 not found (required by ./llama-cli) ./llama-cli: /lib/aarch64-linux-gnu/libstdc.so.6: version GLIBCXX_3.4.30 not found (required by ./llama-cli) ./llama-cli: /lib/aarch64-linux-gnu/libstdc.so.6: version CXXABI_1.3.15 not found (required by ./llama-cli) ./llama-cli: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.33 not found (required by ./llama-cli) ./llama-cli: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.33 not found (required by /home/aaa/bin/lib3/libssl.so.3) ./llama-cli: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.33 not found (required by /home/aaa/bin/lib3/libcrypto.so.3) ./llama-cli: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.34 not found (required by /home/aaa/bin/lib3/libcrypto.so.3) aaakylin-pc:~/bin$ strings /lib/aarch64-linux-gnu/libc.so.6|grep GLIBC_2 GLIBC_2.30 aaakylin-pc:~/bin$ strings /lib/aarch64-linux-gnu/libstdc.so.6 |grep GLIBCXX_3 GLIBCXX_3.4.28再把所需的glibc、glibcxx动态库从另一台机器复制过来还是不行aaakylin-pc:~$ ls -l bin/lib3/* -rw-r--r-- 1 aaa aaa 4466856 10月 27 2024 bin/lib3/libcrypto.so.3 -rwxr-xr-x 1 aaa aaa 1651408 11月 1 2024 bin/lib3/libc.so.6 -rw-r--r-- 1 aaa aaa 737192 10月 27 2024 bin/lib3/libssl.so.3 lrwxrwxrwx 1 aaa aaa 19 1月 8 2023 bin/lib3/libstdc.so.6 - libstdc.so.6.0.30 -rw-r--r-- 1 aaa aaa 2174296 1月 8 2023 bin/lib3/libstdc.so.6.0.30 aaakylin-pc:~/bin$ export LD_LIBRARY_PATH/home/aaa/bin/lib3 aaakylin-pc:~/bin$ ./llama-cli -v ./llama-cli: /home/aaa/bin/lib3/libstdc.so.6: version GLIBCXX_3.4.32 not found (required by ./llama-cli) ./llama-cli: /home/aaa/bin/lib3/libstdc.so.6: version CXXABI_1.3.15 not found (required by ./llama-cli) ./llama-cli: /lib/ld-linux-aarch64.so.1: version GLIBC_2.35 not found (required by /home/aaa/bin/lib3/libc.so.6)接着想用本机的gcc来编译结果报错, 说没有c编译器。aaakylin-pc:~/llama.cpp-master$ ../cmake-4.2.3-linux-aarch64/bin/cmake -B build -DCMAKE_BUILD_TYPEDebug -- The C compiler identification is GNU 9.3.0 -- The CXX compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc - broken CMake Error at /home/aaa/cmake-4.2.3-linux-aarch64/share/cmake-4.2/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler /usr/bin/cc is not able to compile a simple test program. It fails with the following output: Change Dir: /home/aaa/llama.cpp-master/build/CMakeFiles/CMakeScratch/TryCompile-VomU50 Run Build Command(s): /home/aaa/cmake-4.2.3-linux-aarch64/bin/cmake -E env VERBOSE1 /usr/bin/make -f Makefile cmTC_eb6b0/fast /usr/bin/make -f CMakeFiles/cmTC_eb6b0.dir/build.make CMakeFiles/cmTC_eb6b0.dir/build make[1]: 进入目录“/home/aaa/llama.cpp-master/build/CMakeFiles/CMakeScratch/TryCompile-VomU50” Building C object CMakeFiles/cmTC_eb6b0.dir/testCCompiler.c.o /usr/bin/cc -o CMakeFiles/cmTC_eb6b0.dir/testCCompiler.c.o -c /home/aaa/llama.cpp-master/build/CMakeFiles/CMakeScratch/TryCompile-VomU50/testCCompiler.c Linking C executable cmTC_eb6b0 /home/aaa/cmake-4.2.3-linux-aarch64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_eb6b0.dir/link.txt --verbose1 /usr/bin/ld: 找不到 crt1.o: 没有那个文件或目录 /usr/bin/ld: 找不到 crti.o: 没有那个文件或目录 collect2: error: ld returned 1 exit status /usr/bin/cc CMakeFiles/cmTC_eb6b0.dir/testCCompiler.c.o -o cmTC_eb6b0 make[1]: *** [CMakeFiles/cmTC_eb6b0.dir/build.make:102cmTC_eb6b0] 错误 1 make[1]: 离开目录“/home/aaa/llama.cpp-master/build/CMakeFiles/CMakeScratch/TryCompile-VomU50” make: *** [Makefile:134cmTC_eb6b0/fast] 错误 2 Make will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:2 (project) CMake Error at CMakeLists.txt:2 (project): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable CXX or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. -- Configuring incomplete, errors occurred!没辙了只好也在本机装docker环境来编译。1.下载docker二进制文件aaakylin-pc:~$ wget https://download.docker.com/linux/static/stable/aarch64/docker-29.3.0.tgz 无法建立 SSL 连接。 aaakylin-pc:~$ wget https://mirrors.aliyun.com/docker-ce/linux/static/stable/aarch64/docker-29.3.0.tgz docker-29.3.0.tgz 100%[] 72.91M 13.8MB/s 用时 5.5s 2026-03-09 16:07:59 (13.3 MB/s) - 已保存 “docker-29.3.0.tgz” [76446817/76446817]) aaakylin-pc:~$ tar xf docker-29.3.0.tgz官网的地址不支持wget, 浏览器下载很慢所以改用阿里云镜像地址很快下载完了。2.修改配置文件启动服务按照网上教学文章的步骤执行。所有命令都加了sudo, 以防权限不足。aaakylin-pc:~$ mv docker/* /usr/bin/ mv: 无法创建普通文件/usr/bin/containerd: 权限不够 aaakylin-pc:~$ sudo mv docker/* /usr/bin/ aaakylin-pc:~$ sudo vi /usr/lib/systemd/system/docker.service aaakylin-pc:~$ cat /usr/lib/systemd/system/docker.service [Unit] DescriptionDocker Application Container Engine Documentationhttps://docs.docker.com Afternetwork-online.target firewalld.service Wantsnetwork-online.target [Service] Typenotify ExecStart/usr/bin/dockerd ExecReload/bin/kill -s HUP $MAINPID LimitNOFILEinfinity LimitNPROCinfinity TimeoutStartSec0 Delegateyes KillModeprocess Restarton-failure StartLimitBurst3 StartLimitInterval60s [Install] WantedBymulti-user.target aaakylin-pc:~$ sudo chmod x /usr/lib/systemd/system/docker.service aaakylin-pc:~$ sudo systemctl daemon-reload aaakylin-pc:~$ sudo vi /etc/docker/daemon.json aaakylin-pc:~$ cat /etc/docker/daemon.json { bip: 128.128.0.1/16, proxies: { http-proxy: http://proxy.aaa:8080, https-proxy: http://proxy.aaa:8080, no-proxy: localhost,127.0.0.1,.example.com }, registry-mirrors: [https://registry.docker-cn.com], exec-opts: [native.cgroupdriversystemd] } aaakylin-pc:~$ sudo systemctl daemon-reload aaakylin-pc:~$ sudo systemctl start docker aaakylin-pc:~$ sudo systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.用hello world镜像来测试registry.docker-cn.com镜像无效改用docker.1ms.run仓库可以拉取输出如下信息, 说明docker安装成功。aaakylin-pc:~$ sudo docker pull docker.1ms.run/hello-world Using default tag: latest latest: Pulling from hello-world 198f93fd5094: Pull complete 95ce02e4a4f1: Download complete Digest: sha256:ef54e839ef541993b4e87f25e752f7cf4238fa55f017957c2eb44077083d7a6a Status: Downloaded newer image for docker.1ms.run/hello-world:latest docker.1ms.run/hello-world:latest aaakylin-pc:~$ sudo docker run docker.1ms.run/hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the hello-world image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/3.拉取gcc镜像aaakylin-pc:~$ sudo docker pull docker.1ms.run/gcc:14.2 14.2: Pulling from gcc 9c242bd2197b: Pull complete 1a12b4ea7c0c: Pull complete 280bbe393e78: Pull complete 1f4f297e4f69: Pull complete b58ee5cb7152: Pull complete 26e4e1e4a57e: Pull complete 4752dc220c48: Pull complete 3aaac9860927: Pull complete b31dc54c5446: Download complete ec72a83a3e14: Download complete Digest: sha256:b99b86a28812b1e6453a231a947dc43d76fe192788a12f344a9b568bf9f5d24c Status: Downloaded newer image for docker.1ms.run/gcc:14.2 docker.1ms.run/gcc:14.2 aaakylin-pc:~$ sudo docker run -d -v /home/aaa/par:/par --network host --name gcc142 docker.1ms.run/gcc:14.2 f612cd2cf9c4fcba927e18521668e4cd84dabb8225f166dc6f39896d51b2b131 aaakylin-pc:~$ sudo docker exec -it gcc142 bash Error response from daemon: container f612cd2cf9c4fcba927e18521668e4cd84dabb8225f166dc6f39896d51b2b131 is not running aaakylin-pc:~$ sudo docker logs gcc142 aaakylin-pc:~$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f612cd2cf9c4 docker.1ms.run/gcc:14.2 bash 3 minutes ago Exited (0) 2 minutes ago gcc142 aaakylin-pc:~$ sudo systemctl status dockergcc启动失败日志空白docker状态中也看不出原因。而postgres镜像能正常启动aaakylin-pc:~$ sudo docker pull docker.1ms.run/postgres Using default tag: latest latest: Pulling from postgres 8ef786b18402: Pull complete 32907a42ce24: Pull complete 678efd827da7: Pull complete 00600fe93225: Pull complete 6cf9a691c71e: Pull complete bf8f335dbb73: Pull complete 11e712b78f59: Pull complete 52b4ac6b41c6: Pull complete 8b4769a7dd3c: Pull complete 0ae13f539d28: Pull complete 3dca2b464db8: Pull complete 2d6617baed4d: Pull complete 3b66ab8c894c: Pull complete ba4768def19e: Download complete f32c3e47bfcc: Download complete Digest: sha256:69e8582b781cb44fa4557b98ed586fe68361e320d9b12f9707494335634f4f3d Status: Downloaded newer image for docker.1ms.run/postgres:latest docker.1ms.run/postgres:latest aaakylin-pc:~$ sudo docker run -d -v /home/aaa/par:/par --network host --name pg18 -e POSTGRES_PASSWORDpassword docker.1ms.run/postgres 7842681dede783f625d4a51da0ed411609798cdf1237529ae23f7df56a38af73 aaakylin-pc:~$ sudo docker exec -it pg18 bash rootkylin-pc:/# su - postgres postgreskylin-pc:~$ psql psql (18.3 (Debian 18.3-1.pgdg131)) Type help for help. postgres#后来想起以前那台机器的容器是用docker run -itd命令选项运行的这次没写it是否这个原因删除容器重新运行镜像这次可以了可能数据库容器可以docker run -d, 而软件不行。aaakylin-pc:~$ sudo docker rm gcc142 gcc142 aaakylin-pc:~$ sudo docker run -itd -v /home/aaa/par:/par --network host --name gcc142 docker.1ms.run/gcc:14.2 dcbf574ebc6a87cebdce0f53c5424af6bbda7ec98bbf4cdec9951ebeb4fbd3dc aaakylin-pc:~$ sudo docker exec -it gcc142 bash rootkylin-pc:/# gcc -v Using built-in specs. COLLECT_GCCgcc COLLECT_LTO_WRAPPER/usr/local/libexec/gcc/aarch64-linux-gnu/14.2.0/lto-wrapper Target: aarch64-linux-gnu Configured with: /usr/src/gcc/configure --buildaarch64-linux-gnu --disable-multilib --enable-languagesc,c,fortran,go Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.0 (GCC)接下来编译过程主要就是3个命令git clone https://github.com/ggml-org/llama.cpp 太慢出错改用另一个域名 git clone https://bgithub.xyz/ggml-org/llama.cpp /par/cmake-4.2.3-linux-aarch64/bin/cmake -B build -DBUILD_SHARED_LIBSOFF /par/cmake-4.2.3-linux-aarch64/bin/cmake --build build --config Release -j 8再下载模型试验wget -c https://hf-mirror.com/unsloth/Qwen3.5-9B-GGUF/resolve/main/Qwen3.5-9B-UD-Q4_K_XL.gguf wget https://hf-mirror.com/unsloth/gemma-3-1b-it-GGUF/resolve/main/gemma-3-1b-it-Q4_K_M.gguf rootkylin-pc:/par/llama.cpp# build/bin/llama-cli -m /par/Qwen3.5-9B-UD-Q4_K_XL.gguf --ctx-size 16384 -cnv rootkylin-pc:/# /par/llama.cpp/build/bin/llama-server -m /par/gemma-3-1b-it-Q4_K_M.gguf --jinja -c 0 --host 127.0.0.1 --port 8033llama-cli和llama-server都能运行不知为何llama-cli输入汉字就无限滚动输入英文没事。而官方发布的x64 linux二进制不存在这个问题。