Dustmite and linking error

Vladimir Panteleev thecybershadow.lists at gmail.com
Sat Sep 4 06:28:44 UTC 2021


On Saturday, 4 September 2021 at 06:18:52 UTC, JG wrote:
> I tried again. What am I doing wrong?
>
> cp source ~/tmp/source
> cd ~/tmp/source
> dub build --config prog1 2>&1 | grep "collect2: error: ld 
> returned 1 exit status"
> echo $? #produces 0
> find . -name *.o -delete
> ~/d/DustMite/dustmite -j ./ 'dub build --config prog1 2>&1 | 
> grep "collect2: error: ld returned 1 exit status"'
> cd ../source.reduced
> dub build --config prog1 2>&1 | grep "collect2: error: ld 
> returned 1 exit status"
> echo $? #produces 1

One potential source of trouble is using Dub. Dub doesn't play 
well with tools such as DustMite, because it keeps state outside 
of the current directory. In some cases, it even writes to that 
state, which works very poorly especially with `-j`. Dub has a 
built-in "dustmite" command, though it is a bit limited - you 
could use `dub -v` to get the compiler and linker commands that 
Dub runs, and run them directly from your test command.

Some bugs do not reproduce 100% of the time, and are random in 
nature, due to depending on memory layout or thread timing. Try 
running the test command a number of times and see if that 
affects the result.

Regardless, your workflow looks OK from a high level - the 
source.reduced directory should indeed contain the contents of a 
directory for which the test command did return 0, for one reason 
or another.



More information about the Digitalmars-d-learn mailing list