Subject: Re: 1.3.2 distribution /bin/ps pukes with NetBSD-1.3I
To: J. Maynard Gelinas <maynard@jmg.com>
From: Simon Burge <simonb@telstra.com.au>
List: port-sun3
Date: 01/14/1999 09:09:13
On Wed, 13 Jan 1999 14:17:11 -0500  "J. Maynard Gelinas" wrote:

> > 	As a general rule when you update your kernel aything using libkvm
> > 	may break. For a good explanation see
> > 	http://www.netbsd.org/Ports/mac68k/faq/faq-10.html#ss10.11
> > 
> > On Sun, 10 Jan 1999, J. Maynard Gelinas wrote:
> > 
> 
>    [snip original question - thanks for your replies David, Simon]
> 
>     OK.  I tried to follow these instructions, but I've hit a dead end.
> Let me describe what I did and hope someone can offer assistance or a
> suggestion.
> 
>      Goal #1:  Rebuild new includes from source.  OK, I D/L'd _all_ the
> source from ftp.netbsd.org:/pub/NetBSD/NetBSD-current/tar_files/src (except
> games) and tried to make includes.  Didn't work.  Turns out that the
> Makefile down /usr/src/libexec/ld.elf_so is broken and has a dangling
> conditional. OK, I also figured it would make sense to upgrade /usr/share/mk,
> so I rebuild /usr/share/mk and go to: ftp.netbsd.org:/pub/NetBSD\
> /NetBSD-current/src/libexec/ld.elf_so and grab a -current Makefile.  Make
> includes in /usr/src now builds and installs the new include files like it
> ought to.
> 
>      Goal #2 rebuild libkvm.  OK, so now I go into /usr/src/lib/libkvm and
> run a make.  Whoops!  Everything goes OK until the Makefile executes ld
> with the --whole-archive option (actually, the libkvm Makefile includes 
> /usr/share/mk/bsd.lib.mk which is the culprit), then my ld (from the 1.3.2
> distribution) pukes that it doesn't know about --whole-archive and dies. Oh
> well.  I cd into /usr/src/usr.bin/ld and rebuild ld and install.... this
> works just fine.  Then I go back to the libkvm source area and make clean,
> then make again.  It seems to work (without any compile time errors) except
> for some strange lint output:
> 
>  -DLIBC_SCCS -DUVM -c -fpic -DPIC kvm_sun3.c -o kvm_sun3.so
> cc -O2  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror   -DLIBC_SCCS -DUVM -c -fpic -DPIC kvm_sun3x.c -o kvm_sun3x.so
> building shared object kvm library
> ranlib libkvm_pic.a
> building shared kvm library (version 5.0)
> ld -x -shared  -o libkvm.so.5.0    --whole-archive libkvm_pic.a --no-whole-archive   
> lint -chapbxz -DLIBC_SCCS -DUVM -i kvm.c
>  [[ output deleted ]]
> building llib-lkvm.ln
> lint: cannot find llib-lc.ln
> Lint pass2:
> netbsd1# 

Just ignore this (see below for my "fix").

> 
>      But I didn't get any compile errors and I figured, what the
> hell - I *really* want my ps! (even though those "kvm_sun3x.c(139):
> warning: conversion from 'unsigned long' may lose accuracy" left me
> feeling less than comfortable) So I make install with a prayer, and go
> to rebuild /bin/ps.  Well, this completely pukes when linking with:
> 
> cc -O2  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Wno-format-y2k  -DUVM -c ps.c
> cc  -static -o ps fmt.o keyword.o nlist.o print.o ps.o -lm -lkvm
> kvm_proc.o: Undefined symbol `_pread' referenced from text segment
> kvm.o: Undefined symbol `_pread' referenced from text segment
> kvm.o: Undefined symbol `_pwrite' referenced from text segment
> kvm.o: Undefined symbol `_pread' referenced from text segment
> kvm.o: Undefined symbol `_pread' referenced from text segment
> kvm.o: Undefined symbol `_pwrite' referenced from text segment
> kvm_m68k_cmn.o: Undefined symbol `_pread' referenced from text segment
> kvm_m68k_cmn.o: Undefined symbol `_pread' referenced from text segment
> kvm_m68k_cmn.o: Undefined symbol `_pread' referenced from text segment
> kvm_m68k_cmn.o: Undefined symbol `_pread' referenced from text segment
> kvm_m68k_cmn.o: Undefined symbol `_pread' referenced from text segment
> *** Error code 1
> Stop.
> netbsd1# 

These are new system calls, which means you need a new libc as well.
So you first need to go to /usr/src/lib/libc and do a "make && make
install" there.  It also probably wouldn't hurt to build and install the
new csu (C Start Up?) files in /usr/src/lib/csu _before_ libc too.

For what it's worth, on my slower machines I usually do the following

	make NOMAN= NOLINT= NOPROFILE=

which doesn't build man pages, lint checks and profiled libraries.  Much
faster :-)

And always backup your libraries before installing new ones!

Simon.