Is this dub link flag (-L-lcudart_static) a bug?

mw m at g.c
Mon May 12 15:03:00 UTC 2025


Hi,

With

```
$ dub --version
DUB version 1.39.0, built on Mar 20 2025
$ ldc2 --version
LDC - the LLVM D compiler (1.40.1):
```

dub.json:

```
"lflags": [
   ...
   "-L/usr/local/cuda/lib64",
   "-lcudart_static",
   ...
         ],
```

I got a link error: `undefined reference to 
'cudaGetDeviceProperties_v2'`.

by adding `--vverbose` dub option, I found the final expanded 
link cmd is:

```
.../ldc2/bin/ldc2 ... -L-L/usr/local/cuda/lib64 -L-lcudart_static 
...
```

This "-L-l" format does not look correct?


Then I changed the dub.json to :

```
"lflags": [
   ...
   /usr/local/cuda/lib64/libcudart_static.a
   ...
         ],
```

then it links correctly.

I'm just wondering if the dub expansion  "-L-l" format is a bug? 
(but looks like this same expansion works for other libraries?)

Thanks.



More information about the Digitalmars-d-learn mailing list