This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld: executable cannot find a versioned shared library


(ld, 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 "",, created with

g++ -shared -Wl,-soname, -o [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, -o [other options]

followed by

ln -sfv

creating a convenience symbolic link. this is all still in

running the same executable linking command for the "test" executable as
above succeeds, but ldd shows that cannot be found by the

I ran readelf on the library, and it shows that the soname field is set
correctly to 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:
Sent from the Sourceware - binutils list mailing list archive at

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]