Issues running lime on Apple M1

I am currently trying to migrate a dev environment from an older Intel Mac to one with newer M1 silicon.

After migrating to the new machine, I get the following:

$ lime
Called from C:\HaxeToolkit\haxe\std/neko/_std/Date.hx line 98
Uncaught exception - load.c(237) : Failed to load library : /usr/local/lib/neko/std.ndll (dlopen(/usr/local/lib/neko/std.ndll, 0x0001): tried: ‘/usr/local/lib/neko/std.ndll’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))))

Same thing if I try running with Rosetta:

arch -x86_64 lime
Called from C:\HaxeToolkit\haxe\std/neko/_std/Date.hx line 98
Uncaught exception - load.c(237) : Failed to load library : /usr/local/lib/neko/std.ndll (dlopen(/usr/local/lib/neko/std.ndll, 0x0001): tried: ‘/usr/local/lib/neko/std.ndll’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))))

Has anyone else had trouble getting lime working on the Mac M1/M2 hardware?

Thanks in advance for any tips!

[EDIT]

I tried installing a fresh haxe/haxelib using Homebrew, then reinstalling all haxe libs, which gets me a bit farther. Lime will run and generate a HelloWorld project, but still fails to build it:

axiom:HelloWorld grazer$ lime test neko
Called from lime/_internal/backend/native/NativeCFFI.hx line 609
Called from lime/system/CFFI.hx line 172
Called from lime/system/CFFI.hx line 306
Uncaught exception - Could not find NekoAPI interface.
Called from ? line 1
Called from CommandLineTools.hx line 1904
Called from CommandLineTools.hx line 22
Called from a C function
Called from CommandLineTools.hx line 125
Called from CommandLineTools.hx line 640
Called from lime/tools/PlatformTarget.hx line 98
Called from MacPlatform.hx line 493
Called from lime/tools/IconHelper.hx line 102
Called from lime/tools/IconHelper.hx line 364
Called from lime/tools/ImageHelper.hx line 118
Called from lime/graphics/Image.hx line 698
Called from lime/graphics/Image.hx line 1628
Called from a C function
Called from /opt/homebrew/lib/haxe/std/neko/Lib.hx line 43
Uncaught exception - load.c(237) : Failed to load library : /usr/local/lib/haxe-arm64/lib/lime/8,0,0//ndll/Mac64/lime.ndll (dlopen(/usr/local/lib/haxe-arm64/lib/lime/8,0,0//ndll/Mac64/lime.ndll, 0x0001): tried: ‘/usr/local/lib/haxe-arm64/lib/lime/8,0,0//ndll/Mac64/lime.ndll’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))), ‘/usr/local/lib/haxe-arm64/lib/lime/8,0,0/ndll/Mac64/lime.ndll’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))))

I didn’t need to do anything special to run Haxe and Lime/OpenFL on my M1 Mac Mini. I assume that enabling Rosetta is necessary, but I had already done that previously for some other software. I can run lime normally without adding arch -x86_64 or anything like that. I just used the standard .pkg installer for Haxe. Then, I installed Lime/OpenFL with haxelib command normally.

You might re-downloading the Haxe .pkg again and re-installing.

Did you, by chance, use Homebrew to install Haxe/Neko? I know that there are separate Intel and Apple Silicon versions of Homebrew (and you can install both side-by-side, actually, because they go in different locations), so which one you used may make a difference here.

Thanks for letting me know for sure that it should be working out of the box.

I think my edit got crossed with your comment, but yeah - I did install using Homebrew the second time, but it still doesn’t quite work yet. I’ll try wiping it all out and installing via the .pkg installer instead :+1:

So after doing this:

  • Uninstall Homebrew haxe
  • Download and install current/latest Haxe .pkg
  • Install haxe
  • run “haxelib setup”
  • run “haxelib install lime”

When I run lime I am back to:

$ haxelib run lime
Called from C:\HaxeToolkit\haxe\std/neko/_std/Date.hx line 98
Uncaught exception - load.c(237) : Failed to load library : /usr/local/lib/neko/std.ndll (dlopen(/usr/local/lib/neko/std.ndll, 0x0001): tried: ‘/usr/local/lib/neko/std.ndll’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))))

Everything installed from the .pkg file seems to be x86 arch, so I’m not sure why the neko lib is failing to load.

$ file /usr/local/bin/haxe
/usr/local/bin/haxe: Mach-O 64-bit executable x86_64
$ file /usr/local/lib/neko/std.ndll
/usr/local/lib/neko/std.ndll: Mach-O 64-bit bundle x86_64

You might also want to check if which haxe and which neko commands in a terminal return different paths than /usr/local/bin/haxe. /usr/local/bin/neko. It could indicate that you have another Haxe/Neko installation causing a conflict.

If that all looks good, try deleting the existing lime executable. It should be at /usr/local/bin/lime, but it might be good idea to check which lime. Once that is deleted, try running haxelib run lime setup again.

2 Likes

Thanks @joshtynjala - you’re a genius :slight_smile:

Apparently “brew uninstall haxe” left the homebrew version of neko in my path. Uninstalling that seems to have sorted everything out :+1:

Thanks again!

2 Likes