Telling the linker to ignore missing libs
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Telling the linker to ignore missing libs




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Telling the linker to ignore missing libs  
Michael B Allen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-18-07 06:30 AM

Hi,

I want to modify a library (libldap) to call a my own getaddrinfo function
(packaged in libmyresolv). The problem is that libmyresolv links with
a slew of other libs which creates a number of linking issues (one of
the libs links with libldap, libldap's build tries to link test programs,
etc).

Ultimately everything is going to be linked together into one big shared
library anyway so I don't care about undefined references linking just
libldap.so.

Is there a way to tell the linker to just ignore missing libs lines
so I can link libldap.so without dragging in all the linking options
for libmyresolv?

I'm using the standard GNU toolchain and all libs are PIC.

Any advice would be appreciated. [As you can probably tell I'm basically
trying to provide my own getaddrinfo. If you have any general advice on
doing that then I would appreciate that too.]

Mike





[ Post a follow-up to this message ]



    Re: Telling the linker to ignore missing libs  
Paul Pluzhnikov


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-18-07 06:30 AM

Michael B Allen <ioplex@gmail.com> writes:

> Is there a way to tell the linker to just ignore missing libs lines
> so I can link libldap.so without dragging in all the linking options
> for libmyresolv?

When linking a shared library, most UNIX linkers *already* ignore
any unresolved symbols [1], so all you should have to do is
simply drop the libraries you do not want from the link command line.

> Any advice would be appreciated.

It's not clear what your difficulty is, so it's hard to give advice.

Cheers,

[1] Unless you specified something like '-Wl,--no-undefined' or
'-Wl,-z,defs'; in which case remove that option.
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.





[ Post a follow-up to this message ]



    Re: Telling the linker to ignore missing libs  
Michael B Allen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-18-07 06:25 PM

On Wed, 17 Oct 2007 20:37:42 -0700
Paul Pluzhnikov <ppluzhnikov-nsp@charter.net> wrote:

> Michael B Allen <ioplex@gmail.com> writes:
> 
>
> When linking a shared library, most UNIX linkers *already* ignore
> any unresolved symbols [1], so all you should have to do is
> simply drop the libraries you do not want from the link command line.

Hey Paul,

After a little more investigation it seems the real problem is the
libldap's build creates all sorts of test programs which *do* need to
resolve symbols in other libs. And it uses a GNU "configure" script so I'm
not even going to try to hack it. So I guess I need to build libmyresolv
first which even though it has a dependency on libldap should be able
to build. Then I can build libldap linked with libmyresolv. I thought
I tried that already and ran into a problem but I'll explore that again.

Thanks for your help,
Mike





[ Post a follow-up to this message ]



    Re: Telling the linker to ignore missing libs  
Giorgos Keramidas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-19-07 06:32 PM

On Wed, 17 Oct 2007 23:21:12 -0400, Michael B Allen <ioplex@gmail.com> wrote:
> I want to modify a library (libldap) to call a my own getaddrinfo function
> (packaged in libmyresolv). The problem is that libmyresolv links with
> a slew of other libs which creates a number of linking issues (one of
> the libs links with libldap, libldap's build tries to link test programs,
> etc).

This sounds like a circular dependency a lot.  You'll have to, somehow,
"break" the circle.

> Ultimately everything is going to be linked together into one big shared
> library anyway so I don't care about undefined references linking just
> libldap.so.
>
> Is there a way to tell the linker to just ignore missing libs lines
> so I can link libldap.so without dragging in all the linking options
> for libmyresolv?
>
> I'm using the standard GNU toolchain and all libs are PIC.
>
> Any advice would be appreciated. [As you can probably tell I'm basical
ly
> trying to provide my own getaddrinfo. If you have any general advice on
> doing that then I would appreciate that too.]

Isn't it easier to build a library which provides *just* getaddrinfo()
[and anything else this one requires to work properly], and then using
LD_PRELOAD to preload it?

env LD_PRELOAD=`pwd`/../lib/libcompat.so ./test1






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:43 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register