Distributable native binary for Linux 64

I am building a native app in openfl and cross-compiling it on a 32 bit linux (using HXCPP_M64 flag). When I copy it to my 64 bit linux for testing and try to run it, it first gives the following error:

Error : Could not load module std@get_env__1

However, after installing neko and haxe on the 64 bit machine, the error changes to Null pointer exception, leading me to believe that it is a matter of some libraries missing. Could anyone tell me what other files I would need to put where to get it working in a new system (other than the compiled binary)?

The other machine is not meant to be a development machine and I would very strongly prefer not to have to install the entire development stack there to get it working on it. It souns like something that should be possible, considering OpenFL is also made for game development. Am I just missing something incredibly obvious?

When you build an application, you can see the libraries (such as std.so, regexp.so, zlib.so, lime.so) which are included in the same directory. You need these same binaries for the target architecture. Does lime build linux -64 work to force a 64-bit build? I have not heard of cross-compiling for 64-bit from a 32-bit system, but I suppose it might be possible :slight_smile:

Actually, I realized I should have mentioned I compiled with haxe, not lime, because the project is actually a command-line tool, and lime always made it open an (empty) UI.

Nevertheless, the previous answer helped tremendously as it led me to a solution. What sufficed for me is to copy over
into the same folder as the binary, and then everything started working. (I got this list by looking at the files “lime build” put into the same folder)

1 Like

I have a related question. I’m using lime 2.0.6, I run lime build linux.

This generates a build in export/linux64/cpp/bin, but if I run ./export/linux64/cpp/bin/Snowman, I get a lot of errors about lime functions not being found:

Could not find primitive lime_set_package__4.
... [snipped]
Could not find primitive lime_weak_ref_get__1.
Error : Null Function Pointer

It works if I run ./Snowman from that directory, but I’d like an executable that will run from any working directory - how do I make that happen?

Additionally: I was advised that the best way to make a distributable for Linux was to compile a 32-bit version, which will work on 64-bit OSes if you install the right libraries (and have an install script that takes care of that). Is this advice you would agree with?

It can be hard to try and track the directory that the executable is running from, we attempt to do this, but if it fails it won’t find the native libraries or your asset directories. Perhaps this is a case for static builds

I would recommend separate 32- and 64-bit binaries, you can build both versions from a 64-bit distribution, 64-bit users tend to prefer using a 64-bit binary, and running 32-bit libraries doesn’t always work out nicely