On Monday, 12 May 2025 at 15:03:00 UTC, mw wrote:

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.


In the dub `libs:["mylibname_noext"]` + `lflags:["-L/Path/to/lib"]`

In side: `-L-L/path -L-lmylibname_noext`.

If you need to pass a specific file (.o, .obj, .a, .lib) add in `sourceFiles:["..."]`

The problem presented shows that this library possibly has other dependencies.

Have you looked into the cuda community? I did a quick search and saw a similar problem involving cuda12.

Unfortunately, I've never tried anything involving cuda. Sorry if this doesn't answer properly.

Reply via email to