001. Question
root@ubuntu01:/home/software/PopIns2/PopIns2# ./ popins2
. / popins2 : error while loading shared libraries: libbifrost.so: cannot open shared object file: No such file or directory
002, the cause of the problem
Analysis of the reason: ld prompts that the library file cannot be found, and the library file is in the current directory.
The default directories of the linker ld are /lib and /usr/lib. If they are placed in other paths, you need to let ld know where the library files are.
003. Find the file
root@ubuntu01:/home/software/PopIns2/PopIns2# find / -name " libbifrost.so "
/usr/local/lib/ libbifrost.so
/home/software/bifrost/build/src/ libbifrost.so
find: ' / run /user/ 1000 / doc': Permission denied
find: ' /run/user/ 1000 / gvfs': Permission denied
find: ' /run/user/ 127 / doc': Permission denied
find: ' /run/user/ 127 /gvfs': Permission denied
004. Solution
method 1:
Edit the /etc/ld.so.conf file and add the directory where the library file is located in a new line;
Run ldconfig to update the /etc/ld.so.cache file;
method 2:
Create any file with a .conf suffix in the /etc/ld.so.conf.d/ directory, and add the directory where the library file is located in the file;
Run ldconfig to update the /etc/ld.so.cache file;
I think the second method is more convenient, with minimal changes to the original system. Because the content of the /etc/ld.so.conf file is include /etc/ld.so.conf.d/*.conf
root@ubuntu01:/home/software/PopIns2/PopIns2# echo " /home/software/bifrost/build/src/libbifrost.so " > /etc/ld.so.conf.d/bifrost.so
root@ubuntu01 : / home/software/PopIns2/PopIns2# ldconfig ## Update library files
005. Test
root@ubuntu01:/home/software/PopIns2/PopIns2# ./popins2