This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ld: executable cannot find a versioned shared library
- From: alex kabanov <alexander dot kabanov at citi dot com>
- To: binutils at sourceware dot org
- Date: Thu, 12 Nov 2009 06:35:12 -0800 (PST)
- Subject: ld: executable cannot find a versioned shared library
Hi
(ld 2.18.0.20080103, Ubuntu 8.04)
I have a c++ project in which I compile a shared library and then link an
executable against it. This used to work fine for me
so, i have a shared library, let's say "libmylib.so",, created with
g++ -shared -Wl,-soname,libmylib.so -o libmylib.so [other otpions]
and it is located in /home/user/project/lib/c++
then i have an executable in [project-path]/cmd/c++ (let's call it "test"),
which is linked against this library as
g++ -Wl,-rpath=/home/user/project/lib/c++ -o test -lmylib -L
/home/user/project/lib/c++ [other options]
and this all works fine, ldd shows that the executable is able to locate all
libraries and it runs as it is supposed to.
Recently, I decided to introduce version numbering to my project. So if the
version number is 1.2.3 the library linking command now is
g++ -shared -Wl,-soname,libmylib.so.1 -o libmylib.so.1.2.3 [other options]
followed by
ln -sfv libmylib.so.1.2.3 libmylib.so
creating a convenience symbolic link. this is all still in
/home/user/project/lib/c++
running the same executable linking command for the "test" executable as
above succeeds, but ldd shows that libmylib.so.1 cannot be found by the
executable.
I ran readelf on the library, and it shows that the soname field is set
correctly to libmylib.so.1. I also ran readelf on the executable and found
that rpath is set correctly to /home/user/project/lib/c++.
I really don't know what to do now. I have had my share of pain when I was
working out how the whole dynamic linking system works before, but this is
something I cannot understand.
Any help would be greatly appreciated
--
View this message in context: http://old.nabble.com/ld%3A-executable-cannot-find-a-versioned-shared-library-tp26319759p26319759.html
Sent from the Sourceware - binutils list mailing list archive at Nabble.com.