Search code examples
ubuntuconan.so

How to include all .so libraries across subdirectories


I have a bunch of .so libraries and I would like to include them similarly to this question (Ubuntu 18.04).

I have followed the steps from the most upvoted answer from user1824407

I created .conf file

sudo gedit /etc/ld.so.conf.d/so_libraries.conf

And then I started adding the .so libraries into the file like this:

/home/developer/.conan/.../lib

But it is very clumsy, in the /.conan/ directory there is a lot of subdirectories with the .so libraries. Is there any way to automatically include all the .sos in the .conan directory? Writing just /home/developer/.conan does not work.

Thank you very much in advance for any help.


Solution

  • Using find:

     find /home/developer/.conan -name "*.so" -printf "%h\n" | sort | uniq > /etc/ld.so.conf.d/so_libraries.conf
    

    Find all the files with .so extensions in the directory/child directories and print only the leading directories (%h) and not the file names. Pipe through to sort and uniq to remove duplicates and output the results to the config file.