Skip to content

Add arm64 macOS bindings and build support#1960

Draft
perlun wants to merge 1 commit intomono:mainfrom
perlun:add-macos-bindings
Draft

Add arm64 macOS bindings and build support#1960
perlun wants to merge 1 commit intomono:mainfrom
perlun:add-macos-bindings

Conversation

@perlun
Copy link
Contributor

@perlun perlun commented Feb 21, 2026

(See #1708)

I've generated these bindings by copying the /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include folder from my Mac into build/headers/osx/include on a linux-amd64 machine, and executed CppSharp.Parser.Gen (after applying #1959). With this in place, and adding the change to src/CppParser/Bindings/CSharp/CppSharp.Parser.CSharp.csproj, we get slightly closer to building on macOS... but we're note quite there yet. Running ./build.sh -configuration Release on my Mac gives me this now:

  CppSharp.Parser net10.0 succeeded (0.2s) → /Users/per/git/CppSharp/bin/Release/CppSharp.Parser.dll
  CppSharp.Generator net10.0 succeeded (0.5s) → /Users/per/git/CppSharp/bin/Release/CppSharp.Generator.dll
  Encodings.Gen net10.0 failed with 1 error(s) (1.8s) → /Users/per/git/CppSharp/bin/Release/Encodings.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/Encodings.Gen.dll"" exited with code 134.
  Encodings.Tests.CSharp net10.0 failed with 1 warning(s) (0.0s)
    /Users/per/git/CppSharp/tests/dotnet/Encodings/Encodings.Tests.CSharp.csproj : warning NU1903: Package 'Newtonsoft.Json' 9.0.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
  VTables.Gen net10.0 failed with 1 error(s) (0.5s) → /Users/per/git/CppSharp/bin/Release/VTables.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/VTables.Gen.dll"" exited with code 134.
  VTables.Tests.CSharp net10.0 failed with 1 warning(s) (0.0s)
    /Users/per/git/CppSharp/tests/dotnet/VTables/VTables.Tests.CSharp.csproj : warning NU1903: Package 'Newtonsoft.Json' 9.0.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
  CLI.Gen net10.0 failed with 1 error(s) (0.5s) → /Users/per/git/CppSharp/bin/Release/CLI.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/CLI.Gen.dll"" exited with code 134.
  CSharp.Gen net10.0 failed with 1 error(s) (0.5s) → /Users/per/git/CppSharp/bin/Release/CSharp.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/CSharp.Gen.dll"" exited with code 134.
  CppSharp.Parser.Gen net10.0 succeeded (0.1s) → /Users/per/git/CppSharp/bin/Release/CppSharp.Parser.Gen.dll
  CppSharp.CLI net10.0 succeeded (0.1s) → /Users/per/git/CppSharp/bin/Release/CppSharp.CLI.dll
  Common.Gen net10.0 failed with 1 error(s) (0.6s) → /Users/per/git/CppSharp/bin/Release/Common.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/Common.Gen.dll"" exited with code 134.
  Common.Tests.CSharp net10.0 failed with 1 warning(s) (0.0s)
    /Users/per/git/CppSharp/tests/dotnet/Common/Common.Tests.CSharp.csproj : warning NU1903: Package 'Newtonsoft.Json' 9.0.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
  StandardLib.Gen net10.0 failed with 1 error(s) (0.5s) → /Users/per/git/CppSharp/bin/Release/StandardLib.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/StandardLib.Gen.dll"" exited with code 134.
  CSharp.Tests.CSharp net10.0 failed with 1 warning(s) (0.0s)
    /Users/per/git/CppSharp/tests/dotnet/CSharp/CSharp.Tests.CSharp.csproj : warning NU1903: Package 'Newtonsoft.Json' 9.0.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
  CppSharp.Generator.Tests net10.0 succeeded with 1 warning(s) (0.1s) → /Users/per/git/CppSharp/bin/Release/CppSharp.Generator.Tests.dll
    /Users/per/git/CppSharp/src/Generator.Tests/CppSharp.Generator.Tests.csproj : warning NU1903: Package 'Newtonsoft.Json' 9.0.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
  NamespacesDerived.Gen net10.0 failed with 1 error(s) (0.3s) → /Users/per/git/CppSharp/bin/Release/NamespacesDerived.Gen.dll
    /Users/per/.dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(6046,5): error MSB3073: The command "dotnet "/Users/per/git/CppSharp/bin/Release/NamespacesDerived.Gen.dll"" exited with code 134.
  NamespacesDerived.Tests.CSharp net10.0 failed with 1 warning(s) (0.0s)

And trying to run one of these Gen-programs manually gives me this:

❯ dotnet "/Users/per/git/CppSharp/bin/Release/Encodings.Gen.dll"

Generating bindings for Encodings (CSharp)
Unhandled exception. System.EntryPointNotFoundException: Unable to find an entry point named '?' in shared library 'Std-symbols'.
   at Std.BasicStringExtensions.__Internal.Data(IntPtr __instance)
   at Std.BasicStringExtensions.__Internal.Data(IntPtr __instance)
   at Std.BasicStringExtensions.Data(BasicString`3 this) in /Users/per/git/CppSharp/src/CppParser/Bindings/CSharp/arm64-apple-darwin12.4.0/Std.cs:line 525
   at CppSharp.Parser.AST.NativeLibrary.get_FileName() in /Users/per/git/CppSharp/src/CppParser/Bindings/CSharp/arm64-apple-darwin12.4.0/CppSharp.CppParser.cs:line 248
   at CppSharp.ClangParser.ConvertLibrary(NativeLibrary library) in /Users/per/git/CppSharp/src/Parser/Parser.cs:line 70
   at CppSharp.Driver.ParseLibraries() in /Users/per/git/CppSharp/src/Generator/Driver.cs:line 190
   at CppSharp.ConsoleDriver.Run(ILibrary library) in /Users/per/git/CppSharp/src/Generator/Driver.cs:line 426
   at CppSharp.Tests.EncodingsTestsGenerator.Main(String[] args) in /Users/per/git/CppSharp/tests/dotnet/Encodings/Encodings.Gen.cs:line 27
Abort trap: 6

The error indicates that something is wrong with Std-symbols, which does not seem to have been properly compiled. On my Mac:

❯ find . -name Std-symbols\*
./build/gmake/projects/Std-symbols.make
./src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc-d/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/i686-pc-win32-msvc-d/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/arm64-apple-darwin12.4.0/Std-symbols.cpp
./src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std-symbols.cpp

On my Linux machine, the .o files for this file exists (below), so I presume that there's some more file that needs to be tweaked for it to be generated during the build. Do you happen to know where this is controlled?

❯ find . -name Std-symbols\*.o
./build/obj/Std-symbols/DebugOpt/Std-symbols.o
./build/obj/Std-symbols/Release/Std-symbols.o
./build/gen/Common/Std-symbols.o
./build/gen/Encodings/Std-symbols.o
./build/gen/VTables/Std-symbols.o
./build/gen/CSharp/Std-symbols.o

@perlun perlun marked this pull request as draft February 21, 2026 06:34
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.

1 participant