Description
I'm encountering an issue while trying to build a project that's referencing a native binding library.
The binding project was created with .NET 7, and builds an runs with a .NET 7 project. However, in a .NET 8 project, the build fails due to "duplicate symbols" and "duplicate libraries"
I have verified that the library does not contain duplicate symbols using the method from Xamarin.iOS Errors
Here is the fgrep output for one of the symbols the log says is duplicated:
jackaardal@*** BlueRadioBrsp64 % nm lib_brsp_1.3.1.arm64.a | fgrep '_isDataModeSupported'
000000000000c9a8 S _OBJC_IVAR_$_Brsp._isDataModeSupported
jackaardal@*** BlueRadioBrsp64 %
The output is reporting that literally every symbol in the library is a duplicate.
It seems like it's trying to link from both the local path on my Windows laptop and from the remote path on the MacBook, as it's listed twice in the clang++ arguments.
I've tried multiple solutions presented in various other issues, and nothing changes.
Steps to Reproduce
- Create an iOS binding library
- Set the native reference to Static, don't enable SmartLink, and enable ForceLoad
- Reference binding project from .NET 8.0 RC2 MAUI app
- Pair to a MacBook from Windows
- Attempt to build.
Expected Behavior
App builds and is able to utilize native library
Actual Behavior
Build fails with false duplicate symbol errors.
duplicate symbol '_OBJC_IVAR_$_Brsp._serviceDiscoveryCount' in:
D:/Nuget/blueradiobrsp64/1.1.0-preview1017/lib/net7.0-ios16.1/BlueRadioBrsp64.resources/lib_brsp_1.3.1.a(Brsp.o)
/Users/jackaardal/Library/Caches/Xamarin/mtbs/builds/KinesiaOne/7669fae6a0e78117d3638e4eb3145c6038ab08ffdc3d331766a0d10d73a8f661/D:/Nuget/blueradiobrsp64/1.1.0-preview1017/lib/net7.0-ios16.1/BlueRadioBrsp64.resources/lib_brsp_1.3.1.a(Brsp.o)
Environment
Windows Development Environment
[System Summary]
Item Value
OS Name Microsoft Windows 11 Business
Version 10.0.22621 Build 22621
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name ***
System Manufacturer Dell Inc.
System Model Precision 7550
System Type x64-based PC
System SKU 09C3
Processor Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 2592 Mhz, 6 Core(s), 12 Logical Processor(s)
BIOS Version/Date Dell Inc. 1.21.0, 2/13/2023
SMBIOS Version 3.2
Embedded Controller Version 255.255
BIOS Mode UEFI
BaseBoard Manufacturer Dell Inc.
BaseBoard Product 04JGVR
BaseBoard Version A01
Platform Role Mobile
Secure Boot State On
PCR7 Configuration Elevation Required to View
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume1
Locale United States
Hardware Abstraction Layer Version = "10.0.22621.1413"
User Name ***
Time Zone Eastern Daylight Time
Installed Physical Memory (RAM) 32.0 GB
Total Physical Memory 31.6 GB
Available Physical Memory 13.4 GB
Total Virtual Memory 63.6 GB
Available Virtual Memory 36.1 GB
MacOS Development Environment
Model: MacBook Pro 17
CPU: Apple M1
RAM: 16GB
OS: macOS Sonoma 14.1
Version information
Microsoft Visual Studio Community 2022
Version 17.8.0 Preview 5.0
VisualStudio.17.Preview/17.8.0-pre.5.0+34219.65
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA965
Microsoft Visual C++ 2022
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 17.8.345.5765
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.8.345.5765
Azure App Service Tools v3.0.0
Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 17.8.345.5765
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 4.8.0-3.23517.14+be69ebdb4e1da91e51c83fce238cf107c1d5bc15
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 17.0.23262.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Extensibility Message Bus 1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.8.17 (957fbed)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Office Developer Tools for Visual Studio 17.6.34024.01
Microsoft Office Developer Tools for Visual Studio
Python - Profiling support 17.0.23262.1
Profiling support for Python projects.
Python with Pylance 17.0.23262.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Razor (ASP.NET Core) 17.8.3.2351103+cc267329450bc99a027494153251905b45ede2a3
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.8.117.1
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.8.0-3.23517.14+be69ebdb4e1da91e51c83fce238cf107c1d5bc15
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 17.8.0.151 (d17-8@5ca38ed)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.8.3.6 (remotes/origin/d17-8@eccf46a291)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.8.16 (830b56a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
Xamarin.iOS and Xamarin.Mac SDK 16.4.0.18 (9d266025e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Build Logs
msbuild-asnuget.zip
msbuild-asproject.zip
Example Project (If Possible)
I'm unable to provide an example project, as the library is proprietary, and we don't have permission to share it.