I am new to Linux and I want to add lib64/librt.so.1 to the linker command line. Can anyone suggest how to do this?
Thanks in advance
Asked
Active
Viewed 2.1k times
6
1 Answers
9
If you are compiling something and you want the compiler to search a specific directory, you can add the -L flag. Like this:
g++ -L /lib64You can also add this directory to the environment variable 'LD_LIBRARY_PATH'. Like this:
export LD_LIBRARY_PATH="/lib64"You can also use
ldconfigto add a directory to the search path. Like this:sudo ldconfig /lib64Finally, you can add the directory to
/etc/ld.so.conf.d/mylibs.conf(and rerunsudo ldconfig) to make this change permanent.echo "/lib64" | sudo tee -a /etc/ld.so.conf.d/mylibs.conf; sudo ldconfig
Pablo Bianchi
- 14,308
- 4
- 74
- 117
Vitalie Ciubotaru
- 764
- 5
- 14
-
1For 4, probably better to add a `.conf` file to the /etc/ld.so.conf.d directory – Den-Jason May 14 '20 at 12:00