Skip to content

Commit 253b9f5

Browse files
committed
Enhance Windows build workflow with detailed DLL checks and logging. Added pre-build DLL availability checks, improved error handling for missing DLLs, and summarized bundling results in build-info.json.
1 parent df9a728 commit 253b9f5

File tree

1 file changed

+71
-5
lines changed

1 file changed

+71
-5
lines changed

.github/workflows/build.yml

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,17 @@ jobs:
229229
run: |
230230
echo "=== Building with MSYS2/MinGW-w64 toolchain ==="
231231
232+
# 调试:检查关键DLL的存在
233+
echo "🔍 Pre-build DLL availability check:"
234+
for dll in libfftw3f-3.dll libfftw3f_threads-3.dll libgfortran-5.dll libgcc_s_seh-1.dll libwinpthread-1.dll libstdc++-6.dll; do
235+
if [ -f "/mingw64/bin/$dll" ]; then
236+
echo " ✅ $dll: $(stat -c%s /mingw64/bin/$dll) bytes"
237+
else
238+
echo " ❌ $dll: NOT FOUND"
239+
fi
240+
done
241+
echo ""
242+
232243
# 设置环境变量强制使用 MinGW 工具链
233244
export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig"
234245
export CMAKE_PREFIX_PATH="/mingw64"
@@ -494,6 +505,13 @@ jobs:
494505
if: runner.os == 'Windows'
495506
shell: msys2 {0}
496507
run: |
508+
echo "🔧 Windows prebuilt packaging started"
509+
echo "Environment info:"
510+
echo " • Shell: $0"
511+
echo " • PWD: $(pwd)"
512+
echo " • User: $(whoami)"
513+
echo ""
514+
497515
# 创建目标目录
498516
TARGET_DIR="prebuilds/${{ matrix.os }}-${{ matrix.arch }}"
499517
echo "📁 Creating target directory: $TARGET_DIR"
@@ -528,17 +546,50 @@ jobs:
528546
echo ""
529547
echo "📋 Copying DLLs from MinGW..."
530548
bundled_count=0
549+
missing_dlls=""
550+
551+
# 首先检查MinGW目录是否存在
552+
echo "🔍 Checking MinGW directory..."
553+
if [ -d "/mingw64/bin" ]; then
554+
echo " ✅ /mingw64/bin exists"
555+
echo " Available DLLs in /mingw64/bin:"
556+
ls /mingw64/bin/lib*.dll | head -10 || echo " No lib*.dll files found"
557+
else
558+
echo " ❌ /mingw64/bin not found!"
559+
exit 1
560+
fi
531561
562+
echo ""
563+
echo "📋 Processing each required DLL..."
532564
for dll in $REQUIRED_DLLS; do
565+
echo " 🔍 Checking: $dll"
533566
if [ -f "/mingw64/bin/$dll" ]; then
534-
cp "/mingw64/bin/$dll" "$TARGET_DIR/"
535-
echo " ✅ Bundled: $dll"
536-
((bundled_count++))
567+
if cp "/mingw64/bin/$dll" "$TARGET_DIR/" 2>/dev/null; then
568+
echo " ✅ Bundled: $dll"
569+
bundled_count=$((bundled_count + 1))
570+
else
571+
echo " ❌ Copy failed: $dll"
572+
missing_dlls="$missing_dlls $dll"
573+
fi
537574
else
538-
echo " ❌ Missing: $dll"
575+
echo " ❌ Missing: $dll"
576+
missing_dlls="$missing_dlls $dll"
577+
578+
# 尝试查找类似名称的文件
579+
echo " 🔍 Looking for similar files..."
580+
find /mingw64/bin -name "*${dll%%-*}*" -type f | head -3 || echo " No similar files found"
539581
fi
540582
done
541583
584+
# 报告结果
585+
echo ""
586+
echo "📊 DLL bundling summary:"
587+
echo " • Successfully bundled: $bundled_count DLLs"
588+
if [ -n "$missing_dlls" ]; then
589+
echo " • Missing DLLs:$missing_dlls"
590+
echo " ⚠️ Some DLLs are missing, but continuing..."
591+
fi
592+
542593
# 显示最终结果
543594
echo ""
544595
echo "📁 Final package contents:"
@@ -549,6 +600,19 @@ jobs:
549600
total_size=$(du -sb "$TARGET_DIR" | cut -f1)
550601
551602
# 创建构建信息文件
603+
# 获取实际捆绑的DLL列表
604+
bundled_dll_list=""
605+
for dll_file in "$TARGET_DIR"/*.dll; do
606+
if [ -f "$dll_file" ]; then
607+
dll_name=$(basename "$dll_file")
608+
if [ -z "$bundled_dll_list" ]; then
609+
bundled_dll_list="\"$dll_name\""
610+
else
611+
bundled_dll_list="$bundled_dll_list, \"$dll_name\""
612+
fi
613+
fi
614+
done
615+
552616
cat > "$TARGET_DIR/build-info.json" << EOF
553617
{
554618
"platform": "${{ matrix.os }}",
@@ -559,7 +623,9 @@ jobs:
559623
"file_size": $node_size,
560624
"bundled_libraries": $bundled_count,
561625
"total_package_size": $total_size,
562-
"bundled_dlls": [$(echo "$REQUIRED_DLLS" | sed 's/^/"/;s/$/"/' | paste -sd, -)]
626+
"required_dlls": [$(echo "$REQUIRED_DLLS" | sed 's/^/"/;s/$/"/' | paste -sd, -)],
627+
"bundled_dlls": [$bundled_dll_list],
628+
"missing_dlls": "$(echo $missing_dlls | sed 's/^ *//' | sed 's/ *$//')"
563629
}
564630
EOF
565631

0 commit comments

Comments
 (0)