Skip to content

Commit 1e5e238

Browse files
wehosHongzhi Wen
andauthored
fix(ci): mac Nuitka 构建前清掉 steamworks/ 里的非 mac native libs (#1339)
Mac arm64 / x64 的 build-desktop nightly 因 `--include-package=steamworks` 让 Nuitka 把 repo 里 checked-in 的 Linux ELF `SteamworksPy.so` 当 package data 一起 bundle,arch 检查 FATAL: FATAL: cannot use file '.../steamworks/SteamworksPy.so' (ELF 64-bit LSB shared object, x86-64, ...) to build arch 'arm64' result 之前的 `--include-data-files` 已按 OS gate,但管不住 `--include-package` 对包目录的自动 traverse。直接在 nuitka 之前删掉非本平台的 native libs 最简单确定。同步给 Linux/Windows 分支补上对偶清理,防止同类回归。 Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com>
1 parent 880324f commit 1e5e238

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/build-desktop.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,22 @@ jobs:
364364
# from the exe sibling dir (see steamworks/__init__.py), so dest stays at root.
365365
# Gate by RUNNER_OS: all platforms' libs are checked into the repo, but
366366
# feeding a Linux ELF .so to a macOS Nuitka build trips an arch-mismatch FATAL.
367+
# The --include-package=steamworks above also makes Nuitka pick up every
368+
# native lib in steamworks/ as package data, so strip the wrong-platform
369+
# copies from the source tree before invoking nuitka.
367370
NUITKA_OPTS="$NUITKA_OPTS --include-data-files=steam_appid.txt=steam_appid.txt"
368371
if [[ "$RUNNER_OS" == "macOS" ]]; then
372+
rm -f steamworks/SteamworksPy.so steamworks/libsteam_api.so \
373+
steamworks/SteamworksPy64.dll steamworks/steam_api64.dll steamworks/steam_api64.lib
369374
if [ -f "steamworks/libsteam_api.dylib" ]; then
370375
NUITKA_OPTS="$NUITKA_OPTS --include-data-files=steamworks/libsteam_api.dylib=libsteam_api.dylib"
371376
fi
372377
if [ -f "steamworks/SteamworksPy.dylib" ]; then
373378
NUITKA_OPTS="$NUITKA_OPTS --include-data-files=steamworks/SteamworksPy.dylib=SteamworksPy.dylib"
374379
fi
375380
elif [[ "$RUNNER_OS" == "Linux" ]]; then
381+
rm -f steamworks/SteamworksPy.dylib steamworks/libsteam_api.dylib \
382+
steamworks/SteamworksPy64.dll steamworks/steam_api64.dll steamworks/steam_api64.lib
376383
if [ -f "steamworks/libsteam_api.so" ]; then
377384
NUITKA_OPTS="$NUITKA_OPTS --include-data-files=steamworks/libsteam_api.so=libsteam_api.so"
378385
fi
@@ -437,6 +444,10 @@ jobs:
437444
rem from the exe sibling dir (see steamworks/__init__.py), so dest stays at root.
438445
rem Guard with `if exist` to mirror the Unix branch — keeps the build
439446
rem soft on incidental missing libs instead of fataling in Nuitka.
447+
rem --include-package=steamworks pulls in every native lib in steamworks/
448+
rem as package data; strip the non-Windows copies so Nuitka can't trip
449+
rem an arch check on them (mirrors the Unix branch's rm step).
450+
del /q steamworks\SteamworksPy.so steamworks\libsteam_api.so steamworks\SteamworksPy.dylib steamworks\libsteam_api.dylib 2>nul
440451
if exist "steamworks\steam_api64.dll" set NUITKA_OPTS=%NUITKA_OPTS% --include-data-files=steamworks/steam_api64.dll=steam_api64.dll
441452
if exist "steamworks\steam_api64.lib" set NUITKA_OPTS=%NUITKA_OPTS% --include-data-files=steamworks/steam_api64.lib=steam_api64.lib
442453
if exist "steamworks\SteamworksPy64.dll" set NUITKA_OPTS=%NUITKA_OPTS% --include-data-files=steamworks/SteamworksPy64.dll=SteamworksPy64.dll

0 commit comments

Comments
 (0)