Files
mengyamonitor/mengyamonitor-backend/build_arm64.sh

31 lines
812 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Linux ARM64 交叉编译脚本
echo "开始交叉编译 mengyamonitor-backend (Linux ARM64)..."
# 禁用 CGO使用纯 Go 编译(不依赖系统 C 库)
export CGO_ENABLED=0
# 设置目标平台为 Linux ARM64
export GOOS=linux
export GOARCH=arm64
# 编译(静态链接)
go build -ldflags="-s -w" -o mengyamonitor-backend-arm64 .
if [ $? -eq 0 ]; then
echo "编译成功!"
echo "二进制文件: mengyamonitor-backend-arm64"
echo ""
echo "目标平台: Linux ARM64"
echo "编译模式: 静态链接,无外部依赖"
echo ""
echo "检查文件信息:"
file mengyamonitor-backend-arm64 2>/dev/null || echo "文件已生成: mengyamonitor-backend-arm64"
echo ""
ls -lh mengyamonitor-backend-arm64
else
echo "编译失败!"
exit 1
fi