File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ builds:
1515 main : ./
1616 binary : deepx
1717 env :
18- # 完全无 cgo:OCR 走 purego 运行时 dlopen,编译期不依赖 C 工具链,5 平台一份 runner 全搞定。
18+ # 不依赖 C 工具链:OCR 走 purego 运行时 dlopen,一份 runner 全搞定。
19+ # 注意:purego 用 cgo_import_dynamic,linux 产物仍是 glibc 动态链接(非纯静态),
20+ # 因此 Alpine/musl 上需 gcompat+libc6-compat 兼容层(见 install.sh 与 issue #99)。
1921 - CGO_ENABLED=0
2022 goos :
2123 - darwin
Original file line number Diff line number Diff line change 138138
139139success " Platform: ${OS} /${ARCH} "
140140
141+ # ---------------------------------------------------------------------------
142+ # Step 1.5: Alpine / musl 兼容层
143+ # 预编译 linux 二进制是 glibc 动态链接 —— OCR 经 purego 在运行时 dlopen,链接器据此产出
144+ # 动态可执行(即便 CGO_ENABLED=0 也非纯静态)。Alpine 用 musl,缺 glibc 解释器
145+ # /lib64/ld-linux-*.so → 装好也跑不起来(见 issue #99)。装 gcompat + libc6-compat
146+ # 提供 glibc 兼容层即可正常运行(已实测)。
147+ # ---------------------------------------------------------------------------
148+ if [ " $OS " = " linux" ] && { [ -f /etc/alpine-release ] || ldd --version 2>&1 | grep -qi musl; }; then
149+ warn " 检测到 musl libc(Alpine 等):deepx 预编译二进制为 glibc 动态链接,需 glibc 兼容层才能运行。"
150+ if command -v apk & > /dev/null; then
151+ info " 安装兼容层:apk add gcompat libc6-compat"
152+ if apk add --no-cache gcompat libc6-compat > /dev/null 2>&1 ; then
153+ success " 已安装 gcompat + libc6-compat"
154+ else
155+ warn " 自动安装失败(可能非 root / 无网络)。请手动执行: apk add gcompat libc6-compat"
156+ fi
157+ else
158+ warn " 未找到 apk。请用所在发行版的包管理器安装 glibc 兼容层(Alpine:apk add gcompat libc6-compat)。"
159+ fi
160+ fi
161+
141162# ---------------------------------------------------------------------------
142163# Step 2: 检测必备工具
143164# ---------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments