Revised posting on how to create under SunOS 4.1

From: Greg Earle - Sun JPL on-site Software Support (
Date: Fri May 18 1990 - 22:59:57 CDT

Evan Wetstone's posting to Sun-Spots about libc+resolv under 4.1 has reminded
me to repost a slightly revised version of the instructions. This is prompted
by 3 things:
(1) The original, virgin /usr/lib/shlib.etc/README file has an oversight in it;
    The original mentions that 2 files in the archive library need to be
    renamed after they are extracted, because the names are truncated at 16
    characters. This is true for the Sun-3 and Sun-3x, but on Sun-4's and
    Sun-4c's (SPARCstation-1's, 1+'s, and presumably SLC's), there is an
    additional library module whose name is also truncated. This is corrected.

(2) Several people complained to me that my instructions, being placed as an
    addendum rather than in line with the rest of the instructions, were thus
    unneccessarily confusing, and could even (if misinterpreted) cause someone
    to build a libc that would not work.

(3) I accidentally included my .signature file at the end of the posting,
    and then told everyone to append the rest of my message to their README
    files, thus immortalizing my .signature in everybody's README (^: I
    humbly apologize ...

So, without further ado, here is the revised version of the file
/usr/lib/shlib.etc/README. I recommend backing up the original, nuke my
previous version (the one that Evan re-posted), and insert this in its place.

        - Greg Earle | "This is Kraft. It uses a blue box.
          Sun Microsystems, Inc. | This is Stouffer's. It uses red.
          JPL on-site Software Support | The choice is yours."
          sun!poseur!earle | Pretty damn convincing argument, eh?

---------------- >8 Cut here - /usr/lib/shlib.etc/README 8< ---------------

This is a procedure you can use to substitute or add
a module in your shared libc C library.

Note! If you are interested in a System V libc, please substitute
        libc_pic.a for libcs5_pic.a in step 3, for in step 8.


1. Become super user
        % su

2. Make a temporary directory
        # mkdir tmp

3. Change to the "tmp" directory just made, extract the pic .o from
   libc_pic.a and rm the file __.SYMDEF. The reason you need to do
   the 2 (or 3) "mv" commands is because "ar" truncated filenames over
   16 characters.
        # cd tmp
        # ar x ../libc_pic.a
        # rm __.SYMDEF
        # mv rpc_dtablesize. rpc_dtablesize.o
        # mv rpc_commondata. rpc_commondata.o
   If on a Sun-4, perform this additional `mv' command:
        # mv xccs_multibyte. xccs_multibyte.o

Here are some extra instructions for building a shared that uses the
resolver for hostname/addr resolution:

3a. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the
    tmp directory:
        # ar x /usr/lib/libresolv.a

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

    *Note* If you have your own copy of the resolver library sources,
    (perhaps from a post-4.8 BIND distribution) you can compile each of these
    modules yourself using `cc -pic' and the resulting object modules *should*
    be usable in this schema as well. To test that the custom resolver
    modules will be usable, cd to the directory containing the custom resolver
    sources and object modules and perform this test:

        # ld -assert pure-text *.o

    If `ld' issues no complaints, then you can assume that the object modules
    are safe to use.

3b. Remove the old routine to do the hostname/addr resolution:
        # rm gethostent.o

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

3d. As mentioned in step 5 below, 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:

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

3e. Continue on, from steps 6 to 9 (i.e., skip steps 4 and 5 immediately below).


4. Replace or add the .o that you wanted by doing a copy. Please
   note here that you are advised to create your object with
   the following compiler option, i.e "cc -c -pic yourprogram.c" to make
   it shareable.
        # cp your.o .

5. If you add a new module then you need to do this step.
   You need to edit the file "lorder-sparc" and add the name of the file
   you have copied from step 4 at the end of this file.
        # vi ../lorder-sparc

6. # cd ..

7. # make

8. Now you should have some built in the current directory.
   It is recommended that you tested out this library at this point
   before installing it. You can do so by setting the environment
   LD_LIBRARY_PATH to the current directory for example:
           # setenv LD_LIBRARY_PATH `pwd`
        # your_favorite_test_cmd
   Once you are satisfied that the new library worked, you can proceed
   to install it with the following commands:
        # cp /usr/lib
        # ldconfig
        # unsetenv LD_LIBRARY_PATH

9. You are now running with the new library. You can verify this by
   doing a trace command of let's say "date".
        # trace date
   The output should informed you that the new library is being used.

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:05:57 CDT