MacCatalyst clang: error: linker command failed with exit code 1 · Issue #19258 · dotnet/macios (original) (raw)

Steps to Reproduce

  1. Sorry that I don't have an easy way to reproduce this. I tried a new Maui Hello World project and it builds and runs fine for MacCatalyst. @rolfbjarne asked me to create a new issue here.
  2. My project previously built and ran fine for MacCatalyst. It was only after that last VS updates that I started getting the clang error.
  3. Here is the error I am getting:

/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/16.4.7107/targets/Xamarin.Shared.Sdk.targets(1272,3): error : clang++ exited with code 1:
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/16.4.7107/targets/Xamarin.Shared.Sdk.targets(1272,3): error : ld: warning: ignoring duplicate libraries: '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmonosgen-2.0', '-lxamarin-dotnet-debug'
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/16.4.7107/targets/Xamarin.Shared.Sdk.targets(1272,3): error : ld: building for 'macCatalyst', but linking in object file (/Users/charlesyoung/Projects/jiffyLog2/obj/Debug/net7.0-maccatalyst/maccatalyst-x64/linker-cache/lame.framework/lame[x86_64]2) built for 'iOS-simulator'
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/16.4.7107/targets/Xamarin.Shared.Sdk.targets(1272,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)
0 Warning(s)
1 Error(s)

Expected Behavior

Link successfully

Actual Behavior

clang: error: linker command failed with exit code 1

Environment

Version information

Visual Studio Community 2022 for Mac
Version 17.6.5 (build 417)
Installation UUID: 9ecc4e19-b627-40f2-ab6d-f56425c5174e

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.309/Sdks
SDK Versions:
    7.0.309
    7.0.308
    7.0.302
    7.0.203
    7.0.202
    7.0.201
    7.0.200
    7.0.103
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    7.0.12
    7.0.11
    7.0.5
    7.0.4
    7.0.3

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode: 14.3 21812
Build: 15A240d

Xamarin.Mac
Version: 9.3.0.18 Visual Studio Community
Hash: 9d266025e
Branch: xcode14.3
Build date: 2023-09-06 19:52:26-0400

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/charlesyoung/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        8.0  (API level 26)
        12.0 (API level 31)
        8.1  (API level 27)
        11.0 (API level 30)
        10.0 (API level 29)
        13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information: 
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

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2023-10-04 18:09:18 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2023-10-04 18:09:18 UTC

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2023-10-04 18:09:13 UTC

Xamarin.iOS
Version: 16.4.0.18 Visual Studio Community
Hash: 9d266025e
Branch: xcode14.3
Build date: 2023-09-06 19:52:27-0400

Build Information
Release ID: 1706050417
Git revision: 6d6585a706becbd4a5be3b0e99ace260dfdf5748
Build date: 2023-10-04 18:07:26+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.0.0
Darwin 23.0.0 Darwin Kernel Version 23.0.0
    Fri Sep 15 14:41:34 PDT 2023
    root:xnu-10002.1.13~1/RELEASE_ARM64_T8103 arm64

Enabled user installed extensions
Project System Tools 0.13

Build Logs

jiffyLog_Debug_Build_2023-10-17T12_54_04.9444050Z.msbuild.log

Example Project (If Possible)