Shared library versioning problem at runtime

Thread Tools Search this Thread
Top Forums Programming Shared library versioning problem at runtime
# 1  
Old 08-25-2009
Shared library versioning problem at runtime

My executable was linked under RedHat using the LessTif GUI shared library. When I try to run it under UBUNTU, I get an error message that the LessTif library cannot be found. The LessTif library is there, but it is a newer VERSION. My executable is looking for the older version it was linked with.

So how do I make my executable smart enough to find the LessTif shared library on the system it is running on, even if it is a different version?

Alternatively, how can I statically link the LessTif shared library components that I am using into my executable.

I'm using 'make' to build. Yeah, I'm old.

Thanks all.
# 2  
Old 08-25-2009
Hello Imagtek,

The information about the LessTiff dynamic library to use (path/version) is coded in the binary. When you start it on Ubuntu, the dynamic loader try to load it based on the information stored in the binary. If that fails (wrong path or version), it complains. This is the expected behavior.

Now to solve your problem, I see two possibilities:
  1. You create a symlink at the right place that points to your the LessTiff .so library installed on your Ubuntu system. You can find out what the dynamic linker is looking for using the ldd command: ldd <your_binary>. For instance:
    $ ldd /bin/ls
    shows up all the dynamic libraries the 'ls' binary needs.
    See however note below.
  2. You recompile your program for Ubuntu. Depending on your program, this may invokes the ./configure; make all; make install steps.
Please note that usually a version increase in dynamic library means possibility some "incompatibilities" with the previous version. So, things might break. This explain why solution 1 may not work. At best, you should try to recompile for your target system.

And by the way, my grand-father started learning computer at age 65 and pass me the virus (I was 13), and my father-in-law started recently tinkering with Linux. So, don't worry Smilie

My (Unix) blog: Loc OnStage

"The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry." -- Henry Petroski
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

2. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies

3. HP-UX

Problem in Shared library file .sl on 64bit HP-UX 11.11

We are facing issue with shared library file, we are getting difference in content for same shared file for chatr command :confused: , below are the detail about *.sl file, even we are also getting difference in size of both file. can you please tell me what will be the issue for same. is my new... (1 Reply)
Discussion started by: amodkavi
1 Replies

4. HP-UX

Can't open shared library problem

I am getting following error when I am trying access PMCMD utility /usr/lib/ Can't open shared library: /home/build3p/PMReleases/Zeus/HP-UX/xml/xerces2_4_0-icu2_6_1_811/lib/ /usr/lib/ No such file or directory Please help me with this (0 Replies)
Discussion started by: imran_affu
0 Replies

5. UNIX for Dummies Questions & Answers

Problem with shared dynamic library files

I am having a major problem. Most of the commands that i am running on my centos 5 system is giving the error of type: <dynamic shared library file>:open failed: No such file or directory For example: open failed: No such file or directory How can i solve this? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

6. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

7. Programming

Shared memory for shared library

I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability. Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies

8. AIX

Shared Object library problem

Hi, When using shared objects on AIX 4.3 i am getting runtime problems. I have a small sample program which links to a shared object libray, oracle and system related libraries. At runtime it fails (gives segmentation fault and coredump ) in one proc file when executing login statement. But... (0 Replies)
Discussion started by: suman_jakkula
0 Replies

9. HP-UX

Shared Library Problem

I have this error when I try to do check on the oracle database... Can you help me figure out whats the problem? Thanks for all the help! /usr/lib/pa20_64/ Unable to find library ''. /usr/lib/pa20_64/ Unable to find library ''. ... (1 Reply)
Discussion started by: vinz
1 Replies

10. Programming

Runtime Linking shared Objects

I'm runtime linking (dlopen and dlsym) to a shared object (library) I've created and after a number of function calls into the library the program core dumps (Illegal operation). This only occurs during runtime linking. If I use the same library and dynamically link during compile time everything... (3 Replies)
Discussion started by: dneely
3 Replies
Login or Register to Ask a Question