Skip to content

iOS build: the "-gcc_flags -dead_strip" Mtouch argument doesn't work #16861

@rolfbjarne

Description

@rolfbjarne

From @vasile135 on Fri, 18 Nov 2022 15:04:29 GMT

Description

Have a working Xamarin Forms application that relies on some iOS native static libraries.
Trying to migrate the solution to .NET MAUI.
When adding the same static libraries with the same configurations and the same gcc flag, the MAUI application build fails with:
Error: clang++ exited with code 1: duplicate symbol '_crypto_onetimeauth_verify' in: /Users/hetzner/Desktop/TestIndyLibraries/iOSBindingLibrary/bin/Debug/net7.0-ios/iOSBindingLibrary.resources/libsodium.a(libsodium_la-crypto_onetimeauth.o) /Users/hetzner/Desktop/TestIndyLibraries/iOSBindingLibrary/bin/Debug/net7.0-ios/iOSBindingLibrary.resources/libzmq.a(src_libzmq_la-tweetnacl.o)
In Xamarin, I believe that the error is addressed by the following Mtouch extra argument:
-gcc_flags -dead_strip -v

Steps to Reproduce

  1. In order to add native references, added an iOS Binding project to the MAUI solution.

  2. Added native references (one of it is C++):
    image

  3. Added an additional Mtouch argument to the application project:
    -gcc_flags -dead_strip -v

  4. Installed the nuget package that uses these native libraries (Hyperledger.Aries).

  5. When trying to build, the following error occurs:
    Error: clang++ exited with code 1: duplicate symbol '_crypto_onetimeauth_verify' in:

From here I conclude that the gcc flag was not applied.

Link to public reproduction project repository

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 16

Did you find any workaround?

No

Relevant log output

No response

Copied from original issue dotnet/maui#11477

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions