Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64 fnalibs for Apple Silicone Macs #456

Closed
SyntaxDomain opened this issue Dec 1, 2023 · 3 comments
Closed

arm64 fnalibs for Apple Silicone Macs #456

SyntaxDomain opened this issue Dec 1, 2023 · 3 comments

Comments

@SyntaxDomain
Copy link

I've followed all the instructions I can find for getting FNA running on MacOS but I'm getting this error message when the runtime attempts to load the fnalibs: "...libFNA3D.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

I was able to get the SDL2 lib by compiling a monogame project and grabbing the libSDL2.dylib file from the runtimes/osx/native output folder and then renaming it to the expected libSDL2-2.0.0.dylib. (Not that I've had a chance to see if this worked)

Things were left in a "we will wait and see" state in this issue 2.5 years ago and a link to arm64 libs doesn't go anywhere anymore:
#318

Are there any plans to support this? Is it already supported and just not documented? Am I missing something?

@thatcosmonaut
Copy link
Member

x64 on Mac is officially supported by FNA, but ARM is not. You should be able to get it to work either via Rosetta or building the native libraries for ARM yourself.

https://github.com/FNA-XNA/FNA/wiki/0:-FAQ#where-can-i-get-fnalibs-for-cpu-architecture-x

@lithiumtoast
Copy link

Hey @SyntaxDomain,

Like it was mentioned before, you just need to compile all the native C libraries that FNA depends on yourself. I did this myself in the past because I'm developing on Apple Silicon hardware.

The C projects:

What I find easiest is to use the following flag CMake flag for each C project to build as universal (both x64 and arm64):
-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64. This is how libMoltenVK.dylib and libvulkan.1.dylib are distributed with FNA libs if you check the file:

lstranks@Aeryon-SkyRanger-R70 ~ % file /Users/lstranks/Downloads/fnalibs/osx/libMoltenVK.dylib 
/Users/lstranks/Downloads/fnalibs/osx/libMoltenVK.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
/Users/lstranks/Downloads/fnalibs/osx/libMoltenVK.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/Users/lstranks/Downloads/fnalibs/osx/libMoltenVK.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64
lstranks@Aeryon-SkyRanger-R70 ~ % file /Users/lstranks/Downloads/fnalibs/osx/libvulkan.1.dylib 
/Users/lstranks/Downloads/fnalibs/osx/libvulkan.1.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
/Users/lstranks/Downloads/fnalibs/osx/libvulkan.1.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/Users/lstranks/Downloads/fnalibs/osx/libvulkan.1.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

The down side of universal native libraries for macOS is that they are approximately twice the size. If you want to reduce the total size of your game for macOS, you could have only the appropriate architecture for each native library.

The up side is that you don't have to have users select and download the appropriate native libraries for macOS; there is only one download for both.

@flibitijibibo
Copy link
Member

See FNA-XNA/docs#1 for more details, but we won't be providing prebuilt arm64 binaries - the build script should make this easy enough to do for anyone targeting Apple platforms.

@flibitijibibo flibitijibibo closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2023
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

No branches or pull requests

4 participants