I am trying to add a library folder to my Ubuntu system.

The library folder I am trying to update the system with is: /home/user/programs/elastix/lib.

I have tried the following things: I first checked LD_LIBRARY_PATH ervironmental variable:



And it just contains 1 folder (?). Anyway I checked ld.so.conf:

$ cat /etc/ld.so.conf

include /etc/ld.so.conf.d/*.conf

and just included all config files in ld.so.conf.d folder.

-rw-rw-r-- 1 root root  38 Nov 24  2014 fakeroot-x86_64-linux-gnu.conf  
-rw-r--r-- 1 root root 108 Jan 15  2018 i386-linux-gnu.conf   lrwxrwxrwx 1 root root  41 May 15  2018 i386-linux-gnu_EGL.conf -> /etc/alternatives/i386-linux-gnu_egl_conf   lrwxrwxrwx 1 root root  40 May 15  2018 i386-linux-gnu_GL.conf ->  /etc/alternatives/i386-linux-gnu_gl_conf  
-rw-r--r-- 1 root root  44 Jan 27  2016 libc.conf  
-rw-r--r-- 1 root root  38 Nov 14 17:16 randomLibs.conf  
-rw-r--r-- 1 root root  26 May 17 10:44 tensorflow_lib.conf  
-rw-r--r-- 1 root root  68 Apr 15  2016 x86_64-linux-gnu.conf   lrwxrwxrwx 1 root root  43 May 15  2018 x86_64-linux-gnu_EGL.conf -> /etc/alternatives/x86_64-linux-gnu_egl_conf    lrwxrwxrwx 1 root root  42 Sep 14 17:16 x86_64-linux-gnu_GL.conf -> > /etc/alternatives/x86_64-linux-gnu_gl_conf  
-rw-r--r-- 1 root root  56 Jan 15  2018 zz_i386-biarch-compat.conf

It contains 11 config files. This seems rather peculiar since 1 link for 11 (non empty) config files does not make sense.

I added manually the folder to the ld.so.conf file:

$ cat /etc/ld.so.conf

include /etc/ld.so.conf.d/*.conf  

and run

$ sudo ldconfig

to update the cache. This error message occurs and I guess nothing is updated also.

/sbin/ldconfig.real: /usr/local/cuda-9.0/lib64/libcudnn.so.7 is not a symbolic link


The only way I can make it work is by specifically adding the folder in console:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/programs/elastix/lib

So, my question is what's going on here? Why my shared libraries are not updated using ldconfig and why I can only see 1 folder in LD_LIBRARY_PATH also?

According to this post I could move my shared libraries to these folders:

  • /lib/
  • /usr/lib/
  • /usr/local/lib/

and make it work but I would like to know what's the problem with the previous approach.

I am using Ubuntu 16.04 by the way.

  • Please code formatting for command output, not quote formatting. – muru Nov 15 '18 at 7:50
  • And how it would be distinguished by command evoking? – Eypros Nov 15 '18 at 7:52
  • Put a $ in front of the command. – muru Nov 15 '18 at 8:00

There is a naming convention for shared object libraries:

The "real" library file should be named libcudnn.so.7.0. From that file two soft links should be created:

$ sudo mv /usr/local/cuda-9.0/lib64/libcudnn.so.7 /usr/local/cuda-9.0/lib64/libcudnn.so.7.0
$ sudo ln -s /usr/local/cuda-9.0/lib64/libcudnn.so.7.0 /usr/local/cuda-9.0/lib64/libcudnn.so.7
$ sudo ln -s /usr/local/cuda-9.0/lib64/libcudnn.so.7.0 /usr/local/cuda-9.0/lib64/libcudnn.so

This allows the compiler to be called with the -lcudnn switch. Also ldconfig seams to verify this convention. See also this (link).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.