Skip to content

Commit e7ca198

Browse files
committed
123
1 parent 17604dd commit e7ca198

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
shell: bash
3737
run: |
3838
sudo apt-get update
39-
sudo apt-get install -y dos2unix
39+
sudo apt-get install -y dos2unix libcapstone-dev
4040
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
4141
tar zxvf Xuantie-qemu-x86_64-Ubuntu-20.04-V5.0.5-B20250108-0335.tar.gz
4242
dos2unix ./install/qemu_post_install_small.sh
@@ -50,33 +50,25 @@ jobs:
5050
ldd "$QEMU_BIN" > "$tmp_output" 2>&1
5151
missing_libs=$(grep "not found" "$tmp_output" | awk '{print $1}')
5252
53-
mapfile -t all_libs < <(find /lib /usr/lib /usr/local/lib -type f -name "lib*.so*" 2>/dev/null)
54-
5553
for lib in $missing_libs; do
56-
base_lib=$(echo "$lib" | sed -E 's/\.so.*/\.so/')
57-
found=""
58-
59-
for path in "${all_libs[@]}"; do
60-
if [[ $(basename "$path") == $base_lib* ]]; then
61-
found="$path"
62-
break
63-
fi
64-
done
54+
echo "🔍 正在查找基础库:$base_lib..."
55+
found=$(sudo find / -type f -name "$base_lib" 2>/dev/null | head -n1)
6556
6657
if [ -n "$found" ]; then
67-
# 创建软连接到缺失的库名
68-
target_dir=$(dirname "$found")
69-
link_path="$target_dir/$lib"
70-
if [ -e "$link_path" ]; then
71-
echo "✅ 已存在软链接或库:$link_path"
72-
else
73-
echo "🔗 创建软链接:$link_path -> $(basename "$found")"
74-
sudo ln -s "$(basename "$found")" "$link_path"
75-
fi
58+
target_dir=$(dirname "$found")
59+
link_path="$target_dir/$lib"
60+
61+
if [ -e "$link_path" ]; then
62+
echo "✅ 已存在:$link_path"
63+
else
64+
echo "🔗 创建软链接:$link_path -> $(basename "$found")"
65+
sudo ln -s "$(basename "$found")" "$link_path"
66+
fi
7667
else
77-
echo "❌ 未找到用于修复 $lib 的基础库($base_lib),请手动安装。"
68+
echo "❌ 未找到 $base_lib,无法修复 $lib"
7869
exit 1
7970
fi
8071
done
8172
echo "✅ 所有缺失库已处理。"
73+
8274
./install/bin/qemu-system-riscv64 --version

0 commit comments

Comments
 (0)