The application built with neko can't run normally

I am just starting to learn openfl. After I built my first project with command “openfl build neko”, I run the application located in “…/neko/bin”. The program just instantly quit after I run it. How can I solve this problem? Thanks.

Platform: OS X 10.10.1

There’s a bug somewhere in your app, maybe you just forgot putting a semicolon or something like that. So you need to see debug info or some output. You might want to see the console of your IDE or just compile for Flash for debug info. If you want debug info for Flash, make sure to install the debug Flash Player for your OS.

1 Like

Be sure to compile in debug mode lime test neko -debug to get the most infos.

Also know that neko’s default values are null and not 0 for int and floats, and any operation like addition,multiplication… between a number and a null will result in a crash.

You may also want, like @Alex said, to compile to another target to compare, try the mac target since it is the closest, though win/linux/mac targets don’t have null as default value so this kind of bug won’t appear in these targets.

It compiles so that can’t be the problem.

But I even tried copy the sample code “PiratePig” and build it, the neko version still can’t run (html5 and flash version work)

Maybe your neko installation has issues,
what are the output of these two commands: neko and neko test?

Zhus-MacBook-Pro:HelloWorld zetasq$ neko
NekoVM 2.0.0 ©2005-2013 Haxe Foundation
Usage : neko
Zhus-MacBook-Pro:HelloWorld zetasq$ neko test
The virtual machine is working !
Calling a function inside std library…
Test successful

Here is the terminal record.

So your neko installation is fine,
maybe try the simplest openfl sample like DisplayingABitmap,
if that doesn’t work then for some reason your computer doesn’t like openfl app.

Did you try lime test mac, a bit long to compile and may require lime setup mac, but it should show if the problem comes from the lime ndll.

Oh and is your mac and neko 32 bits, 64 bits? It’s fine as long as they’re both the same.

I tried “lime test mac”, and it compiles and runs the program successfully. But the program I built with “openfl build neko” still can’t run. It just quit instantly.

Maybe I have a 32 bit Neko? How can I uninstall the 32-bit Neko and install a 64-bit Neko?

Not sure if that will work on mac, but try ```ldd `which neko````

and see if it’s compiled against 32 or 64 bits library, on linux they are respectively in /lib/ and /lib64/.

If you want to go from 32 to 64 neko simply remove everything from neko,
for me on linux it’s /usr/lib/, /usr/lib/neko/, /usr/bin/neko, /usr/bin/nekoc and /usr/bin/nekotools,
and then simply install the new one like the old one was.

I searched the web, it seems that I do have the 64-bit Neko, otherwise system would give a prompt that certain .dll files could not be found.

It’s really strange…I enter the application package contents folder, run the program in /MacOS, here’s the log:

Zhus-MacBook-Pro:~ zetasq$ /Users/zetasq/Desktop/HelloWorld/Export/mac64/neko/bin/ ; exit;
Called from openfl/_v2/utils/ByteArray.hx line 757
Called from openfl/_v2/Lib.hx line 248
Called from openfl/_v2/Lib.hx line 391
Called from openfl/_v2/Lib.hx line 193
Called from /usr/lib/haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(237) : Failed to load library : lime.ndll (dlopen(lime.ndll, 1): image not found)

I’m not familiar with the mac os application folder structure, but you need to launch it from the folder where the ndll file is or neko won’t find it.

Just now I use terminal to run my program like “./Helloworld”, it runs successfully.
But then I double-clicked the file in finder the program still quit instantly. What’s the difference between terminal run and click run?

It has to do with the current working directory when running the application, Neko has some known issues in findings it’s libraries at runtime, I would recommend using a standard c++ build at this time, long-term I’m looking at whether Java, node.js or patches to Neko would be ideal for a dynamic desktop target

Thanks a lot. It’s just that c++ building process takes much more time than neko

The first time, but after that only your code will be recompiled, if necessary, so that’s actually not that slow.

Unless you change a compiler flag, in which case everything gets recompiled.