-l namespec --library=namespec Add the archive or object file specified by namespec to the list of files to link. This option may be used any number of times. If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a.
I noticed that older versions do not support it, so check man ld-l or --library option on your system.
You could also link to the file mentioning its full name
I don’t know about the specific application, but sometimes it’s indeed necessary to set in a small wrapper script to the application an additional LD_LIBRARY_PATH before starting the application. Which library will be used can be checked by:
Code:
$ ldd program
Another variable you can try is LD_PRELOAD if it’s still using the wrong libraries.
Another approach to make it more happen automatically for you: install the new libraries in a different location (i.e. go back to the initial setup of the libraries in your system). Then you can change the rpath to the libraries directly in the compiled application by the tool:
Code:
$ chrpath program
which can change the written rpath to libraries during the link step of the application. You can check the binary whether it was changed correctly by:
Code:
$ readelf -d program
If there was no rpath compiled in, you can also add the appropriate option already to the link step.
1. The linker is able to accept filenames toogcc app.o -l:libmy.so.1 -o appFrom man ld:-l namespec--library=namespecAdd the archive or object file specified by namespec to the list of