December 21, 2023
https://issues.dlang.org/show_bug.cgi?id=24293

          Issue ID: 24293
           Summary: ImportC: parallel compilation failure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: kdevel@vogtner.de

STR:
----

1. Have /usr/include/mysql/mysql.h installed in your system 2. run this bash script:

```
#!/bin/bash

set -CEeuo pipefail
#set -x

cat >| cmysql.c <<'_'
#include <mysql/mysql.h>
_

for dst in {1..9}
do
   cat >| xmysqltest${dst}.d <<'_'
import std.stdio;
import cmysql;

int main ()
{
   return 0;
}
_
done

: ${CD:=dmd}

for dst in {1..9}
do
   ${CD} xmysqltest${dst}.d &
   pids+=($!)
done

rc=0
for pid in "${pids[@]}"
do
   rv=0
   wait $pid || rv=$?
   ((rc |= $rv)) || :
   echo "exit code of process with pid <$pid>: <$rv>"
done
exit $rc
```

found:
------

xmysqltest4.d(2): Error: cannot find input file `cmysql.c`
import path[0] = [...]/dmd2/linux/bin64/../../src/phobos
import path[1] = [...]/dmd2/linux/bin64/../../src/druntime/import
xmysqltest7.d(2): Error: cannot find input file `cmysql.c`
import path[0] = [...]/dmd2/linux/bin64/../../src/phobos
import path[1] = [...]/dmd2/linux/bin64/../../src/druntime/import
/usr/include/bits/pthreadtypes.h(23): Error: unterminated string constant
starting at /usr/include/bits/pthreadtypes.h(23)
xmysqltest9.d(2): Error: cannot find input file `cmysql.c`
import path[0] = [...]/dmd2/linux/bin64/../../src/phobos
import path[1] = [...]/dmd2/linux/bin64/../../src/druntime/import
xmysqltest8.d(2): Error: cannot find input file `cmysql.c`
import path[0] = [...]/dmd2/linux/bin64/../../src/phobos
import path[1] = [...]/dmd2/linux/bin64/../../src/druntime/import
exit code of process with pid <4843>: <0>
exit code of process with pid <4844>: <0>
exit code of process with pid <4845>: <0>
exit code of process with pid <4846>: <1>
exit code of process with pid <4847>: <0>
exit code of process with pid <4848>: <1>
exit code of process with pid <4849>: <1>
exit code of process with pid <4850>: <1>
exit code of process with pid <4851>: <1>

expected: compile successfully

--