xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

ios binding project with xcframework fails to link #18688

Closed rolfbjarne closed 1 year ago

rolfbjarne commented 1 year ago

From @dodikk on Tue, 07 Mar 2023 20:05:04 GMT

Description

Steps to Reproduce

Expected Behavior The build succeeds.

Actual Behavior The build fails with Undefined symbols for architecture arm64

Steps to Reproduce

Steps to Reproduce

Link to public reproduction project repository

https://github.com/dodikk/themis-maui-prototype

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, I was not able test on other platforms

Affected platform versions

ios 16

Did you find any workaround?

No

Relevant log output

Building target "_LinkNativeExecutable" completely.   
        Tool xcrun execution finished (exit code = 1).

        Undefined symbols for architecture arm64:
          "_OBJC_CLASS_$_TSCell", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSCellContextImprint", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSCellSeal", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSCellToken", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSCellTokenEncryptedData", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSCellTokenEncryptedResult", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSComparator", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSKeyGen", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSMessage", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSSession", referenced from:
              objc-class-ref in registrar.o
          "_OBJC_CLASS_$_TSSessionTransportInterface", referenced from:
              objc-class-ref in registrar.o
          "_TSGenerateSymmetricKey", referenced from:
             -u command line option
        ld: symbol(s) not found for architecture arm64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)


_Copied from original issue dotnet/runtime#89633_
rolfbjarne commented 1 year ago

From @dotnet-issue-labeler[bot] on Thu, 09 Mar 2023 18:19:30 GMT

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

rolfbjarne commented 1 year ago

From @msftbot[bot] on Fri, 21 Jul 2023 12:49:00 GMT

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Steps to Reproduce * Download the sample project https://github.com/dodikk/themis-maui-prototype * Build the ThemisMauiSample.sln which includes native iOS bindings created from the xcframework Expected Behavior The build succeeds. Actual Behavior The build fails with Undefined symbols for architecture arm64 ### Steps to Reproduce Steps to Reproduce * Download the sample project https://github.com/dodikk/themis-maui-prototype * Build the ThemisMauiSample.sln which includes native iOS bindings created from the xcframework ### Link to public reproduction project repository https://github.com/dodikk/themis-maui-prototype ### Version with bug 7.0 (current) ### Last version that worked well Unknown/Other ### Affected platforms iOS, I was *not* able test on other platforms ### Affected platform versions ios 16 ### Did you find any workaround? No ### Relevant log output ```shell Building target "_LinkNativeExecutable" completely. Tool xcrun execution finished (exit code = 1). Undefined symbols for architecture arm64: "_OBJC_CLASS_$_TSCell", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellContextImprint", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellSeal", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellToken", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellTokenEncryptedData", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellTokenEncryptedResult", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSComparator", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSKeyGen", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSMessage", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSSession", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSSessionTransportInterface", referenced from: objc-class-ref in registrar.o "_TSGenerateSymmetricKey", referenced from: -u command line option ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` ```
Author: dodikk
Assignees: -
Labels: `untriaged`, `area-VM-meta-mono`, `os-ios`
Milestone: -
rolfbjarne commented 1 year ago

From @steveisok on Fri, 21 Jul 2023 12:50:49 GMT

@dalexsoto I believe this needs transferred to the xam ios repo.

rolfbjarne commented 1 year ago

From @SamMonoRT on Fri, 28 Jul 2023 13:42:56 GMT

Transferring back to runtime repo (since Xamarin isn't the correct repo to move this issue to).

rolfbjarne commented 1 year ago

From @msftbot[bot] on Mon, 31 Jul 2023 15:28:49 GMT

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Steps to Reproduce * Download the sample project https://github.com/dodikk/themis-maui-prototype * Build the ThemisMauiSample.sln which includes native iOS bindings created from the xcframework Expected Behavior The build succeeds. Actual Behavior The build fails with Undefined symbols for architecture arm64 ### Steps to Reproduce Steps to Reproduce * Download the sample project https://github.com/dodikk/themis-maui-prototype * Build the ThemisMauiSample.sln which includes native iOS bindings created from the xcframework ### Link to public reproduction project repository https://github.com/dodikk/themis-maui-prototype ### Version with bug 7.0 (current) ### Last version that worked well Unknown/Other ### Affected platforms iOS, I was *not* able test on other platforms ### Affected platform versions ios 16 ### Did you find any workaround? No ### Relevant log output ```shell Building target "_LinkNativeExecutable" completely. Tool xcrun execution finished (exit code = 1). Undefined symbols for architecture arm64: "_OBJC_CLASS_$_TSCell", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellContextImprint", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellSeal", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellToken", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellTokenEncryptedData", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSCellTokenEncryptedResult", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSComparator", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSKeyGen", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSMessage", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSSession", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_TSSessionTransportInterface", referenced from: objc-class-ref in registrar.o "_TSGenerateSymmetricKey", referenced from: -u command line option ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` ```
Author: dodikk
Assignees: -
Labels: `untriaged`, `area-VM-meta-mono`, `os-ios`
Milestone: -
rolfbjarne commented 1 year ago

From @steveisok on Mon, 31 Jul 2023 15:33:48 GMT

Transferring back to runtime repo (since Xamarin isn't the correct repo to move this issue to).

Did you find this is something we can fix in runtime?

rolfbjarne commented 1 year ago

From @SamMonoRT on Mon, 31 Jul 2023 23:21:07 GMT

Transferring back to runtime repo (since Xamarin isn't the correct repo to move this issue to).

Did you find this is something we can fix in runtime?

No, moved it to xamarin repo and not the right XI repo. Not sure how to do so.

rolfbjarne commented 1 year ago

From @SamMonoRT on Mon, 31 Jul 2023 23:22:05 GMT

@dalexsoto @mandel-macaque - please take a look again. Doesn't seem like a runtime issue.

rolfbjarne commented 1 year ago

@dodikk

The provided test project builds fine for me, both for device and the simulator.

Could you please provide a binlog that shows the build error on your side?

See https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs for how to get a binlog.

microsoft-github-policy-service[bot] commented 1 year ago

Hi @rolfbjarne. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

kapilntt commented 1 year ago

For the people encountering this issue, here is my observation that will take you one step forward till you encounter the next thing. In my opinion, the issue is related to the binding project not compiling (linking) all external frameworks into the binding DLL. Earlier in Xamarin, the binding DLL used to be 12MB which is now 45KB.

As a temporary step, you should copy all the following three into your Maui project

This will at least allow you to compile your head projects. Once you go through this, you may encounter https://github.com/xamarin/xamarin-macios/issues/18761

microsoft-github-policy-service[bot] commented 1 year ago

Hi @rolfbjarne. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Youssef1313 commented 1 year ago

@rolfbjarne Not sure if this is the same issue, but https://github.com/unoplatform/uno/issues/13416 has a binlog.

rolfbjarne commented 1 year ago

@Youssef1313 no, that's a different issue (I commented on that issue).

Re-marking as need-info from @dodikk, re: https://github.com/xamarin/xamarin-macios/issues/18688#issuecomment-1672589130

microsoft-github-policy-service[bot] commented 1 year ago

Hi @rolfbjarne. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

microsoft-github-policy-service[bot] commented 1 year ago

Hi @rolfbjarne. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you.

akghasemi commented 2 months ago

I have the same issue with binding xcframework library, when building the binding library everything works fine but as I want to use it in my project, I get the same error above, is there any workaround for this?

rolfbjarne commented 2 months ago

@akghasemi please file a new issue and attach an MSBuild binlog and we'll have a look.

akghasemi commented 2 months ago

@rolfbjarne Thanks for your response . I have created #21142