Help wanted: Linking to libbind9 on Ubuntu Linux

Ronald F. Guilmette rfg at tristatelogic.com
Tue Mar 20 20:02:58 UTC 2018


In message <20180320193041.d2bwvgkgyvqemyff at mycre.ws>, 
Robert Edmonds <edmonds at mycre.ws> wrote:

>> I am porting some code of mine from FreeBSD to this Ubuntu system
>> and I'm getting the following unresolved symbols at link time:
>> 
>>     __res_query
>>     __res_mkquery
>>     __res_send
>> 
>> It seems apparent that this is caused by the fact that FreeBSD has
>> the resolver routines integrated into libc, whereas Linux systems
>> don't.
>
>For glibc versions that are less than about ten years old, these should
>be available in libresolv, which is part of glibc.

Thanks Robert!  I added -lresolv to the link and now the link step is
succeding.

>See the resolver(3) manpage, which is probably in the manpages-dev
>package on Ubuntu 14.

For the record, I *did* look over that man page, and several others,
before I posted my question.  But neither that man page nor any of the
several others I looked at ever said a word about the necessary extra
-l option needed in order to drag in the needed resolver routines.

>This is unrelated to libbind9, which is a different API.

Well, see, and -that- may perhaps be a problem.  I dunno yet.  My hope,
of course, is that I have not relied on any of the finer subtleties or
more obscure aspects of libbind in any of my coding, but it may come to
light that I have, and I may in fact end up needing to link to the
real libbind9.  I would still like to know how to do that, just in case,
and I am still utterly perplexed and mystified about why the linker
couldn't seem to find libbind9, even when I gave it the explicit path
to the thing via an appropriate -L option.

I hope somebody will explain to that to me still, because whatever the
answer is to that mystery, it is sure to be highly educational, for me
anyway.


More information about the bind-users mailing list