Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: polikuo on March 18, 2021, 08:01:07 AM
-
I just compiled a batch of FLTK libraries that supports Xft.
Traditionally, to deal with alternatives in the older extensions.
The approach was to replace the current libraries via the tce.installed script.
This time, I passed --libdir=/usr/local/lib/fltk-xft to configure script as a custom path.
I want to keep them both, and ideally to pick the one I need with /etc/ld.so.conf in the startup script.
What is the proper way for that ?
I tried switching order, then calling ldconfig, but it doesn't yield.
P.S. I had to use attachment cause the forum kept reporting Internal Server Error
-
Have you tried using LD_LIBRARY_PATH before your execute statement?
-
Have you tried using LD_LIBRARY_PATH before your execute statement?
I know that trick.
The thing is, I want to create an extension that co-exists with the other.
Make the change system wide by telling ldconfig or something like that.
Such that when I manually delete the newer libraries, the system would fall back to older ones.
Of course a quick reboot would do the trick, but I can't help wanting to know if there's a different approach for linux in general.
-
ld.so.conf is correct, but according to "man ld.so", the binary's RPATH has higher priority than the ld.so cache. If the binary happens to have a RPATH for /usr/local/lib, that dir comes first.
Many binaries do add a rpath for non-standard lib dirs like /usr/local/lib, you can check with "readelf -d /path/to/bin".
-
Hi, polikuo. Using RPATH sounds like the best option. You can change a binary's RPATH after compilation using the patchelf tool.
If you don't feel like compiling patchelf, you can download it for your architecture from here:
https://packages.debian.org/buster/patchelf
This is how you'd extract the .deb package (assuming you downloaded the amd64 package):
$ ar x patchelf_0.9\+52.20180509-1_amd64.deb
$ tar -xvf data.tar.xz
The patchelf binary will be inside the usr/bin/ directory.
Then something like this would do the trick for you:
$ patchelf --set-rpath <directory> <binary>
For example:
$ patchelf --set-rpath /usr/local/lib/fltk-xft coolapp
Now coolapp looks in /usr/local/lib/fltk-xft for libraries first, before looking in the system's default directories.