Created attachment 1778
example build commands and their memory use
Manjaro/Arch x86_64, dmd 2.091.0, dub 1.19.0.
NG discussion: https://forum.dlang.org/post/[email protected]
-lowmem has no effect with dmd when the flag is passed via dub, when set in dub.sdl or dub.json as a dflag. This is despite it being included in the command printed when invoked with dub build -v.
kinke:
> Most likely because dub doesn't actually invoke the listed command,
> but uses a response file to work around cmdline length limits.
> -lowmem in response files is ignored by DMD (needs to be parsed and
> set before druntime initialization, but response file parsing needs
> druntime + GC). It works for LDC though.
Steven Schveighoffer:
> Very annoying. If there's not a bug on this yet, I'd say there needs
> to be (on DMD I would say).
(In reply to Hiroki Noda from comment #1)
> It seems dub's bug, not dmd.
>
> Maybe related: https://github.com/dlang/dub/pull/1905
dub can only work around it (that PR doesn't). Fixing this for DMD makes sure no other build tools need to take this special case into account.
Comment #3 by kubo39 — 2020-03-26T12:24:24Z
(In reply to kinke from comment #2)
> (In reply to Hiroki Noda from comment #1)
> > It seems dub's bug, not dmd.
> >
> > Maybe related: https://github.com/dlang/dub/pull/1905
>
> dub can only work around it (that PR doesn't). Fixing this for DMD makes
> sure no other build tools need to take this special case into account.
Ah, I'm wrong. sorry.
Comment #4 by zorael — 2022-03-05T16:24:02Z
Is there untractably much work involved?
I could really use -lowmem for CI builds where available memory is limited. Alternatively a way to programmatically get the commands dub (supposedly) performs, so I could just tack -lowmem onto there.
Comment #5 by hsteoh — 2022-11-04T23:37:50Z
Run dub with --vverbose and it should show the compile commands explicitly.
Comment #6 by zorael — 2022-11-05T02:31:02Z
(In reply to hsteoh from comment #5)
> Run dub with --vverbose and it should show the compile commands explicitly.
This is true, but there is no --dry-run to make it only output the commands without also building the package. So I can't programmatically capture the output and grep it with a script/short program in a neat way.
Manually copy/pasting the command into a different build system (e.g. makefiles if I can get that to work) breaks as soon as a dependency is updated and its ~/.dub/packages path changes, provided I use dub for dependency management.
Comment #7 by robert.schadek — 2024-12-13T19:07:54Z