Subject: Re: 1.3.2 distribution /bin/ps pukes with NetBSD-1.3I
To: None <port-sun3@netbsd.org>
From: J. Maynard Gelinas <maynard@jmg.com>
List: port-sun3
Date: 01/13/1999 14:17:11
> 	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
frame.h(55): warning: nonportable bit-field type
frame.h(56): warning: nonportable bit-field type
kvm.c(118): warning: pointer casts may be troublesome
kvm.c(147): warning: pointer casts may be troublesome
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_file.c
frame.h(55): warning: nonportable bit-field type
frame.h(56): warning: nonportable bit-field type
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_getloadavg.c
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_proc.c
frame.h(55): warning: nonportable bit-field type
frame.h(56): warning: nonportable bit-field type
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_m68k.c
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_m68k_cmn.c
kvm_m68k_cmn.c(92): warning: argument kd unused in function _kvm_cmn_freevtop
kvm_m68k_cmn.c(99): warning: argument kd unused in function _kvm_cmn_initvtop
kvm_m68k_cmn.c(152): warning: conversion from 'unsigned long long' may lose accuracy
kvm_m68k_cmn.c(178): warning: conversion from 'unsigned long' may lose accuracy
kvm_m68k_cmn.c(201): warning: pointer casts may be troublesome
kvm_m68k_cmn.c(244): warning: conversion from 'unsigned long' may lose accuracy
kvm_m68k_cmn.c(267): warning: pointer casts may be troublesome
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_sun3.c
kvm_sun3.c(166): warning: conversion from 'unsigned long' may lose accuracy
kvm_sun3.c(167): warning: conversion from 'unsigned long' may lose accuracy
lint -chapbxz -DLIBC_SCCS -DUVM -i kvm_sun3x.c
kvm_sun3x.c(92): warning: argument kd unused in function _kvm_sun3x_initvtop
kvm_sun3x.c(99): warning: argument kd unused in function _kvm_sun3x_freevtop
kvm_sun3x.c(139): warning: conversion from 'unsigned long' may lose accuracy
kvm_sun3x.c(148): warning: conversion from 'unsigned long' may lose accuracy
kvm_sun3x.c(158): warning: conversion from 'unsigned long' may lose accuracy
kvm_sun3x.c(183): warning: conversion from 'unsigned long long' may lose accuracy
building llib-lkvm.ln
lint: cannot find llib-lc.ln
Lint pass2:
netbsd1# 

     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# 

and now uptime (among others which dynamically include libkvm.so for _pread) report:

netbsd1# uptime
/usr/libexec/ld.so: Undefined symbol "_pread" called from uptime:/usr/lib/libkvm.so.5.0 at 0x802c22c
netbsd1#

D'OH!

     Fortunately tar doesn't depend on libkvm so I can just grab the old
libkvm from the binary distribution.  Still, that won't solve my problem of
needing to rebuild to support the newer kernel release.  And I'm afraid any
suggestions I might make at this point may be of little use to the
developers.

     And speaking of the new kernel: NetBSD 1.3I for the 3x is the most
stable 3x kernel I've tried yet.  1.3.2 may not stay up for more than a few
hours, but this kernel has been up about five days straight and I've beat
on this thing hard.  In fact I compiled kernels on it for 50 hours straight
just to see if I could get it to crash... nope!  So, once libkvm and any
other system dependencies build problems are resolved I'd suggest
*everyone* upgrade to this kernel.  This is the first time I've really felt
like the 3x distribution beat out SunOS 4.1.1 for stability.  

This is great!
Thanks Gordon!
J. Maynard Gelinas