I have dub 0.9.24 installed on my system, with ldc2 0.17.1.

When trying to manually specify DFLAGS, e.g.

DFLAGS='-cov' dub build

... I wind up getting an error back from the compiler:

ldc2: for the -cov option: may only occur zero or one times!
ldc2 failed with exit code 1.

Using -v confirms that dub is using the requested flags twice:

ldc2 -cov -cov -lib -of../../../.dub/packages/vibe-d-0.7.28/.dub/build/library-$DFLAGS-linux.posix-x86_64-ldc_0-A194332F815A1B8EC023CB96B3541A1D/libvibe-d_data.a -w -oq -od=.dub/obj -d-version=VibeLibeventDriver -d-version=Have_vibe_d_data -d-version=Have_vibe_d_utils -I../../../.dub/packages/vibe-d-0.7.28/source/ ../../../.dub/packages/vibe-d-0.7.28/source/vibe/data/bson.d ../../../.dub/packages/vibe-d-0.7.28/source/vibe/data/json.d ../../../.dub/packages/vibe-d-0.7.28/source/vibe/data/serialization.d
ldc2: for the -cov option: may only occur zero or one times!
FAIL ../../../.dub/packages/vibe-d-0.7.28/.dub/build/library-$DFLAGS-linux.posix-x86_64-ldc_0-A194332F815A1B8EC023CB96B3541A1D/ vibe-d_data staticLibrary
ldc2 failed with exit code 1.

AFAICT this happens only where there are dependencies for a project (projects without dependencies seem to do OK).

I can work around this by setting "dflags" in the dub.json file, but any insight into what's going wrong here ... ?

Thanks in advance for any advice/feedback.