MonoGame / MonoGame.Dependencies

The MonoGame binary dependencies submodule.
38 stars 51 forks source link

libassimp.dylib is not compiled with macos arm64 support #160

Open gelvinp opened 2 years ago

gelvinp commented 2 years ago

Trying to build my monogame project that imported a .fbx file on an AS mac gave me the following error:

error: Importer 'FbxImporter' had unexpected failure!
Assimp.AssimpException: Error loading unmanaged library from path: libassimp.dylib

I noticed that the dotnet-mgcb runtimes folder had a osx-x64 entry, so I tried copying that and renaming it osx-arm64. The error changed to the following:

error: Importer 'FbxImporter' had unexpected failure!
Assimp.AssimpException: Error loading unmanaged library from path: /Users/patrick/.nuget/packages/dotnet-mgcb/3.8.1.263/tools/net6.0/any/runtimes/osx-arm64/native/libassimp.dylib

I then used homebrew to install assimp directly, and copied libassimp.5.2.0.dylib into the runtime directory, but while this did let mgcb load the library, it still failed to build with the following error:

error: Importer 'FbxImporter' had unexpected failure!
System.OverflowException: Arithmetic operation resulted in an overflow.

I assumed that the version was newer than what was expected, and checked the original x64 dylib which reported version 4.1.0. By downloading the source for assimp from the 4.1.0 release and compiling it myself to make an arm64 library, then copying that library into runtimes/osx-arm64/native, I was able to build and run my monogame project.