How do I statically build a project using DUB?

Andre Pany andre at s-e-a-p.de
Sat Aug 29 12:06:38 UTC 2020


On Saturday, 29 August 2020 at 11:27:28 UTC, Kirill wrote:
> I need a stand-alone executable that does not require the user 
> to install any libraries on their computer. Everything should 
> be packed into the executable.
>
> I understand that I need to statically link all of the 
> libraries I use in my project, but how do I do this? What do I 
> need to add to dub.json file? What compiler flags do I need to 
> use?
>
> Thanks in advance.

This highly depends on your actual project:

- which 3rd party dependencies do you have
- are these dependencies d source code only or wrapping C 
libraries
- is the c source code of your dependencies available and you are 
able to create a static library of them
- does the license of the c dependencies allows static linking

Kind regards
Andre



More information about the Digitalmars-d-learn mailing list