dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

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

Closed vasile135 closed 2 years ago

vasile135 commented 2 years ago

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

jsuarezruiz commented 2 years ago

cc @rolfbjarne

rolfbjarne commented 2 years ago

@vasile135 could you get a binary build log and attach it here?

vasile135 commented 2 years ago

@vasile135 could you get a binary build log and attach it here?

Sure. msbuild.zip

rolfbjarne commented 2 years ago

This issue was moved to xamarin/xamarin-macios#16861