Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

The .csproj referenced architecture-specific x86_64 dylibs, causing linker failures when building for arm64. The build script already produces universal binaries containing both x86_64 and arm64 slices.

Changes

  • Updated NativeReference entries in UsbSerialForMacOS.csproj to point to universal dylib paths:
    • Native/build/dylib/maccatalyst/x86_64/libUsbSerialForMacOS.dylibNative/build/dylib/maccatalyst/UsbSerialForMacOS.dylib
    • Native/build/dylib/macos/x86_64/libUsbSerialForMacOS.dylibNative/build/dylib/macos/UsbSerialForMacOS.dylib

The universal binaries are created by build-dylib.sh via lipo -create and contain both architectures. No native build configuration or API changes.

Original prompt

Task: Fix Mac Catalyst arm64 build failure caused by UsbSerialForMacOS

You are a senior macOS / .NET MAUI engineer with deep experience in:

Mac Catalyst

Apple Silicon (arm64)

Objective-C / Swift native libraries

.NET MAUI native bindings

Static linking and Xamarin registrar

Context

MakerPrompt is a cross-platform .NET MAUI app

UsbSerialForMacOS is a native macOS USB serial library maintained in a separate repository

MakerPrompt depends on UsbSerialForMacOS

macCatalyst x64 builds succeed

macCatalyst arm64 builds fail at link time

Observed Error
Undefined symbols for architecture arm64:
"OBJC_CLASS$_UsbSerialManager"

This indicates the native UsbSerialForMacOS binary does not contain an arm64 slice.

Goal

Produce a single, clean PR that makes maccatalyst-arm64 builds succeed without breaking x64.

🔬 Technical Objectives

  1. Inspect UsbSerialForMacOS native build output

Locate the native static or dynamic library being linked

Verify current architectures using lipo -info

Confirm arm64 is missing

  1. Fix native library architecture support

One of the following must be implemented (prefer highest-quality option):

Preferred

Update Xcode project to build universal binary (x86_64 + arm64)

Ensure compatibility with Mac Catalyst

Rebuild native library

Verify with lipo

Acceptable fallback (if Catalyst APIs differ)

Add explicit Mac Catalyst target

Ensure symbols are exported correctly for Catalyst

  1. Update binding / NuGet integration

Ensure MakerPrompt references the corrected native binary

No breaking API changes

No behavioral changes

  1. Validate build

dotnet publish must succeed for:

maccatalyst-x64

maccatalyst-arm64

No linker errors

No runtime regressions

🚫 Constraints

Do NOT change MakerPrompt behavior

Do NOT introduce runtime architecture checks

Do NOT disable UsbSerialForMacOS for arm64

Do NOT add conditional compilation hacks unless unavoidable

Keep diffs minimal and reviewable

📦 Pull Request Requirements
PR Title
Fix Mac Catalyst arm64 build by adding arm64 support to UsbSerialForMacOS

PR Description Must Include

Root cause explanation (missing arm64 slice)

What was changed in native build configuration

Confirmation that universal binary is now produced

Explicit statement:

“No functional or API changes were made”

🧠 Mental Model

Think like a native toolchain engineer:

The problem is link-time, not runtime

The registrar requires symbols at build time

The fix must occur in the native binary, not in C#

If arm64 symbols are not present, the build must fail.

Proceed carefully and produce a clean, minimal PR.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: akinbender <40242943+akinbender@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Mac Catalyst arm64 build failure due to UsbSerialForMacOS Fix Mac Catalyst arm64 build by referencing universal dylibs Jan 17, 2026
Copilot AI requested a review from akinbender January 17, 2026 16:08
@akinbender akinbender marked this pull request as ready for review January 17, 2026 16:17
@akinbender akinbender merged commit b1e2a2e into main Jan 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants