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

[mono] Fix compilation errors for iOS-arm64 sample #47115

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Jan 18, 2021

It doesn't build currently: we don't need entrypoint.c (references symbols iOS doesn't have e.g. from pal_console)
Also $(PackageRID) is evaluated as osx-x64 instead of arm64-x64, here is where my cross-compiler is defined:

icrosoft.netcore.app.runtime.ios-arm64/Release/runtimes/ios-arm64/native/cross/osx-arm64/mono-aot-cross

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@EgorBo
Copy link
Member Author

EgorBo commented Jan 18, 2021

The sample still doesn't work, it crashes with:

HelloiOS[681:153330] ((null) error) mono_gc_pthread_create Cannot transition thread 0x16b77b000 from 
STATE_BLOCKING with DO_BLOCKING

on start but at least it builds now.

@lambdageek
Copy link
Member

Crash is tracked in #47121 - it's probably due to the hybrid suspend switch recently in #46873

@lambdageek
Copy link
Member

@EgorBo I get a crash event if I revert the hybrid suspend change:

bt
* thread #2, name = 'tid_1103', queue = 'com.apple.root.default-qos', stop reason = signal SIGSEGV
  * frame #0: 0x00000001084f752c HelloiOS`mono_arch_get_call_target(code="") at tramp-amd64.c:802:6
    frame #1: 0x00000001083eb2fe HelloiOS`method_address_resolve(code_addr="") at aot-runtime.c:2130:18
    frame #2: 0x00000001083e0cc4 HelloiOS`load_aot_module(alc=0x0000600003561f00, assembly=0x0000600003b68240, user_data=0x0000000000000000, error=0x0000700003e1c928) at aot-runtime.c:2451:13
    frame #3: 0x000000010808cff6 HelloiOS`mono_assembly_invoke_load_hook_internal(alc=0x0000600003561f00, ass=0x0000600003b68240) at assembly.c:2078:4
    frame #4: 0x000000010808eb6a HelloiOS`mono_assembly_request_load_from(image=0x00007ffa0a008200, fname="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", req=0x0000700003e1cb30, status=0x0000700003e1cb6c) at assembly.c:3397:2
    frame #5: 0x000000010808e44b HelloiOS`mono_assembly_request_open(filename="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", open_req=0x0000700003e1cbb8, status=0x0000700003e1cb6c) at assembly.c:2854:8
    frame #6: 0x000000010808fa4e HelloiOS`mono_assembly_open(filename="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", status=0x0000000000000000) at assembly.c:3208:8
    frame #7: 0x000000010857fa1b HelloiOS`load_assembly(name="System.Private.CoreLib", culture=0x0000000000000000) at runtime.m:105:34
    frame #8: 0x000000010857f19b HelloiOS`assembly_preload_hook(aname=0x0000600002d7e3a0, assemblies_path=0x0000000000000000, user_data=0x0000000000000000) at runtime.m:117:12
    frame #9: 0x0000000108090e65 HelloiOS`invoke_assembly_preload_hook(alc=0x0000600003561f00, aname=0x0000600002d7e3a0, apath=0x0000000000000000) at assembly.c:2306:15
    frame #10: 0x00000001080913ea HelloiOS`mono_assembly_load_corlib(runtime=0x00000001089a14b8, status=0x0000700003e1d74c) at assembly.c:4704:11
    frame #11: 0x0000000108088636 HelloiOS`mono_init_internal(filename="dotnet.ios", exe_filename=0x0000000000000000, runtime_version="mobile") at domain.c:611:9
    frame #12: 0x0000000108088e54 HelloiOS`mono_init_version(domain_name="dotnet.ios", version="mobile") at domain.c:893:9
    frame #13: 0x00000001082f20c5 HelloiOS`mini_init(filename="dotnet.ios", runtime_version="mobile") at mini-runtime.c:4561:12
    frame #14: 0x00000001083b357d HelloiOS`mono_jit_init_version(domain_name="dotnet.ios", runtime_version="mobile") at driver.c:2937:20
    frame #15: 0x000000010857edcf HelloiOS`mono_ios_runtime_init at runtime.m:263:5
    frame #16: 0x000000010857e165 HelloiOS`__29-[ViewController viewDidLoad]_block_invoke(.block_descriptor=0x00000001089ceb10) at main.m:49:9
    frame #17: 0x00000001094fa7ec libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #18: 0x00000001094fb9c8 libdispatch.dylib`_dispatch_client_callout + 8
    frame #19: 0x00000001094fde46 libdispatch.dylib`_dispatch_queue_override_invoke + 1032
    frame #20: 0x000000010950d508 libdispatch.dylib`_dispatch_root_queue_drain + 351
    frame #21: 0x000000010950de6d libdispatch.dylib`_dispatch_worker_thread2 + 135
    frame #22: 0x00007fff60c8e453 libsystem_pthread.dylib`_pthread_wqthread + 244
    frame #23: 0x00007fff60c8d467 libsystem_pthread.dylib`start_wqthread + 15
(lldb) p mono_threads_suspend_policy()
(MonoThreadsSuspendPolicy) $0 = MONO_THREADS_SUSPEND_FULL_PREEMPTIVE

This is an x64 simulator. compiled using make all MONO_CONFIG=Debug MONO_ARCH=x64 USE_LLVM=false AOT=true

@EgorBo
Copy link
Member Author

EgorBo commented Jan 19, 2021

@EgorBo I get a crash event if I revert the hybrid suspend change:

bt
* thread #2, name = 'tid_1103', queue = 'com.apple.root.default-qos', stop reason = signal SIGSEGV
  * frame #0: 0x00000001084f752c HelloiOS`mono_arch_get_call_target(code="") at tramp-amd64.c:802:6
    frame #1: 0x00000001083eb2fe HelloiOS`method_address_resolve(code_addr="") at aot-runtime.c:2130:18
    frame #2: 0x00000001083e0cc4 HelloiOS`load_aot_module(alc=0x0000600003561f00, assembly=0x0000600003b68240, user_data=0x0000000000000000, error=0x0000700003e1c928) at aot-runtime.c:2451:13
    frame #3: 0x000000010808cff6 HelloiOS`mono_assembly_invoke_load_hook_internal(alc=0x0000600003561f00, ass=0x0000600003b68240) at assembly.c:2078:4
    frame #4: 0x000000010808eb6a HelloiOS`mono_assembly_request_load_from(image=0x00007ffa0a008200, fname="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", req=0x0000700003e1cb30, status=0x0000700003e1cb6c) at assembly.c:3397:2
    frame #5: 0x000000010808e44b HelloiOS`mono_assembly_request_open(filename="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", open_req=0x0000700003e1cbb8, status=0x0000700003e1cb6c) at assembly.c:2854:8
    frame #6: 0x000000010808fa4e HelloiOS`mono_assembly_open(filename="/Users/alklig/Library/Developer/CoreSimulator/Devices/350A24D5-075C-4A14-9C70-E6BBAAC7C039/data/Containers/Bundle/Application/31DF40E5-8ABA-46D9-8FD5-893398D2F40B/HelloiOS.app/System.Private.CoreLib.dll", status=0x0000000000000000) at assembly.c:3208:8
    frame #7: 0x000000010857fa1b HelloiOS`load_assembly(name="System.Private.CoreLib", culture=0x0000000000000000) at runtime.m:105:34
    frame #8: 0x000000010857f19b HelloiOS`assembly_preload_hook(aname=0x0000600002d7e3a0, assemblies_path=0x0000000000000000, user_data=0x0000000000000000) at runtime.m:117:12
    frame #9: 0x0000000108090e65 HelloiOS`invoke_assembly_preload_hook(alc=0x0000600003561f00, aname=0x0000600002d7e3a0, apath=0x0000000000000000) at assembly.c:2306:15
    frame #10: 0x00000001080913ea HelloiOS`mono_assembly_load_corlib(runtime=0x00000001089a14b8, status=0x0000700003e1d74c) at assembly.c:4704:11
    frame #11: 0x0000000108088636 HelloiOS`mono_init_internal(filename="dotnet.ios", exe_filename=0x0000000000000000, runtime_version="mobile") at domain.c:611:9
    frame #12: 0x0000000108088e54 HelloiOS`mono_init_version(domain_name="dotnet.ios", version="mobile") at domain.c:893:9
    frame #13: 0x00000001082f20c5 HelloiOS`mini_init(filename="dotnet.ios", runtime_version="mobile") at mini-runtime.c:4561:12
    frame #14: 0x00000001083b357d HelloiOS`mono_jit_init_version(domain_name="dotnet.ios", runtime_version="mobile") at driver.c:2937:20
    frame #15: 0x000000010857edcf HelloiOS`mono_ios_runtime_init at runtime.m:263:5
    frame #16: 0x000000010857e165 HelloiOS`__29-[ViewController viewDidLoad]_block_invoke(.block_descriptor=0x00000001089ceb10) at main.m:49:9
    frame #17: 0x00000001094fa7ec libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #18: 0x00000001094fb9c8 libdispatch.dylib`_dispatch_client_callout + 8
    frame #19: 0x00000001094fde46 libdispatch.dylib`_dispatch_queue_override_invoke + 1032
    frame #20: 0x000000010950d508 libdispatch.dylib`_dispatch_root_queue_drain + 351
    frame #21: 0x000000010950de6d libdispatch.dylib`_dispatch_worker_thread2 + 135
    frame #22: 0x00007fff60c8e453 libsystem_pthread.dylib`_pthread_wqthread + 244
    frame #23: 0x00007fff60c8d467 libsystem_pthread.dylib`start_wqthread + 15
(lldb) p mono_threads_suspend_policy()
(MonoThreadsSuspendPolicy) $0 = MONO_THREADS_SUSPEND_FULL_PREEMPTIVE

This is an x64 simulator. compiled using make all MONO_CONFIG=Debug MONO_ARCH=x64 USE_LLVM=false AOT=true

AFAIK we don't build the sample in AOT on CI nor we run tests for iOS-AOT so it could be in the broken state for quite a while.

@steveisok
Copy link
Member

We build the sample on CI, but don't set the AOT params. As for the functional tests, we're blocked on a few things. #47057 is the first one and the second is that the simulator hangs.

@EgorBo EgorBo merged commit 878f618 into dotnet:master Jan 19, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants