Skip to content

Conversation

@take-cheeze
Copy link
Contributor

@take-cheeze take-cheeze commented Nov 18, 2025

Since most FindCUDNN.cmake's static feature seems to be broken from cudnn v8 I've like to fix it.
libcudnn_static.a isn't included at least from v9 and there is more tricks needed to link static cudnn documented in:
https://docs.nvidia.com/deeplearning/cudnn/installation/latest/build-run-cudnn.html#running-a-cudnn-dependent-program

In this PR, I'll add 2 hint flags:

I've tried

cmake -GNinja -Bbuild -S. -DCUDNN_STATIC_LINK=ON -DCUDNN_SKIP_PRECOMPILED_LINK=ON
cmake --build build
./build/bin/samples

working and result of ldd seems to be minimum as I expect:

$ ldd ./build/bin/samples 
        linux-vdso.so.1 (0x0000789a47e99000)
        libcudart.so.12 => /usr/local/cuda-12.8/targets/x86_64-linux/lib/libcudart.so.12 (0x00007899f2c00000)
        libcuda.so.1 => /lib/x86_64-linux-gnu/libcuda.so.1 (0x00007899ece00000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007899eca00000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007899f2f17000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007899f2ee9000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007899ec600000)
        /lib64/ld-linux-x86-64.so.2 (0x0000789a47e9b000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x0000789a47e67000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000789a47e62000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007899f2ee4000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant