Undefined symbols for architecture arm64 Error, while using Native libraries in MAUI iOS

Niladri Padhy (ZEN3 INFOSOLUTIONS AMERICA INC) 0 Reputation points Microsoft Vendor
2024-08-30T10:22:37.5066667+00:00

Hi,

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 we used the native libraries in MAUI.iOS project we are getting below build errors.

IOS Version: 17.6.1

Device Type: Real Device

All version details will be found here.

Visual Studio Enterprise 2022 for Mac.ini.txt

PropertyGroup Changes in csproj file.

<PropertyGroup>

<MtouchExtraArgs>--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</MtouchExtraArgs>

<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>

</PropertyGroup>

<ItemGroup>

<NativeReference Include="......\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libcrypto.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

<NativeReference Include="..\..\..\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libmat.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

<NativeReference Include="..\..\..\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libmip_dotnet.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

<NativeReference Include="..\..\..\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libmip_upe_and_protection_sdk_static.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

<NativeReference Include="..\..\..\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libsqlite3.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

<NativeReference Include="..\..\..\AzIP-Viewer\RPMSGViewer\iOS\App\lib\Debug\libssl.a">

  <Kind>Static</Kind>

  <SmartLink>True</SmartLink>

</NativeReference>

</ItemGroup>

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:

      l002 in libmip_upe_and_protection_sdk_static.a(xml_helper.o)

  "_nw_path_get_status", referenced from:

      ____ZN9Microsoft12Applications6Events19PlatformAbstraction18NetworkInformation14SetupNetDetectEv_block_invoke.11 in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_is_constrained", referenced from:

      ____ZN9Microsoft12Applications6Events19PlatformAbstraction18NetworkInformation14SetupNetDetectEv_block_invoke.11 in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_is_expensive", referenced from:

      ____ZN9Microsoft12Applications6Events19PlatformAbstraction18NetworkInformation14SetupNetDetectEv_block_invoke.11 in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_monitor_cancel", referenced from:

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::~NetworkInformation() in libmat.a(NetworkInformationImpl.mm.o)

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::SetupNetDetect() in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_monitor_create", referenced from:

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::SetupNetDetect() in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_monitor_set_queue", referenced from:

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::SetupNetDetect() in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_monitor_set_update_handler", referenced from:

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::SetupNetDetect() in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_monitor_start", referenced from:

      Microsoft::Applications::Events::PlatformAbstraction::NetworkInformation::SetupNetDetect() in libmat.a(NetworkInformationImpl.mm.o)

  "_nw_path_uses_interface_type", referenced from:

      ____ZN9Microsoft12Applications6Events19PlatformAbstraction18NetworkInformation14SetupNetDetectEv_block_invoke.11 in libmat.a(NetworkInformationImpl.mm.o)

  "_res_9_dn_expand", referenced from:

      mipns::DnsServerResolverImpl::lookup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in libmip_upe_and_protection_sdk_static.a(dns_server_resolver_impl_static.obj)

  "_res_9_nclose", referenced from: (com.microsoft.rightsmanagement.mobile.viewer.ios)

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,594 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.