AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.68k stars 2.14k forks source link

Error: "Undefined symbols for architecture arm64" when building projects to iPad #15346

Open bearyung opened 3 months ago

bearyung commented 3 months ago

Describe the bug

Repo project that demonstrates the issue: https://github.com/bearyung/DemoNew

Open the solution and run it on the physical iOS device (e.g. iPad with iOS 17.2)

Below error shows during deploying the solution:

1>Xamarin.Shared.Sdk.targets(1559,3): Error : clang++ exited with code 1: Undefined symbols for architecture arm64: "_SSLClose", referenced from: _AppleCryptoNative_SslShutdown in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) "_SSLCopyALPNProtocols", referenced from: _AppleCryptoNative_SslGetAlpnSelected in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) "_SSLCopyDistinguishedNames", referenced from: _AppleCryptoNative_SslCopyCADistinguishedNames in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) "_SSLCopyPeerTrust", referenced from: _AppleCryptoNative_SslCopyCertChain in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) _AppleCryptoNative_SslIsHostnameMatch in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) "_SSLCreateContext", referenced from: _AppleCryptoNative_SslCreateContext in libSystem.Security.Cryptography.Native.Apple.a(pal_ssl.c.o) "_SSLGetNegotiatedCipher", referenced from: _AppleCryptoNative_SslGetCipherSuite in libSystem.Security.Cryptography.Native.Apple.

To Reproduce

(I am using Rider 2024.1 on OSX)

  1. Install the latest Avalonia Templates dotnet new install Avalonia.Templates

  2. Creating a new Application dotnet new avalonia.xplat -av 11.1.0-beta1 -o DemoNew

  3. Open the solution DemoNew with Rider created above

  4. Nuget the NetCoreServer v.8.0.7

  5. Create a simple TCP server (ChatServer.cs and ChatSession.cs in the sample repo)

  6. Run the Project in iOS Simulator (success)

  7. Run the project in iOS device (failed)

Expected behavior

The project should be able to compiled and run on iOS device. The project have no issues in compiling and running on iOS device when using Avalonia 11.0.10.

Avalonia version

11.1.0-beta

OS

iOS

Additional context

No response

maxkatz6 commented 3 months ago

It seems .NET runtime still uses these deprecated API https://github.com/dotnet/runtime/blame/v8.0.4/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ssl.c#L594 https://developer.apple.com/documentation/security/1397869-sslclose

Could you try to reproduce this issue without Avalonia and report it in https://github.com/dotnet/runtime repository? Create project via:

mkdir test_ios
cd test_ios

dotnet new install Microsoft.iOS.Templates
dotnet new ios

And apply same steps to reproduce this issue.

bearyung commented 3 months ago

It seems .NET runtime still uses these deprecated API https://github.com/dotnet/runtime/blame/v8.0.4/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ssl.c#L594 https://developer.apple.com/documentation/security/1397869-sslclose

Could you try to reproduce this issue without Avalonia and report it in https://github.com/dotnet/runtime repository? Create project via:

mkdir test_ios
cd test_ios

dotnet new install Microsoft.iOS.Templates
dotnet new ios

And apply same steps to reproduce this issue.

Thanks! Can reproduce the same issue using only the Microsoft.iOS.Templates, will report issues on dotnet/runtime repository.

But do you know why it can be compiled and deployed to iOS device using Avalonia.Template 11.0.10 and Avalonia 11.0.10?

maxkatz6 commented 3 months ago

But do you know why it can be compiled and deployed to iOS device using Avalonia.Template 11.0.10 and Avalonia 11.0.10?

It's not related to Avalonia, but we have updated .NET TargetFramework at some point from 6 to 8. It could be a regression in .NET 8, potentially.

will report issues on dotnet/runtime repository

Thanks, please attach dotnet issue in here later, so other will be able to find it.

bearyung commented 3 months ago

But do you know why it can be compiled and deployed to iOS device using Avalonia.Template 11.0.10 and Avalonia 11.0.10?

It's not related to Avalonia, but we have updated .NET TargetFramework at some point from 6 to 8. It could be a regression in .NET 8, potentially.

will report issues on dotnet/runtime repository

Thanks, please attach dotnet issue in here later, so other will be able to find it.

It makes sense. Thanks for the additional information.

bearyung commented 3 months ago

Reported the issue in https://github.com/dotnet/runtime/issues/101005