Error while loading shared libraries:

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

./a.out: error while loading shared libraries: 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 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:

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

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/ /data/nvhpc/Linux_x86_64/23.7/cuda/12.2/targets/x86_64-linux/lib/

Thank you for the response!

The result of l libnvJitLink* in that directory is :*  libnvJitLink_static.a*

what is the result of:

ldd a.out


You’re right, it is still unable to locate
Here’s the output: (0x00007ffc55da9000) => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/ (0x00007ff5bb9cf000) => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/ (0x00007ff5b49c8000) => /lib/x86_64-linux-gnu/ (0x00007ff5b49af000) => /lib/x86_64-linux-gnu/ (0x00007ff5b498c000) => /lib/x86_64-linux-gnu/ (0x00007ff5b4986000) => /lib/x86_64-linux-gnu/ (0x00007ff5b47a2000) => /lib/x86_64-linux-gnu/ (0x00007ff5b4653000) => /lib/x86_64-linux-gnu/ (0x00007ff5b4638000) => /lib/x86_64-linux-gnu/ (0x00007ff5b4446000)
	/lib64/ (0x00007ff5c232b000) => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/ (0x00007ff59247c000) => not found => /data/nvhpc/Linux_x86_64/23.7/math_libs/12.2/lib64/ (0x00007ff582733000)

what is the result of:

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




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 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.