ld to link against an unversioned .so file?
Under linux, when I link a C++ program to a shared library, it will be bound to the versioned .so file, which is normally a very good idea. For example, if I compile my program with
g++ main.cxx -l somelib
y luego verificar
it will print something like
libsomelib.so.1 => /xxxx/somelib/libsomelib.so.1
Because of a system broken elsewhere, this file is installed in a target as
libsomelib.so instead of, as normal, as
libsomelib.so.1 with symlink. It is not possible for me to change this, so as a workaround I would like to change my makefile to link against the unversioned .so file. (Binary compatibility is not a problem here, since everything is in a controlled environment).
preguntado el 31 de julio de 12 a las 13:07
From reading the ld manual, this does not appear to be possible. I recommend using patchelf to fix it up after the fact, e.g.,
patchelf --replace-needed libsomelib.so.1 libsomelib.so a.out. Note that the latest released version of patchelf 0.9 is buggy, you will need to compile patchelf master from source to get a working implementation of