Skip to content

Native linker warnings when building without Xcode classic linker #24045

Open

Description

@tdiehl

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

net9.0-ios workload version 26.0.9752

Description

When building a project with the new Xcode linker (not the classic linker), there are some mixed ObjC warnings that occur during the LinkNativeCode phase.

Steps to Reproduce

  1. dotnet new ios -o LinkerWarnings
  2. dotnet build LinkerWarnings.csproj -c Debug -f net9.0-ios -r iossimulator-arm64 --self-contained -v d

Note the following build warnings:

ld: warning: ignoring duplicate libraries: '-lSystem.Globalization.Native', '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmono-component-marshal-ilgen', '-lmonosgen-2.0', '-lxamarin-dotnet-debug'
ld: warning: mixed ObjC ABI, /usr/local/share/dotnet/packs/Microsoft.iOS.Runtime.iossimulator-arm64.net9.0_26.0/26.0.9752/runtimes/iossimulator-arm64/native/Microsoft.iOS.registrar.a compiled with category class properties
ld: warning: mixed ObjC ABI, /Users/todd.diehl/code/LinkerWarnings/LinkerWarnings/obj/Debug/net9.0-ios/iossimulator-arm64/nativelibraries/main.arm64.o compiled with category class properties

Minimal repro: https://github.com/tdiehl/LinkerWarning

Did you find any workaround?

Build with the classic linker by adding the following to the .csproj file.

  <PropertyGroup>
    <MtouchExtraArgs>$(MtouchExtraArgs) -gcc_flags "-Xlinker -ld_classic"</MtouchExtraArgs>
  </PropertyGroup>
  <ItemGroup>
    <_MainLinkerFlags Include="-ld_classic" />
  </ItemGroup>

Build logs

msbuild.binlog.zip

Activity

  1. rolfbjarne commented on Oct 20, 2025

    @rolfbjarne
    Member

    ld: warning: mixed ObjC ABI

    There's some information about this warning here: https://developer.apple.com/forums/thread/740231

    We'll investigate and see what we can figure out.

  2. added this to the Future milestone on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue or pull request is an enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions