fix: Ubuntu 采用官方 release-static 方法实现纯静态链接
Some checks failed
Build and Release Mond / build-and-test (arm64, alpine) (push) Successful in 25s
Build and Release Mond / build-and-test (amd64, alpine) (push) Successful in 38s
Build and Release Mond / build-and-test (amd64, ubuntu) (push) Failing after 2m1s
Build and Release Mond / release (push) Has been cancelled
Build and Release Mond / build-and-test (arm64, ubuntu) (push) Has been cancelled

- 移除 depends 系统,避免 Boost 1.69/GCC 11.4 兼容性问题
- 采用官方 Makefile 中的 release-static target 配置
- 参考 Alpine 成功经验添加 -DSTACK_TRACE=OFF
- 简化构建流程,提高可维护性

参考:.source/Makefile:93-95, .source/README.md:459-484
This commit is contained in:
2025-12-15 13:18:28 +08:00
parent 999024051f
commit eaf6286543

View File

@@ -59,40 +59,20 @@ COPY ./init.sh ./init.sh
RUN chmod +x ./init.sh && ./init.sh RUN chmod +x ./init.sh && ./init.sh
# 使用 depends 系统构建所有静态依赖 # 构建 Monero (mond) - 使用官方 release-static 方法
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS=2; \
else \
MAKE_JOBS=$(nproc); \
fi && \
if [ "$TARGETARCH" = "arm64" ]; then \
DEPENDS_HOST="aarch64-linux-gnu"; \
else \
DEPENDS_HOST="x86_64-linux-gnu"; \
fi && \
echo "Building dependencies for $DEPENDS_HOST with $MAKE_JOBS parallel jobs" && \
cd contrib/depends && \
make HOST=$DEPENDS_HOST -j$MAKE_JOBS
# 构建 Monero (mond) - 使用静态链接和 depends
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \ RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \ MAKE_JOBS="-j2"; \
else \ else \
MAKE_JOBS="-j$(nproc)"; \ MAKE_JOBS="-j$(nproc)"; \
fi && \ fi && \
if [ "$TARGETARCH" = "arm64" ]; then \ echo "Building mond with parallel jobs: $MAKE_JOBS" && \
DEPENDS_HOST="aarch64-linux-gnu"; \
else \
DEPENDS_HOST="x86_64-linux-gnu"; \
fi && \
echo "Building mond for $DEPENDS_HOST with parallel jobs: $MAKE_JOBS" && \
mkdir -p build/release && cd build/release && \ mkdir -p build/release && cd build/release && \
cmake ../.. \ cmake ../.. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_GUI_DEPS=OFF \ -DBUILD_GUI_DEPS=OFF \
-DARCH=default \ -DARCH=default \
-DSTATIC=ON \ -DSTATIC=ON \
-DCMAKE_TOOLCHAIN_FILE=/monero/contrib/depends/$DEPENDS_HOST/share/toolchain.cmake && \ -DSTACK_TRACE=OFF && \
make $MAKE_JOBS daemon make $MAKE_JOBS daemon
# 最终阶段 - 只复制静态链接的二进制文件 # 最终阶段 - 只复制静态链接的二进制文件