I try to compile a commandline version of my Haxe program such that it can be used on other computers. These computers do not necessarily have Haxe installed - so I need to create a static linked program. I tried compiling such a version of my program with:
haxe -main mj.MJ -cpp outCpp -D HXCPP_M64 -D static_link
However the result is dynamically linked:
$ file outCpp/MJ
MJ: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, ...
and in consequence the executables are not working on computers that do not have these libraries installed:
$ ./MJ
./MJ: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./MJ)
So obviously "-D static_link" is not enough. I then added
package mj;
#if cpp
import cpp.link.StaticStd;
#end
(compare Haxe - Create a C++ Stand-alone executable) to mj/MJ.hx file. After re-executing:
haxe -main mj.MJ -cpp outCpp -D HXCPP_M64 -D static_link
the file is still dynamically linked ... what else do I need to do on Linux?
P.S.:
$ haxe -version
3.4.2