Proper way to enable static linking?

What is the proper way to enable static linking in OpenFL?

We’re trying to set our game to not ship with a separate lime.ndll for our Windows releases but no matter how I configure our project XML, it still adds a separate lime.ndll. I’ve tried:

<set name=“static” />

<haxeflag name="-D static" />

<haxeflag name="-D static_link" />

…but none of those seem to work.

The reason I’m asking is that we had players successfully run the exe from the folder directly, but if they create a shortcut to the exe and put it on their desktop, they get an error saying lime.ndll can’t be found. I did some research and this seems to have also been an issue with Dicey Dungeons.

Our current setup is Haxe 3.4.7, OpenFL 8.9.6, and Lime 7.6.3.

<haxeflag name="-static" />

I tried that and got “Error: : unknown option ‘-static’” when compiling

Hmm… what about when you compile via commandline like
openfl test windows -static

Looks like I got most of the way through it, then hit an interesting error.

“LINK : fatal error LNK1181: cannot open input file ‘C:\HaxeToolkit\haxe\lib\lime\7,6,3\ndll\Windows64\liblime-19.lib’”

Seems like liblime-19.lib is missing. Trying to look into what step I’m missing to fix this.

Away from computer and typing on phone, but try this
lime rebuild windows -static -clean
It’s gonna take a while, but will build the missing static lime lib.

‘lime rebuild windows’ does nothing on my machine. No output, no errors.

I was able to successfully run ‘lime rebuild hxcpp’.

Seems this was an issue for some other devs a while back.

Got ‘lime rebuild windows’ to work after grabbing the project files from the Lime Github. Will update once my rebuild finishes.

So this finally worked!

To summarize what I had to do in case others need help:

  1. Either point your lime install to use the dev version on Github or clone the lime Github repo and copy the project/lib folder into your lime/project/lib directory. Apparently these folders are not fetched if you do “haxelib install lime” because they point to other external Github libraries.
  2. Run ‘lime rebuild windows -static -clean’ and wait for it to finish. If you run the command and there is no output, that means it didn’t build and you need to grab or change the project files mentioned in step 1 from Github.
  3. You should now be able to do “haxelib run lime [project] windows -release -static” to get a statically linked EXE

Thank you @intoxopox for your help :slight_smile:


Lime does not include static binaries because they are so large and because they are dependent on the exact toolchain version you are using.

These are the right steps :smile: