-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
.NET 8 RC1 fails to NativeAOT compile when targeting ios-arm64 #91997
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptionUp until .NET RC1, NativeAOT compilation worked out of the box when targeting Now, since RC1, As a workaround, one can add Reproduction StepsRunning <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<PublishAOT>true</PublishAOT>
<!-- TODO: Temporary workaround for iOS/iOS Simulator support -->
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
</PropertyGroup>
<ItemGroup>
<!-- TODO: Temporary workaround for iOS support -->
<LinkerArg Include="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" />
<!-- TODO: Temporary workaround for .NET 8 RC1 which seems to have removed -lc++ from its linker flags -->
<LinkerArg Include="-lc++" />
</ItemGroup>
</Project> Expected behaviorCompiles out of the box. Actual behaviorDoes not compile without adding Regression?It did work in all .NET 8 previews until RC1. Known WorkaroundsAdding Configuration.NET 8.0.100-rc.1.23455.8 Other informationNo response
|
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionUp until .NET RC1, NativeAOT compilation worked out of the box when targeting Now, since RC1, As a workaround, one can add Reproduction StepsRunning <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<PublishAOT>true</PublishAOT>
<!-- TODO: Temporary workaround for iOS/iOS Simulator support -->
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
</PropertyGroup>
<ItemGroup>
<!-- TODO: Temporary workaround for iOS support -->
<LinkerArg Include="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" />
<!-- TODO: Temporary workaround for .NET 8 RC1 which seems to have removed -lc++ from its linker flags -->
<LinkerArg Include="-lc++" />
</ItemGroup>
</Project> Expected behaviorCompiles out of the box. Actual behaviorDoes not compile without adding Regression?It did work in all .NET 8 previews until RC1. Known WorkaroundsAdding Configuration.NET 8.0.100-rc.1.23455.8 Other informationNo response
|
Hello @lemonmojo I will look into this. Just for the clarification, the effort is being made towards creating a NativeAOT library for iOS-like platforms (as reported in: #88737), correct? |
Hi @ivanpovazan, yes that's correct. |
Thank you for the confirmation. As a side note: It is also possible to workaround the problem by passing |
@ivanpovazan Thx for looking into this. I'm aware that this is an unsupported scenario at the moment. From what I can tell though, with the unit tests I have in place, everything seems to be working properly. Do you happen to know if this is going to be a supported scenario in the future? Since I'm already passing custom linker flags, I'll keep the workaround I already have in place. But it's good to know that Also, I know about Kinda off-topic but since you already mentioned ICU related changes: Is the ICU stuff now embedded automatically when building with NativeAOT in library mode for iOS? Or is it still necessary to include the .dat file in the app/framework bundle? |
Yes, this is planned to be a supported scenario for .NET9, but at this point, I cannot tell for sure if it is going to be backported to .NET8.
It is still necessary to include the data file in the bundle as the file is loaded from a path: runtime/src/native/libs/System.Globalization.Native/pal_icushim_static.c Lines 171 to 184 in d40f90c
The ICU changes I was referring to were introduced here: https://github.com/dotnet/runtime/pull/90430/files when we started statically linking: |
@ivanpovazan Got you! Thx a lot for explaining the details. |
Description
Up until .NET RC1, NativeAOT compilation worked out of the box when targeting
ios-arm64
.This requires adding
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
and<LinkerArg Include="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" />
to the csproj.Everything else is pretty much standard fare.
Now, since RC1,
dotnet publish
fails because of linking errors inlibicuuc.a
related to C++.As a workaround, one can add
<LinkerArg Include="-lc++" />
to the csproj like in the example below.Reproduction Steps
Running
dotnet publish
against the following example csproj works fine because-lc++
was re-added using aLinkerArg
flag. Removing this line makes the build fail.Expected behavior
Compiles out of the box.
Actual behavior
Does not compile without adding
<LinkerArg Include="-lc++" />
.Regression?
It did work in all .NET 8 previews until RC1.
Known Workarounds
Adding
<LinkerArg Include="-lc++" />
to the csproj.Configuration
.NET 8.0.100-rc.1.23455.8
Other information
No response
The text was updated successfully, but these errors were encountered: