如何在CI/CD中用mono编译Godot的自定义版本



如何在CI/CD中使用mono编译Godot?我找不到太多的例子——我能找到的模块(godex,sg_physics(,完全省略了编译mono。

Godot自己的CI/CD是否可以在某个地方发布

(编辑:看起来Godot用户的构建容器repo可以构建他们的发布版本。不幸的是,它不能在github操作上运行,因为构建dockerfile需要太长时间。(

使用Godot的文档,我在编译Godot窗口、ios和web构建时遇到了问题。对于我所有的编译,我都使用godot-mono-buildsrepo制作的mono的预编译版本来为每个平台进行编译。我还使用Github Actions作为我的CI/CD。

以下是我的存储库供参考(我正试图构建包含snopek游戏SGPhysics模块的Godot的单声道版本(:https://github.com/Fractural/SGPhysics2D

对于windows构建,我正在运行windows runner。但当我构建时,它似乎找不到mono库——尽管我验证了它已经成功下载。我得到以下错误:

Found Mono root directory: %ProgramFiles%Monodesktop-windows-x86_64-release
RuntimeError: Could not find mono library in: %ProgramFiles%Monodesktop-windows-x86_64-releaselib:
File "D:aSGPhysics2DSGPhysics2DSConstruct", line 716:
SConscript("modules/SCsub")

EDIT:godot mono构建回购的预构建mono版本仅适用于linux系统。在ubuntu上交叉编译窗口后,我得到了一个新错误:

/usr/bin/x86_64-w64-mingw32-ld: /home/runner/mono-installs/desktop-windows-x86_64-release/lib/libmonosgen-2.0.a(libmini_la-mini-windows.o):(.text+0x2dc): undefined reference to `__imp_timeGetDevCaps'
/usr/bin/x86_64-w64-mingw32-ld: /home/runner/mono-installs/desktop-windows-x86_64-release/lib/libmonosgen-2.0.a(libmini_la-mini-windows.o):(.text+0x334): undefined reference to `__imp_timeSetEvent'

对于iOS版本,当我使用lipo将它们捆绑在一起时,我会丢失文件。

fatal error: /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: bin/libmonosgen-2.0.iphone.arm64.a (No such file or directory)

EDIT:我在绑定步骤中运行了echo $(basename bin/*),发现我正在构建arm而不是arm64,这导致输出为bin/lipmonosgen-2.0.iphone.arm.a。现在我不确定arm64和arm之间的区别,就好像我试图将lipo放入一个fat.a文件中一样,它会抛出一个错误,说两者具有相同的arm64架构。

对于web构建,我正在运行ubuntu 20.04 runner。但当我构建时,它会得到重复的符号,这会引发以下错误:

wasm-ld: error: duplicate symbol: getpwnam_r
>>> defined in /home/runner/mono-installs/wasm-runtime-release/lib/libmonosgen-2.0.a(libmini_la-mini-wasm.o)
>>> defined in /home/runner/work/SGPhysics2D/SGPhysics2D/emsdk-cache/emsdk-main/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libstubs.a(emscripten_libc_stubs.o)
wasm-ld: error: duplicate symbol: getpwuid_r
>>> defined in /home/runner/mono-installs/wasm-runtime-release/lib/libmonosgen-2.0.a(libmini_la-mini-wasm.o)
>>> defined in /home/runner/work/SGPhysics2D/SGPhysics2D/emsdk-cache/emsdk-main/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libstubs.a(emscripten_libc_stubs.o)
wasm-ld: error: duplicate symbol: getgrnam
>>> defined in /home/runner/mono-installs/wasm-runtime-release/lib/libmonosgen-2.0.a(libmini_la-mini-wasm.o)
>>> defined in /home/runner/work/SGPhysics2D/SGPhysics2D/emsdk-cache/emsdk-main/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libstubs.a(emscripten_libc_stubs.o)
wasm-ld: error: duplicate symbol: getgrgid
>>> defined in /home/runner/mono-installs/wasm-runtime-release/lib/libmonosgen-2.0.a(libmini_la-mini-wasm.o)
>>> defined in /home/runner/work/SGPhysics2D/SGPhysics2D/emsdk-cache/emsdk-main/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libstubs.a(emscripten_libc_stubs.o)
wasm-ld: error: duplicate symbol: pthread_sigmask
>>> defined in /home/runner/mono-installs/wasm-runtime-release/lib/libmonosgen-2.0.a(libmini_la-mini-wasm.o)
>>> defined in /home/runner/work/SGPhysics2D/SGPhysics2D/emsdk-cache/emsdk-main/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a(pthread_sigmask.o)

EDIT:这是通过使用EXACTLY Emscripten 1.39.9修复的。我正在为Godot3.x构建以供参考,所以这可能与4.x不同。

Windows

Windows构建必须为MinGW的64位和32位版本启用posix线程。以下是执行此操作的bash命令:

sudo apt-get install mingw-w64
echo "1" | sudo update-alternatives --config x86_64-w64-mingw32-gcc
echo "1" | sudo update-alternatives --config x86_64-w64-mingw32-g++
echo "1" | sudo update-alternatives --config i686-w64-mingw32-gcc
echo "1" | sudo update-alternatives --config i686-w64-mingw32-g++

IOS

我犯了一个拼写错误,意外地用sconsflagsarch=arm而不是arch=arm64构建了godot。这就是lipo找不到arm64文件的原因。另一方面,lipo似乎将armarm64构建都解释为arm64,这使我无法使用lipo将它们的文件捆绑在一起。我最终放弃了arm构建——我仍然不确定它是否重要。

Web

使用mono的Web构建必须完全使用Emiscripten 1.39.9。然而,非mono版本可以使用最新版本。

最新更新