Skip to content

123

123 #54

Workflow file for this run

# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright (C) 2023-2023 RT-Thread Development Team
#
# @author xqyjlj
# @file build.yml
#
# Change Logs:
# Date Author Notes
# ------------ ---------- -----------------------------------------------
# 2023-06-01 xqyjlj initial version
#
name: 👷 build
on:
push:
pull_request:
jobs:
build-smart-apps:
runs-on: ubuntu-22.04
steps:
- name: 👷 build
# uses: xmake-io/github-action-setup-xmake@v1
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y dos2unix libcapstone-dev
wget -q https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1736318325160/Xuantie-qemu-x86_64-Ubuntu-20.04-V5.0.5-B20250108-0335.tar.gz
tar zxvf Xuantie-qemu-x86_64-Ubuntu-20.04-V5.0.5-B20250108-0335.tar.gz
dos2unix ./install/qemu_post_install_small.sh
sudo chmod +x ./install/qemu_post_install_small.sh
sudo ./install/qemu_post_install_small.sh
QEMU_BIN="./install/bin/qemu-system-riscv64"
[ ! -f "$QEMU_BIN" ] && echo "ERROR: $QEMU_BIN not found." && exit 1
tmp_output=$(mktemp)
ldd "$QEMU_BIN" > "$tmp_output" 2>&1
missing_libs=$(grep "not found" "$tmp_output" | awk '{print $1}')
for lib in $missing_libs; do
base_lib=$(echo "$lib" | sed -E 's/\.so.*/\.so/')
echo "🔍 正在查找基础库:$base_lib..."
found=$(sudo find /lib/x86_64-linux-gnu /lib /usr/lib -type f -name "$base_lib" 2>/dev/null | head -n1)
if [ -n "$found" ]; then
target_dir=$(dirname "$found")
link_path="$target_dir/$lib"
if [ -e "$link_path" ]; then
echo "✅ 已存在:$link_path"
else
echo "🔗 创建软链接:$link_path -> $(basename "$found")"
sudo ln -s "$(basename "$found")" "$link_path"
fi
else
echo "❌ 未找到 $base_lib,无法修复 $lib"
exit 1
fi
done
echo "✅ 所有缺失库已处理。"
./install/bin/qemu-system-riscv64 --version