Skip to content

_LinkNativeExecutable target fails running net6.0-ios for simulator and device with native reference, works with older Xamarin.iOS #62410

@tmarkovski

Description

@tmarkovski

Description

I'm trying to run a basic dotnet new ios app with a native library linked. The build fails at target _LinkNativeExecutable with the error

ld: 17954 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The same library works just fine with Xamarin.iOS target using stable VS for Mac.
The same library, compiled for MacCatalyst target works well with net6.0-maccatalyst, identical code as ios.

My test projects are in this repo, which also includes the static libraries.
https://github.com/trinsic-id/okapi/tree/test-ios/example

Running dotnet run in the IosApp should attempt to run the app for simulator and produce the above error.
Running the other two projects (MacCatalystApp and XamarinIosApp) succeeds - the native library is linked correctly and invoked on app start.

The libraries only support x64 architectures, as I'm running intel mac. Check with lipo -info <library>.a

Reproduction Steps

Clone this repo at the specified branch

https://github.com/trinsic-id/okapi/tree/test-ios/example

Run dotnet run from the IosApp folder

Expected behavior

App should be run and static library linked correctly

Actual behavior

Linker error

ld: 17954 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Regression?

Yes. The same library works well with Xamarin.IOS target. See project under XamarionIosApp in the linked repo.

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions