mono / mono

Mono open source ECMA CLI, C# and .NET implementation.
https://www.mono-project.com
Other
11.14k stars 3.82k forks source link

Multi platform monodroid BCL builds #14333

Open lambdageek opened 5 years ago

lambdageek commented 5 years ago

Now that mscorlib and System depend on System.Native on non-windows platform, our BCL is no longer portable across platforms - a BCL built for macOS cannot simply be copied across to a Windows machine and expected to run. The interop code in a windows-specific build will directly P/Invoke into the Win32 APIs, whereas the interop code on other platforms delegates to System.Native which has internal calls to a platform specific native library libmono-native.{so,dylib}. Moreover it is merely a matter of coincidence that, for example, Android and macOS have the same symbols with the same semantics in their libmono-native - they could potentially diverge to take advantage of platform-specific capabilities.

Products such as Android Designer on Windows have the goal of running "the true monodroid BCL" profile. Currently they achieve that by copying the monodroid-targeted-at-Android BCL to Windows and running a host Mono runtime there. For reasons outlined above, this will no longer work.

Tasks:

DONE: Phase 1 - win32

Next: Phase 2 - CI and testing

Future

lambdageek commented 5 years ago

What I've learned today: if you build mono with --enable-monodrdoid it takes a hard dependency on zlib. As far as I can tell it only works with an external zlib (at least the way that sdks/builds/android.mk is set up).

It's not a problem right now, because for just the BCL build we don't need to compile with --enable-monodroid (which controls the runtime's support for XA; --with-monodroid or explicitly building the BCL with build_profiles='monodroid' is what builds the BCL), but if we start doing host builds on Windows, we will need to install mingw64-x86_64-zlib on Cygwin on CI.