How to build static linked executable

Jacob Carlborg doob at me.com
Tue Mar 20 16:04:18 UTC 2018


On Tuesday, 20 March 2018 at 10:37:55 UTC, zunkree wrote:

> So, how to build static binary for macOS?

I don't see a need to do that. I build static binaries on Linux 
because they work across all distros and all versions. But for 
macOS, there are no distros. For supporting multiple versions, or 
rather an older version than you're building on, you can use the 
"-macosx_version_min" linker flag. See [1] for an example.

If you really want a static binary, I think it's possible if 
you're calling the kernel directly (I think Go can do this). But 
then most of D would not work, since it builds on the C standard 
library.

[1] 
https://github.com/jacob-carlborg/dstep/blob/19a5ddb8ad3f44b3445c89840155bb7cd1ee44b7/dub.json#L20

--
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list