-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Undefined symbols for architecture arm64 Error, while using Native libraries in MAUI iOS #24536
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
Are you building for device or for the simulator? If you're building for the simulator, I suspect you're running into the fact that we're building for arm64 for the simulator, and your .a files probably don't contain arm64 code for the simulator. There are a couple of potential fixes:
If you're seeing this problem when building for device, then please attach an MSBuild binlog so that we can see exactly what's going on during the build. |
Its not something we are using the native libraries for this first time. Its a migration work, migrating code base from Xamarin to MAUI. What other possibilities could be there,so that I can investigate in details. |
Note that arm64 for the simulator and arm64 for device are not the same and they're not interchangeable. Additionally, it's not possible to create a .a archive with both versions of arm64 (which is why Apple created the xcframework format). FWIW Xamarin didn't support arm64 in the simulator, so this was never a problem there - while it's the default build architecture when building for the simulator with .NET on an arm64 CPU.
It's hard to say without investigating the errors. You can start investigating by looking at the first symbol the build complains about:
and try to find the answer to a few questions:
You can inspect native libraries from the command line using the |
@rolfbjarne We found the root cause of the issue. But didn't found the solution. For system Frameworks in Xamarin.IOS we have used MTouchExtraArgs, and it was working fine. But same MTouchExtraArgs is not working in MAUI.iOS. All the system frameworks are already defined in MtouchExtraArgs which are causing undefined symbol error in MAUI. We are using MAUI iOS with .NET 8.
|
Can you provide an MSBuild binlog that shows the error? |
Please check the attached binlog. binlog extension is not a valid extension as an attachment. Just download the file and change the extension as binlog. |
You're building for the simulator ( |
Hi @rolfbjarne, I am building in device only. For your reference I have capture a screen recording and new msbuild binlog file. Linker Flags passing in MtouchExtraArgs: The below reference error are causing due to unavailability of system framework -framework Network, but we are passing -framework Network in MtouchExtraArgs. What ever system frameworks we are passing in MtouchExtraArgs, is not considering by MAUI. But it was working fine in Xamarin. Screen+Recording+2024-09-09+at+3.mp4Build Error: /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_17.5/17.5.8020/targets/Xamarin.Shared.Sdk.targets(3,3): Error: clang++ exited with code 1: |
That build is still for the simulator, even though you've selected a device. I think the problem is here in your csproj: <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Develop|iPhone' "> The I believe it'll work if you change the condition to: <PropertyGroup Condition=" '$(Configuration)' == 'Develop' "> Can you try that and see if anything changes? |
@rolfbjarne Still getting same error
All reference errors are causing due to ios system network framework (https://developer.apple.com/documentation/network). In Xamarin we were reffering system frameworks MtouchExtraArgs as linker flag. And this is not working in MAUI. Could you please tell how to pass ios system frameworks in MAUI? Build Error: |
Could you get an updated binlog? |
Updated binlog |
@rolfbjarne Please let me know if you need any more information to troubleshoot this native framework reference issue in MAUI for iOS. |
That's still a simulator build (the "Configuration" property is "Debug", not "Develop") |
@rolfbjarne, The issue was in the build configuration. After fixing the build configuration issue, code is building and running without any issues. |
Description
We are working on MAUI.iOS migration project from Xamarin.iOS.
In Xamarin.iOS we have used few iOS Native libraries(.a files). The Xamarion.iOS project was working fine. But when we used those native libraries in MAUI.iOS project we are getting build errors.
IOS Version: 17.6.1
Device Type: Real Device
--cxx -gcc_flags "-lstdc++ -L $(MSBuildProjectDirectory)/lib/debug -lc++ -lz -lcrypto -lssl -lxml2 -lmat -lsqlite3 -lmip_dotnet -lmip_upe_and_protection_sdk_static -lresolv -framework CoreTelephony -framework Foundation -framework CoreFoundation -framework CoreServices -framework Security -framework IOKit -framework UIKit -framework SystemConfiguration -framework Network -force_load $(MSBuildProjectDirectory)/lib/debug/libcrypto.a -force_load $(MSBuildProjectDirectory)/lib/debug/libssl.a -force_load $(MSBuildProjectDirectory)/lib/debug/libmat.a -force_load $(MSBuildProjectDirectory)/lib/debug/libsqlite3.a -force_load $(MSBuildProjectDirectory)/lib/debug/libmip_dotnet.a -force_load $(MSBuildProjectDirectory)/lib/debug/libmip_upe_and_protection_sdk_static.a" --registrar:static --aot=nopagetrampolines,ntrampolines=40960,nrgctx-trampolines=40960,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4096,nimt-trampolines=4096 --optimize=-remove-dynamic-registrar ios-arm64 Static True Static True Static True Static True Static True Static TrueVisual Studio Enterprise 2022 for Mac.ini.txt
Build Error:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_17.5/17.5.8020/targets/Xamarin.Shared.Sdk.targets(3,3): Error: clang++ exited with code 1:
Undefined symbols for architecture arm64:
"_initGenericErrorDefaultFunc", referenced from:
"_nw_path_get_status", referenced from:
"_nw_path_is_constrained", referenced from:
"_nw_path_is_expensive", referenced from:
"_nw_path_monitor_cancel", referenced from:
"_nw_path_monitor_create", referenced from:
"_nw_path_monitor_set_queue", referenced from:
"_nw_path_monitor_set_update_handler", referenced from:
"_nw_path_monitor_start", referenced from:
"_nw_path_uses_interface_type", referenced from:
"_res_9_dn_expand", referenced from:
"_res_9_nclose", referenced from: (com.microsoft.rightsmanagement.mobile.viewer.ios)
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.82 SR8.2
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: