feat: complete build error

This commit is contained in:
chuan
2026-03-27 12:25:44 +08:00
parent 1409eb11f2
commit f213aa3edf
4 changed files with 65 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
[alias]
arm = "build --release --target aarch64-unknown-linux-musl"
+21
View File
@@ -0,0 +1,21 @@
# Watchdog
当前项目的作用是构建多端的看门狗程序,用来做程序的fallback和启动服务
## Install
1. rust build
2. build-essential
3. gcc-aarch64-linux-gnu
```sh
sudo apt install -y build-essential
# 添加arm64组件(这个是动态链接,会有GLIBC版本问题)
rustup target add aarch64-unknown-linux-gnu
sudo apt install -y gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-musl
sudo apt install -y musl-tools gcc-aarch64-linux-gnu
```
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
set -e
REMOTE_USER="root"
REMOTE_HOST="192.168.139.100"
REMOTE_DIR="/root"
TARGET="aarch64-unknown-linux-musl"
BIN_NAME="watchdog"
REMOTE_PASS="linaro"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
WORKSPACE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$WORKSPACE_DIR"
echo "==> 开始编译..."
cargo arm
LOCAL_BIN="target/$TARGET/release/$BIN_NAME"
if [ ! -f "$LOCAL_BIN" ]; then
echo "错误:找不到编译产物 $LOCAL_BIN"
exit 1
fi
echo "==> 上传到远端..."
sshpass -p "$REMOTE_PASS" scp -o StrictHostKeyChecking=no "$LOCAL_BIN" "${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/"
echo "==> 运行远端程序..."
sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no "${REMOTE_USER}@${REMOTE_HOST}" "chmod +x ${REMOTE_DIR}/${BIN_NAME} && ${REMOTE_DIR}/${BIN_NAME}"
+7
View File
@@ -1,3 +1,10 @@
fn main() {
println!("Hello, world!");
let a = 1;
let b = 2;
let c = a + b;
println!("The sum of {} and {} is {}", a, b, c);
}