Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tvOS: Mono runtime for device is missing bitcode #48508

Closed
rolfbjarne opened this issue Feb 19, 2021 · 16 comments
Closed

tvOS: Mono runtime for device is missing bitcode #48508

rolfbjarne opened this issue Feb 19, 2021 · 16 comments
Assignees
Milestone

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Feb 19, 2021

Trying to link with libmonosgen-2.0.dylib from the tvOS runtime pack yields:

ld: '/Users/rolf/work/maccore/coreclr/xamarin-macios/builds/downloads/microsoft.netcore.app.runtime.tvos-arm64/6.0.0-preview.1.21102.12/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/rolf/work/maccore/coreclr/xamarin-macios/builds/downloads/microsoft.netcore.app.runtime.tvos-arm64/6.0.0-preview.1.21102.12/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib'

This is also evident in the size difference between the runtime pack and the old mono archive:

$ ls -la builds/downloads/microsoft.netcore.app.runtime.*/6.0.0-preview.1.21102.12/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib
-rwxr--r--  1 rolf  staff  4307416 Feb  3 03:54 builds/downloads/microsoft.netcore.app.runtime.tvos-arm64/6.0.0-preview.1.21102.12/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib

$ ls -la builds/downloads/ios-release-Darwin-5e9cb6d1c1de430965312927d5aed7fcb27bfa73/ios-libs/tvos/libmonosgen-2.0.dylib     
-rwxr-xr-x  1 rolf  staff  29800456 Feb 19 11:43 builds/downloads/ios-release-Darwin-5e9cb6d1c1de430965312927d5aed7fcb27bfa73/ios-libs/tvos/libmonosgen-2.0.dylib
@dotnet-issue-labeler dotnet-issue-labeler bot added area-Build-mono untriaged New issue has not been triaged by the area owner labels Feb 19, 2021
@rolfbjarne
Copy link
Member Author

CC @akoeplinger @steveisok

@steveisok steveisok added this to the 6.0.0 milestone Feb 19, 2021
@akoeplinger
Copy link
Member

@rolfbjarne is this a tvOS specific requirement? from what I can see we're doing pretty much the same on iOS/tvOS.

@marek-safar marek-safar added os-tvos Apple tvOS and removed untriaged New issue has not been triaged by the area owner labels Feb 19, 2021
@rolfbjarne
Copy link
Member Author

@akoeplinger yes, this is specific to tvOS, we don't need bitcode on any other platform (except for watchOS, but that's not on the roadmap right now).

@spouliot
Copy link
Contributor

spouliot commented Apr 8, 2021

This is blocking us from enabling globalization (ICU) on tvOS.

see #50912

spouliot added a commit to xamarin/xamarin-macios that referenced this issue Apr 9, 2021
and re-enable some tests for dotnet

Part of the fix for #8906

Known Issues
* [some Calendar are not the expected ones](dotnet/runtime#50859)
* [No support for tvOS (bitcode)](dotnet/runtime#48508)
@filipnavara
Copy link
Member

filipnavara commented Apr 10, 2021

This should do for the bitcode in the libs+mono (doesn't enable the --with-bitcode option as in Mono's configure, just the ios.mk build flags): bf95449

Unfortunately the ICU build itself is not built with bitcode and that has to be done first:

  ld: warning: object file (/Users/filipnavara/.nuget/packages/microsoft.netcore.runtime.icu.transport/6.0.0-preview.4.21205.1/runtimes/tvOS-arm64/native/lib/libicuuc.a(uinvchar.ao)) was built for newer tvOS version (10.0) than being linked (9.0)
  ld: '/Users/filipnavara/.nuget/packages/microsoft.netcore.runtime.icu.transport/6.0.0-preview.4.21205.1/runtimes/tvOS-arm64/native/lib/libicuuc.a(uinvchar.ao)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target.

https://github.com/dotnet/icu/blob/maint/maint-67/eng/icu.tvos.mk looks like a good start.

@filipnavara
Copy link
Member

akoeplinger pushed a commit that referenced this issue Apr 14, 2021
@akoeplinger
Copy link
Member

@filipnavara do you think there's anything left for us to do here, or just follow-up on the XI side?

@filipnavara
Copy link
Member

@akoeplinger I am honestly not sure. The MonoVM build may not work exactly like the --with-bitcode configure option did in classic Mono. I tried to test the end-to-end scenario to ensure that all the necessary bits are present but I stopped short of actually running the code on a device. On the reverse side the runtime may contain unnecessary bits which are never used in llvmonly mode.

@akoeplinger
Copy link
Member

@filipnavara I looked at the mono/mono code and it seems like the --with-bitcode was essentially only used to add -no-undefined to the linker flags so we should be good here though I'll open a PR to add that flag back.

@akoeplinger
Copy link
Member

Opened #51241, I think we can close this here and open new issues if needed.

@spouliot
Copy link
Contributor

spouliot commented Apr 16, 2021

The current package points to 3ffaab9 which does not include "Add additional compiler flags for tvOS (#51241)"

l builds//downloads/microsoft.netcore.app.runtime.mono.tvos-arm64/6.0.0-preview.4.21213.3/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib
-rwxr--r--  1 poupou  staff  7108720 13 Apr 09:02 builds//downloads/microsoft.netcore.app.runtime.mono.tvos-arm64/6.0.0-preview.4.21213.3/runtimes/tvos-arm64/native/libmonosgen-2.0.dylib

^ current lib is without bitcode (confirmed by size and tried to build it locally)

I'll check back next week to see if we can re-enable this. Thanks!

@filipnavara
Copy link
Member

I will double check the output but I think it should be linking against libmonosgen-2.0.a (static library), shouldn't it?

@filipnavara
Copy link
Member

Version 6.0.0-preview.4.21215.1 does contain it for both .a and .dylib. The PR xamarin/xamarin-macios#11175 should bump way beyond that.

@spouliot
Copy link
Contributor

We need both .a and .dylib

The latter is important to build a framework (still todo for dotnet) so we can share the runtime between the app and the extensions (which also exists, even if less common, in tvOS).

@spouliot
Copy link
Contributor

The PR xamarin/xamarin-macios#11175 should bump way beyond that.

afaict the dotnet/runtime specific changes (quick script generated) for PR #11175 are

0f64b26...5d0817a

and this does not have the tvOS changes (so I'm not too worried about my current results)

@spouliot
Copy link
Contributor

The current dotnet/installer has the missing commits

5d0817a...3ffaab9

Maestro has not (yet) updated the PR but doing a local build with the following diff worked (or at least it build)
https://gist.github.com/spouliot/78aabb8c09a6127da2e5b8ee0a7a0123

@ghost ghost locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants