Raylib-cs icon indicating copy to clipboard operation
Raylib-cs copied to clipboard

Add arm64 dylib version for macOS

Open emillaine opened this issue 3 years ago • 3 comments
trafficstars

Issue description

This package only provides libraylib.dylib for osx-x64, but not for arm64. Trying to use this on a M1 Mac causes the following error:

System.DllNotFoundException: Unable to load shared library 'raylib' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:
dlopen(libraylib, 1): image not found

After manually adding the arm64 dylib (installed via brew install raylib) under bin/Debug/net6.0/runtimes/osx.11.0-arm64/native/ and making the related config changes, the code runs without errors.

Environment

  • OS: macOS Big Sur 11.6.5

Code example

I used the example code from the readme.

emillaine avatar Sep 03 '22 13:09 emillaine

@emlai Raylib-cs uses the native libs included in the official raylib releases so this is not currently supported. Though we are considering custom builds in #118 which could allow other platforms to be added.

rgebee avatar Sep 03 '22 14:09 rgebee

It seems that starting from raylib 4.2.0, they do provide a universal (x64 + arm64) dylib in their official release:

$ file /Users/emlai/Downloads/raylib-4.2.0_macos/lib/libraylib.dylib 
/Users/emlai/Downloads/raylib-4.2.0_macos/lib/libraylib.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
/Users/emlai/Downloads/raylib-4.2.0_macos/lib/libraylib.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/Users/emlai/Downloads/raylib-4.2.0_macos/lib/libraylib.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

emillaine avatar Sep 03 '22 14:09 emillaine

@emlai Thanks for looking into this. In that case it should be included in the 4.2 release.

rgebee avatar Sep 18 '22 19:09 rgebee

Any progress on this? Still unable to build any project using Raylib-cs or Raylib-CsLo in Visual Studio Mac.

Testing on a MacBook Air M1.

leftbones avatar Jan 09 '23 18:01 leftbones