[comp.sys.3b1] One way to use shared library with libnet.a

bruce@balilly (Bruce Lilly) (05/25/91)

In article <1991May24.161142.723@sci.ccny.cuny.edu> jeffrey@sci.ccny.cuny.edu (Jeffrey L Bromberger) writes:
>In article <2869@public.BTR.COM> thad@btr.btr.com writes:
>
>While I may not be much of a guru on this stuff, it might be a routing
>problem.  Namely, the Sun did not know that the route to this IP
>network was thru the main interface.  If you aren't running the routed
>(or somesuch other thing), you'll have to manually add the route.
>
>Andy Poling also has some stuff ported.  I was trying to clean some
>stuff up (and sent the patches back to him) but some of the BSD code
>just won't work on sys 5.  You might ask when he'll be finished with
>them.
>
>>Some of this stuff DOES work with the 3B1's shared libraries (4.3BSD's ftp, for
>>example), and some does NOT work with the 3B1's shared libraries (the "whois"
>>stuff, for example).  Dunno why.
>
>The main reason is that there are a lot of things that are redefined in
>libnet.a  Things like perror.  The system's default is to use the
>shlib copy and ignore the library's version.  After finding no help to
>selectively include/exclude routines, I just gave up on the shared
>libs.  Also, there are *significant differences* between gcc (1.37.1)
>and the stock cc.  Some things (like sendmail) trash out the cc, but
>need fancy options for gcc.  I still haven't gotten the BIND stuff to
>work correctly. :-(  And quite possibly, a new BSD ftpd cannot ever
>work, due to the setuid/geteuid stuff.

To use the shared library with libnet.a, use ld (rather than cc) to do the
linking explicitly, e.g.:

------ sample Makefile excerpts -----------
LDFLAGS = -s
LIBS = -lnet #/usr/local/lib/gcc-gnulib
SHAREDLIB = shlib.ifile
STARTOFF = /lib/crt0s.o

foo: foo.o bar.o fribble.o $(SHAREDLIB)
	ld -o $@ $(LDFLAGS) `lorder $(STARTOFF) foo.o bar.o fribble.o | tsort` $(LIBS) $(SHAREDLIB)

$(SHAREDLIB): /lib/shlib.ifile
	egrep -v "sys_errlist|sys_nerr|perror" $? >$@
-------------------------------------------

The same principle applies if you want to use the shared library with a
program that uses curses, but you wish to avoid the broken TAM emulation
of curses (of course the list of things to exclude from the shared library
is somewhat longer).

Use of lorder | tsort isn't strictly necessary, but I believe it makes a
small difference in paging performance.

I have replacements for syslog (daemon and logging routines), inetd, nntpd, rshd,
htable and sendmail (with IDA enhancements) working on the 3B1. Routed
isn't quite working (and the TWG version doesn't work either). The IDA
sendmail package (available from osu-cis and/or uunet) will compile on the
3B1, and the next release (5.65c+IDA-1.4.4), due out in a couple of weeks,
will most likely include makefiles specifically for the 3B1. If anybody
needs the inetd/syslogd/rshd/htable stuff, or patches to nntp 1.5.11, let
me know.

-- 
	Bruce Lilly		blilly!balilly!bruce@sonyd1.Broadcast.Sony.COM