Skip to content

Commit 32b2825

Browse files
committed
Fix: 修复了环境变量应该互斥的问题
Fixed environment variables mutual exclusion issue
1 parent 176ae3c commit 32b2825

2 files changed

Lines changed: 334 additions & 14 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 119 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,93 @@ jobs:
166166
run: |
167167
echo "🔍 验证Claude Code二进制文件..."
168168
if [ -f "binaries/claude-code" ]; then
169+
echo "✅ 找到Claude Code二进制文件"
170+
echo "📋 文件信息:"
169171
file binaries/claude-code
170-
ldd binaries/claude-code || echo "⚠️ ldd检查失败,可能是静态链接的二进制文件"
171172
ls -la binaries/claude-code
173+
echo "📋 权限检查:"
174+
stat binaries/claude-code
175+
echo "📋 依赖分析:"
176+
ldd binaries/claude-code || {
177+
echo "⚠️ ldd检查失败,检查是否为静态链接"
178+
readelf -d binaries/claude-code | head -20 || echo "readelf失败"
179+
objdump -p binaries/claude-code | grep NEEDED || echo "objdump失败"
180+
}
181+
echo "📋 验证可执行性:"
182+
if [ -x "binaries/claude-code" ]; then
183+
echo "✅ 文件具有执行权限"
184+
./binaries/claude-code --version || echo "⚠️ 执行失败,但这可能是正常的"
185+
else
186+
echo "❌ 文件没有执行权限"
187+
chmod +x binaries/claude-code
188+
echo "✅ 已添加执行权限"
189+
fi
172190
else
173191
echo "❌ 未找到Claude Code二进制文件"
192+
echo "📋 搜索所有claude-code文件:"
174193
find . -name "claude-code" -type f 2>/dev/null || true
194+
echo "📋 binaries目录内容:"
195+
ls -la binaries/ || echo "binaries目录不存在"
196+
fi
197+
198+
# 调试AppImage构建环境
199+
- name: Debug AppImage build environment
200+
if: matrix.platform.os == 'ubuntu-latest' && matrix.platform.bundle-type == 'appimage'
201+
run: |
202+
echo "🔍 调试AppImage构建环境..."
203+
echo "📋 系统信息:"
204+
uname -a
205+
echo "📋 已安装工具版本:"
206+
which linuxdeploy || echo "linuxdeploy未找到"
207+
which ldd || echo "ldd未找到"
208+
ldd --version || echo "ldd版本获取失败"
209+
which patchelf || echo "patchelf未找到"
210+
patchelf --version || echo "patchelf版本获取失败"
211+
echo "📋 环境变量:"
212+
env | grep -E "(ARCH|NO_STRIP|LINUXDEPLOY)" || echo "无相关环境变量"
213+
echo "📋 检查目标二进制文件状态:"
214+
if [ -f "src-tauri/target/release/claudia" ]; then
215+
echo "✅ 找到主程序二进制文件"
216+
file src-tauri/target/release/claudia
217+
ldd src-tauri/target/release/claudia || echo "⚠️ 主程序ldd失败"
218+
else
219+
echo "❌ 主程序二进制文件不存在"
220+
fi
221+
222+
echo "📋 检查外部二进制文件配置:"
223+
if [ -f "binaries/claude-code" ]; then
224+
echo "✅ 外部二进制文件存在"
225+
echo "📋 详细分析外部二进制文件:"
226+
file binaries/claude-code
227+
ls -la binaries/claude-code
228+
echo "📋 检查二进制文件依赖:"
229+
ldd binaries/claude-code 2>&1 || {
230+
echo "⚠️ ldd失败,详细错误信息:"
231+
ldd binaries/claude-code 2>&1 | cat -v
232+
echo "📋 使用 readelf 检查:"
233+
readelf -h binaries/claude-code 2>&1 || echo "readelf 也失败"
234+
echo "📋 使用 hexdump 检查文件头:"
235+
hexdump -C binaries/claude-code | head -5 || echo "hexdump 失败"
236+
}
237+
else
238+
echo "❌ 外部二进制文件不存在"
239+
echo "📋 检查构建过程是否创建了该文件:"
240+
find . -name "claude-code" -type f 2>/dev/null || echo "整个项目中未找到 claude-code 文件"
175241
fi
176242
177243
# 构建Tauri应用程序
178244
- name: Build Tauri application
179245
run: |
246+
echo "🚀 开始构建Tauri应用程序..."
247+
echo "📋 构建参数:"
248+
echo " - Bundle type: ${{ matrix.platform.bundle-type }}"
249+
echo " - Rust target: ${{ matrix.platform.rust-target }}"
250+
180251
if [ "${{ matrix.platform.rust-target }}" = "aarch64-apple-darwin" ]; then
252+
echo "📋 执行命令: bun run tauri build --target ${{ matrix.platform.rust-target }} --bundles ${{ matrix.platform.bundle-type }} --verbose"
181253
bun run tauri build --target ${{ matrix.platform.rust-target }} --bundles ${{ matrix.platform.bundle-type }} --verbose
182254
else
255+
echo "📋 执行命令: bun run tauri build --bundles ${{ matrix.platform.bundle-type }} --verbose"
183256
bun run tauri build --bundles ${{ matrix.platform.bundle-type }} --verbose
184257
fi
185258
shell: bash
@@ -189,6 +262,36 @@ jobs:
189262
# 设置AppImage构建环境变量
190263
ARCH: x86_64
191264
NO_STRIP: 1
265+
# 添加调试模式
266+
RUST_LOG: debug
267+
RUST_BACKTRACE: full
268+
# 添加详细日志输出
269+
LINUXDEPLOY_OUTPUT_VERSION: 1
270+
271+
# 构建失败诊断
272+
- name: Diagnose build failure
273+
if: failure() && matrix.platform.os == 'ubuntu-latest' && matrix.platform.bundle-type == 'appimage'
274+
run: |
275+
echo "❌ AppImage构建失败,开始诊断..."
276+
echo "📋 检查构建日志:"
277+
find src-tauri -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \; 2>/dev/null || echo "未找到构建日志"
278+
echo "📋 检查AppDir结构:"
279+
if [ -d "src-tauri/target/release/bundle/appimage" ]; then
280+
find src-tauri/target/release/bundle/appimage -type d -name "*.AppDir" -exec echo "=== AppDir: {} ===" \; -exec ls -la {} \; 2>/dev/null || echo "未找到AppDir"
281+
fi
282+
echo "📋 检查可能的错误文件:"
283+
find src-tauri/target -name "*.stderr" -type f -exec echo "=== {} ===" \; -exec cat {} \; 2>/dev/null || echo "未找到stderr文件"
284+
echo "📋 检查 linuxdeploy 相关文件:"
285+
find /tmp -name "*linuxdeploy*" -type f 2>/dev/null | head -10 || echo "未找到 linuxdeploy 临时文件"
286+
echo "📋 检查系统 ldd 状态:"
287+
which ldd
288+
ldd --help | head -5 2>/dev/null || echo "ldd help 失败"
289+
echo "📋 检查 AppDir 中的二进制文件:"
290+
if [ -d "src-tauri/target/release/bundle/appimage" ]; then
291+
find src-tauri/target/release/bundle/appimage -name "*.AppDir" -exec find {} -name "claude-code" -type f \; 2>/dev/null || echo "AppDir 中未找到 claude-code"
292+
fi
293+
echo "📋 检查Rust编译产物:"
294+
ls -la src-tauri/target/release/ 2>/dev/null || echo "release目录不存在"
192295
193296
# 查找构建产物
194297
- name: Find build artifacts
@@ -198,9 +301,21 @@ jobs:
198301
echo "Bundle type: ${{ matrix.platform.bundle-type }}"
199302
echo "Rust target: ${{ matrix.platform.rust-target }}"
200303
201-
# 显示构建目录结构
202-
echo "📁 构建目录结构:"
203-
find src-tauri/target -type f -name "*.${{ matrix.platform.bundle-pattern }}" 2>/dev/null || true
304+
# 显示完整构建目录结构
305+
echo "📁 完整构建目录结构:"
306+
find src-tauri/target -type f \( -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.msi" -o -name "*.exe" -o -name "*.dmg" \) 2>/dev/null || echo "未找到任何构建产物"
307+
308+
echo "📁 target目录结构:"
309+
ls -la src-tauri/target/ 2>/dev/null || echo "target目录不存在"
310+
311+
if [ -d "src-tauri/target/release" ]; then
312+
echo "📁 release目录结构:"
313+
ls -la src-tauri/target/release/ 2>/dev/null
314+
if [ -d "src-tauri/target/release/bundle" ]; then
315+
echo "📁 bundle目录结构:"
316+
find src-tauri/target/release/bundle -type f 2>/dev/null || echo "bundle目录为空"
317+
fi
318+
fi
204319
205320
if [ "${{ matrix.platform.bundle-type }}" = "appimage" ]; then
206321
BUNDLE_PATH=$(find src-tauri/target/release/bundle/appimage -name "*.AppImage" | head -1)

0 commit comments

Comments
 (0)