[comp.protocols.tcp-ip] libc for SUN 4.0.3c

chris@SALT.ACC.COM (Chris VandenBerg) (07/04/90)

Good morning all,
	        I'm trying to get a SPARC/1 running with the resolver and I was told that I have to substitute a shared libc that the resolver, in
addition to adding the resolv.conf file. Does
anyone have one of these or know if one for
4.0.3c? And, does anyone know how this is set up
in SUNOS4.1? Please respond to me directly, I
don't want to waste bandwidth on so trivial a
request.
	Many thanks,
		    Chris VandenBerg
		    (chris@salt.acc.com)

HAROLD@UGA.CC.UGA.EDU (Harold Pritchett) (07/06/90)

On Tue, 3 Jul 90 10:04:47 -0700 Chris VandenBerg said:
>Good morning all,
>	        I'm trying to get a SPARC/1 running with the resolver and I was told
> that I have to substitute a shared libc that the resolver, in
>addition to adding the resolv.conf file. Does
>anyone have one of these or know if one for
>4.0.3c? And, does anyone know how this is set up
>in SUNOS4.1? Please respond to me directly, I
>don't want to waste bandwidth on so trivial a
>request.

Hold on there a minute.  If anyone can get the resolver to work with 4.1,
please post it to the list.  We have not been able to get it to work either,
and so far we have not gotten any help from SUN as it appears they can't get
it to work either.

Harold C Pritchett         |  BITNET:  HAROLD@UGA
BITNET TechRep             |    ARPA:  harold@uga.cc.uga.edu
The University of Georgia  |    uucp:  gatech!ugacs!csun2!harold
Athens, GA 30602           |    fido:  1:370/60
(404) 542-3135             |     Bbs:  SYSOP at (404) 354-0817

sblair@synoptics.COM (Steven C. Blair) (07/06/90)

The routines for libc.so.1.3.1 for Sun 3's & Sun4's are located in
the sun directories on uunet.uu.net.

If you're going down the lloonngg road to sunos4.1, you have to
build the libc routines. Here's the information to do it from
the sun-managers email list:

The following instructions were issued a few weeks ago from Greg Earle@sun:
===========================================================================
As it appears that SunOS 4.1 is now reaching our users in reasonable
quantities, we offer the following announcement for our Internet customers:

Background:
As you may know, the normal /usr/lib/libc.so.* that ships with SunOS 4.x
contains the library routines gethostbyname(3) and gethostbyaddr(3) to do
host name and address resolution.  These routines normally reference the
`hosts' NIS (nee YP) map first, and then fall back to looking in the
/etc/hosts file.  By changing the NIS Makefile to invoke `makedbm' with the
`-b' option, one can arrange things so that NIS does lookups first to a DNS
(Domain Name Service) name server, via the resolver routines.  This is the
Sun supported way of doing things.

But many of Sun's Internet customers want to be able to use resolver-based
lookups without having to run NIS/YP.  In order to fill this void under
SunOS
4.0.x, Sun created `libc_resolv.so' versions of the shared C library with
the
gethostbyname()/gethostbyaddr() routines replaced by the equivalent
functions
from the BIND nameserver distribution's resolver library (plus supporting
functions).  These were made available via anonymous FTP on the host
`uunet.UU.NET', in the `sun-fixes' directory.

Now SunOS 4.1 has arrived, but there is no equivalent `libc_resolv.so'
available via this mechanism (anonymous FTP from `uunet.UU.NET').  This
message
addresses this situation.

Fortunately, 2 things in SunOS 4.1 have come to the rescue:

(1) There is a selectable software category in the 4.1 Full Install called
    `Shlib Custom' that enables one to build custom shared libraries.
    This software gets installed in /usr/lib/shlib.etc, with a README file
    containing instructions on how to build your own custom shared C
library.
    If you wish to build a version of libc.so with the resolver routines,
    make sure to select this category when installing SunOS 4.1.


(2) The version of /usr/lib/libresolv.a in 4.1 has been compiled with
    `cc -pic', thus producing position-independant code.

Thus, what follows is an additional set of comments that can be *directly*
*appended* (i.e., `cat <remainder-of-this-message> >> README') to the file
`/usr/lib/shlib.etc/README' which provides instructions on how to build a
libc.so.X.NN.1 that will use the resolver for hostname/hostaddr resolution.

Sun can make no guarantees on this, but this method has been in use on
Internet hosts running SunOS 4.1FCS for 3 weeks now, doing telnet, rlogin,
ftp, etc. to hosts that are not in the hosts table (on hosts that do not
run NIS/YP), and it works without any known problems.

One final note: the method described below applies to Sun's supported SunOS
4.1
version of the resolver library (libresolv.a), which is based on BIND 4.8.
As many of you are aware, there are `post-4.8' versions of BIND floating
around
out there.  We are aware of versions from UC Berkeley, University of
Toronto,
and University of Michigan, among others.  Although these versions cannot be
supported, it is our opinion that if the code for these customized versions
of
the resolver library adheres to proper shared library conventions, then if
the modules in these libraries are compiled with `cc -pic', the resulting
object modules should be usable in the manner described below for the
shipped
/usr/lib/libresolv.a.  A simple test will confirm whether this will work:

        % mkdir tmp ; cd tmp ; ar xv /path/to/your/custom/libresolv.a
        % ld -assert pure-text *.o

If there are non-PIC constructs in these objects, the assertion would tell
you
about them.  For more information about position-independant code and shared
libraries, please read Chapter 1 in the "Programming Utilities and
Libraries"
manual that is included in the SunOS 4.1 documentation set.  It is contained
in the binder labelled "Programmer's Overview - Utilities and Libraries" on
the spine.

Without further ado, here it is.  As mentioned, cut off below the line,
save to a file, and then append that file to /usr/lib/shlib.etc/README.

Supplemental instructions for building a shared libc.so that uses the
resolver
for hostname/addr resolution:

10. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the
    tmp directory:
        % cd tmp
        % ar x ../libc_pic.a
        % ar x /usr/lib/libresolv.a

    The libresolv.a (apparently) contains object modules that are position
    independant, so they can be added to the libc_pic modules without fear.

11. Remove the old routine to do the hostname/addr resolution:
        % rm gethostent.o

12. Remove the libresolv module that contains `strncasecmp' (which is now
    in the main C library, so it is redundant):
        % rm strcasecmp.o

13. As mentioned in step 5 above, edit the file `lorder-sparc' in the ..
    directory.  Remove the reference to `gethostent.o' and add the
    references to the resolver library routines by applying this patch:

        % diff -rc2 lorder-sparc.orig lorder-sparc
        *** lorder-sparc.orig   Thu Feb  8 05:27:46 1990
        --- lorder-sparc        Mon Apr  9 12:58:59 1990
        ***************
        *** 150,154 ****
          getwd.o
          getnetgrent.o
        ! gethostent.o
          ypxdr.o
          ttyname.o
        --- 150,161 ----
          getwd.o
          getnetgrent.o
        ! gethostnamadr.o
        ! sethostent.o
        ! res_query.o
        ! res_mkquery.o
        ! res_send.o
        ! res_debug.o
        ! res_comp.o
        ! res_init.o
          ypxdr.o
          ttyname.o

14. Continue as above, from steps 6 to 9.
------------
Steven C. Blair         Network Operations Center
SynOptics Communications Inc. Mountain View, California
INTERNET: sblair@synoptics.com  sblair@nevdull.synoptics.com
PROBLEMS/EMAIL: HOSTMASTER@SYNOPTICS.COM postmaster@synoptics.com

earle@POSEUR.JPL.NASA.GOV (Greg Earle - Sun JPL on-site Software Support) (07/08/90)

In TCP-IP/comp.protocols.tcp-ip article <21705@mvis1.com> you wrote:
>If you're going down the lloonngg road to sunos4.1, you have to
>build the libc routines. Here's the information to do it from
>the sun-managers email list:
>
>The following instructions were issued a few weeks ago from Greg Earle@sun:
>===========================================================================
> ... [My original posting deleted]

Please note that my original posting has undergone two revisions since then.
The main reason was to insert the instructions into the mainline README file
from the /usr/lib/shlib.etc directory; the other reasons were to correct minor
oversights and to provide extra information.

If anyone reading this wants to get the latest version of the file in question
(/usr/lib/shlib.etc/README), they can contact me at the following addresses.

--
	Greg Earle
	Sun Microsystems, Inc. - JPL on-site Software Support Engineer
	earle@poseur.JPL.NASA.GOV	(Direct)
	earle@Sun.COM			(Indirect)