Unix Programming - Shared libs versioning issues

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Shared libs versioning issues





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Shared libs versioning issues
Pablo J Royo

2004-01-23, 5:20 pm

Hello:

I have compiled an application on a SunFire V240 Solaris 9 machine, and
when I try to execute it on a E250 Sparc Solaris 7 machine I get this error:

ld.so.1: ./my_app: fatal: libnsl.so.1: version `SUNW_1.7' not found
(required by file ./my_app)

I suppose I must link the program in some way in Solaris 9 so that the rigth
versioning info appears in it, and then Solaris 7 machine will "see" it
correctly, but I donīt know how to doit.
Any ideas? Is any option in "ld" linker (gnu or not) to do this?

Thank you


Paul Pluzhnikov

2004-01-23, 5:20 pm

"Pablo J Royo" <royop@tb-solutions.com> writes:
quote:

> I have compiled an application on a SunFire V240 Solaris 9 machine, and
> when I try to execute it on a E250 Sparc Solaris 7 machine I get this error:



None of the UNIXes I know about support this.
Solaris7-built binaries will (generally) work on Solaris9, but not
vice versa.
quote:

> I suppose I must link the program in some way in Solaris 9 so that the rigth
> versioning info appears in it, and then Solaris 7 machine will "see" it
> correctly, but I donīt know how to doit.



This is possible to do, but is quite tricky and requires detailed
understanding of how ELF dynamic linker and symbol versioning work.

You are quite unlikely to get it working correctly. A much simpler
solution is just to build on a Solaris 7 machine.

If you still want to do it "the hard way", build gcc
Solaris9->Solaris7 cross-compiler [details on building gcc as
a cross-compiler are in gcc documentation].
quote:

> Is any option in "ld" linker (gnu or not) to do this?



No. GNU-ld will not make this any easier.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Pablo J Royo

2004-01-23, 5:20 pm

Thank you Paul

I hadnīt thought your cross-compiler option. I will check it.
Now I have used "-z noversion" option in Solaris 9 ld linker, so when I run
my program on Solaris 7 it works because there is no version checking. But
I'm not sure of its effects. I have looked for a similar option on GNU gcc
with no results.




Paul Pluzhnikov

2004-01-23, 5:20 pm

"Pablo J Royo" <royop@tb-solutions.com> writes:
quote:

> Now I have used "-z noversion" option in Solaris 9 ld linker, so when I run
> my program on Solaris 7 it works because there is no version checking. But
> I'm not sure of its effects.



Basically you've turned off "safety protection" and could have
subtle bugs galore when using that binary on Solaris7. The effects
of these bugs may not be immediately obvious, but they may bite
you at the most inopportune time ;-(
quote:

> I have looked for a similar option on GNU gcc
> with no results.



gcc on Solaris could be configured with GNU-ld, but I don't think
that is the default. If you are using /usr/ccs/bin/ld, then
-Wl,-z,noversion will pass "-z noversion" to the linker.

GNU-ld doesn't appear to have a "don't record version dependencies"
flag.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com