Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 16, 2021 is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
i want to compile individual module that are required to compile the main module. i just start learning D yeserday, i tried to compile serve-D LSP tobe used with SublimeLSP. i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe third party tool? alternative to dub? |
February 16, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bokuno_D | On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote:
> i run "dub build" on it. but OOM kill the compiler.
> -
> is there a way to reduce memory consumtion of the compiler?
> or maybe third party tool? alternative to dub?
Assuming you are using DMD, there is -lowmem switch to enable garbage collection (it is off by default for faster builds)
open dub.json, add dflags array with -lowmem, something like this line:
"dflags": [ "-lowmem" ],
then build normally, if you have gdc or ldc dub might pick first compiler in %PATH%, compiler can be selected with --compiler option
dub build --compiler=dmd
|
February 16, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Tuesday, 16 February 2021 at 17:06:21 UTC, evilrat wrote: > On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote: >> i run "dub build" on it. but OOM kill the compiler. >> - >> is there a way to reduce memory consumtion of the compiler? >> or maybe third party tool? alternative to dub? > > Assuming you are using DMD, there is -lowmem switch to enable garbage collection (it is off by default for faster builds) > > open dub.json, add dflags array with -lowmem, something like this line: > > "dflags": [ "-lowmem" ], Ideally this would work, but https://issues.dlang.org/show_bug.cgi?id=20699. Does work with ldc though. You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. |
February 16, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anonymouse | On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: > You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. singleFile is for single-file packages [1]. The option you're thinking of is --build-mode=separate. [1] https://dub.pm/advanced_usage.html#single-file |
February 16, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Tuesday, 16 February 2021 at 17:26:06 UTC, Paul Backus wrote: > On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: >> You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. > > singleFile is for single-file packages [1]. The option you're thinking of is --build-mode=separate. > > [1] https://dub.pm/advanced_usage.html#single-file No, I do mean singleFile. $ dub build --build-mode=singleFile --force Performing "debug" build using /usr/local/bin/ldc2 for x86_64. arsd-official:characterencodings 9.1.2: building configuration "library"... Compiling ../../.dub/packages/arsd-official-9.1.2/arsd-official/characterencodings.d... Linking... arsd-official:dom 9.1.2: building configuration "library"... Compiling ../../.dub/packages/arsd-official-9.1.2/arsd-official/dom.d... Linking... lu 1.1.2: building configuration "library"... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/common.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/container.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/conv.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/deltastrings.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/json.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/meld.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/numeric.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/objmanip.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/package.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/semver.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/serialisation.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/string.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/traits.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/typecons.d... Compiling ../../.dub/packages/lu-1.1.2/lu/source/lu/uda.d... Linking... dialect 1.1.1: building configuration "library"... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/common.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/defs.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/package.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/parsing.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/postprocessors/package.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/postprocessors/twitch.d... Compiling ../../.dub/packages/dialect-1.1.1/dialect/source/dialect/semver.d... Linking... cachetools 0.3.1: building configuration "library"... Compiling ../../.dub/packages/cachetools-0.3.1/cachetools/source/cachetools/cache.d... Compiling ../../.dub/packages/cachetools-0.3.1/cachetools/source/cachetools/cache2q.d... Compiling ../../.dub/packages/cachetools-0.3.1/cachetools/source/cachetools/cachelru.d... Compiling ../../.dub/packages/cachetools-0.3.1/cachetools/source/cachetools/containers/hashmap.d... ^C |
February 16, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anonymouse | On Tuesday, 16 February 2021 at 17:49:42 UTC, Anonymouse wrote:
> On Tuesday, 16 February 2021 at 17:26:06 UTC, Paul Backus wrote:
>> On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote:
>>> You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM.
>>
>> singleFile is for single-file packages [1]. The option you're thinking of is --build-mode=separate.
>>
>> [1] https://dub.pm/advanced_usage.html#single-file
>
> No, I do mean singleFile.
>
> $ dub build --build-mode=singleFile --force
> [...]
I stand corrected. Shouldn't have trusted the documentation so much, I guess.
|
February 17, 2021 Re: is it posible to compile individual module separately? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Tuesday, 16 February 2021 at 18:54:08 UTC, Paul Backus wrote: > I stand corrected. Shouldn't have trusted the documentation so much, I guess. It makes perfect sense to intuit that --single should be related to --build-mode=singleFile. As it is the build modes aren't explained in the documentation at all[1], so there's no way of knowing, short of running it to see what happens. Not ideal, perhaps. > --build-mode=<value> > Specifies the way the compiler and linker are invoked. Valid values: > separate (default), allAtOnce, singleFile (Nothing about what they do.) [1]: https://dub.pm/commandline |
Copyright © 1999-2021 by the D Language Foundation