mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

Running HELLO WORLD on iPhone10 gets: Thread 1: signal SIGABRT #774

Closed ghost closed 4 years ago

ghost commented 4 years ago

Steps to Reproduce

  1. Follow Microsoft Docs > .Net Embedding > "Getting started with iOS" page 2.0 Tried to create VS projct as per guide's "Create C# sample" "...name it hello-from-csharp, and save it to ~/Projects/hello-from-csharp" but this causes error: "Could not create directory ~/Projects/hello-from-csharp/hello-from-csharp. File already exists." ..even though I had deleted Projects/* first. So, I used the path "/Users/dbell/Projects" which worked ok and put the VS project here: ~/Projects/hello-from-csharp/hello-from-csharp/

2.1 Had to manually change VS > proj > Options > Build > Output > Assembly name "hello_fromcsharp" (<-- VS changed '-' to '') back to "hello-from-csharp" otherwise Xcode can't find it.

2.2 VS > Rebuild All the HELLO WORLD (HW) example proj on VS 8.5.4 on Mac 10.15.4, as per guide

N O T E : using guide's recommended project name hello-from-csharp doesn't work because VS automatically renames output "hello_from_csharp" (underscores replace dashes). So I named project with underscores: hello_from_csharp

  1. Generated ObjC using objCgen, as per guide:... cd ~/Projects/hello-from-csharp

~/PRIMARY/WORK/attempt4_3-24-20b/Embeddinator-4000/objcgen/_build/objcgen ~/Projects/hello-from-csharp/hello-from-csharp/bin/Debug/hello-from-csharp.dll --target=framework --platform=iOS --outdir=output -c --debug

RESULTED IN... "Successfully created framework: output/hello-from-csharp.framework"

  1. Created n Xcode 11.4.1 as per guide EXCEPT: Xcode > proj > General tab > Embedded Binary section was replaced by Frameworks, Libraries, and Embedded Content which ALREADY contained "hello-from-csharp.framework".

4.1 bitcode Guide reads "Disable it in your project settings" however guide screen shot shows it enabled. confusing. So I changed "Yes" to "no".

  1. Built on Xcode without error

  2. Tried to run it on my iPhone X ... iphone screen went white, as expected, but then Xcode > project hello_from_csharp > Full Path = /Users/dbell/Projects/hello_from_csharp/XCODE/hello_from_csharp/hello_from_csharp.framework

  3. Tried to run on iPhone which failed. see below "Actual Behavior"

Expected Behavior

iPhone app should display "Hello from C#"

Actual Behavior

Tried to run on iPhone, screen went white, and got error:... Thread 1 0 abort_with_payload Thread1: signal SIGABRT dyld`abort_with_payload: 0x1041c8f60 <+0>: mov x16, #0x209 0x1041c8f64 <+4>: svc #0x80 -> 0x1041c8f68 <+8>: b.lo 0x1041c8f84 ; <+36> tHREAD 1: signal SIGABRT 0x1041c8f6c <+12>: stp x29, x30, [sp, #-0x10]! 0x1041c8f70 <+16>: mov x29, sp 0x1041c8f74 <+20>: bl 0x1041c7550 ; cerror_nocancel 0x1041c8f78 <+24>: mov sp, x29 0x1041c8f7c <+28>: ldp x29, x30, [sp], #0x10 0x1041c8f80 <+32>: ret
0x1041c8f84 <+36>: ret

UPDATE 4-27-2020... dyld: Library not loaded: @rpath/hello-from-csharp.framework/hello-from-csharp Referenced from: /private/var/containers/Bundle/Application/6AB10714-7978-45D6-8ED6-16304D24EFA0/hello-from-csharp.app/hello-from-csharp Reason: image not found

Environment

VS 8.5.4 and Xcode 11.4.1 both on Macbook Pro 10.15.4

Build Logs

Example Project (If Possible)

chamons commented 4 years ago
Generated ObjC using objCgen, as per guide
Created and built to run Xcode 11.4.1 as per guide

As per guide, without exact commands run doesn't tell us much.

The error message:

dyld: Library not loaded: @rpath/hello_from_csharp.framework/hello_from_csharp

suggests that your native library is not being loaded / included in your final application.

ghost commented 4 years ago

I added more information about how I built with VS, objcgen, and Xcode.

ghost commented 4 years ago

What "image" file is missing and from where??

I just corrected the Xcode error message when I try to run...... I'm trying to figure out path and filename of what exactly is missing.

dyld: Library not loaded: @rpath/hello-from-csharp.framework/hello-from-csharp Referenced from: /private/var/containers/Bundle/Application/6AB10714-7978-45D6-8ED6-16304D24EFA0/hello-from-csharp.app/hello-from-csharp Reason: image not found

PROBLEM: My Macbook does not have directory /private/var/containers It has only /private/var

ALSO hello-fram-csharp.a is in /Users/dbell/Projects/hello-from-csharp/output

Contents of /Users/dbell/Projects/hello-from-csharp/output/hello-fram-csharp.framework/ is: Headers Info.plist MonoBundle NOTICE hello-from-csharp

whitneyschmidt commented 4 years ago

@douglaskbell Were you able to find a resolution to this issue? If not, we can dig into it further if you are able to provide us a full sample showing the issue.

whitneyschmidt commented 4 years ago

Closing this as there have not been updates for some time.

If you are still experiencing this issue please provide all the requested information then click the Reopen Issue button.

Thanks!