Error while loading shared libraries: libnvJitLink.so.12

I am trying to compile my cuda code but this error message was shown :

./a.out: error while loading shared libraries: libnvJitLink.so.12: cannot open shared object file: No such file or directory

I have cuda 12.2 version with latest hpc toolkit installed. They both came bundled. I have installed it in a custom location instead of /opt/ .

Any help will be great for me!

Thanks and regards
Abhishek Singh

1 Like

You may need to set your LD_LIBRARY_PATH variable correctly. Using a file find utility, locate where libnvJitLink.so is on your system. Then set your LD_LIBRARY_PATH to include that location.

I did same just now. The output of the find utility is this:
./data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/stubs/libnvJitLink.so
./data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/libnvJitLink.so.12.2.91
./data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/libnvJitLink_static.a

I then exported it as :
export LD_LIBRARY_PATH=/data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/

Error is still same. Is there any thing I am missing?

The app is expecting libnvJitLink.so.12

For some reason that does not appear to be in your /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib directory.

What is the result of:

ls /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib

?

If you have root privilege, you could try doing:

ln -s -T /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/libnvJitLink.so.12.2.91 /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/libnvJitLink.so.12

Thank you for the response!

The result of l libnvJitLink* in that directory is :

libnvJitLink.so@     libnvJitLink.so.12.2.91*
libnvJitLink.so.12@  libnvJitLink_static.a*

what is the result of:

ldd a.out

?

You’re right, it is still unable to locate libnvJitLink.so.12
Here’s the output:

linux-vdso.so.1 (0x00007ffc55da9000)
	libcublas.so.12 => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/libcublas.so.12 (0x00007ff5bb9cf000)
	libcusolver.so.11 => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/libcusolver.so.11 (0x00007ff5b49c8000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff5b49af000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff5b498c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff5b4986000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff5b47a2000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff5b4653000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff5b4638000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff5b4446000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff5c232b000)
	libcublasLt.so.12 => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/libcublasLt.so.12 (0x00007ff59247c000)
	libnvJitLink.so.12 => not found
	libcusparse.so.12 => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/libcusparse.so.12 (0x00007ff582733000)

what is the result of:

ls -l /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/libnvJitLink*

and

echo $LD_LIBRARY_PATH 

?

Thank you @Robert_Crovella !
When I set the LD_LIBRARY_PATH to /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/, it worked! All other location where libnvJitLink.so.12 was located didn’t worked.
Thank you for the help!

edit: /data/nvhpc/Linux_x86_64/23.1/cuda/12.2/targets/x86_64-linux/lib/

I thought you had done that already:

I did same. But it worked this time. And I also tried to export all other locations of nvJitLink. Only difference between then and now is I downgraded my cuda version bundled with HPC toolkit from 23.7 to 23.1 which is bundled with cuda 12.1

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.