Subject: Re: Building nathanw_sa branch?
To: Michael K. Sanders <msanders@confusion.net>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: current-users
Date: 02/03/2002 17:02:59
"Michael K. Sanders" <msanders@confusion.net> writes:

> Thanks.  Can something like Apache 2.0 be expected to work with libpthread
> at this point?

I hope so, but to be honest, my pthread lib just hasn't been tested
much with "real" threaded applications. I've been doing some such
testing myself, but haven't tried Apache yet.

There's a MD issue involving i386 floating point which has been hosing
XMMS, one of my other test apps. I'm still working on that one. Apache
might or might not trip over it.

> 
> I was going to build it from pkgsrc just to see, but ran into this in
> one of the dependencies:

Okay, you're tripping over the libc/libsyscall split. For static
binaries, you need to manually link against -lc -lsyscall. I have a
patch to gcc's specs file to add that automatically:

Index: netbsd.h
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gcc/config/netbsd.h,v
retrieving revision 1.13
diff -c -r1.13 netbsd.h
*** config/netbsd.h	2001/12/29 20:24:37	1.13
--- config/netbsd.h	2002/02/03 21:50:37
***************
*** 55,61 ****
  #undef LIB_SPEC
  #define LIB_SPEC							\
    "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}		\
!    %{!shared:%{!symbolic:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}}"
  
  /* Provide a LIBGCC_SPEC appropriate for NetBSD.  We also want to exclude
     libgcc when -symbolic.  */
--- 55,62 ----
  #undef LIB_SPEC
  #define LIB_SPEC							\
    "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}		\
!    %{!shared:%{!symbolic:%{!p:%{!pg:-lc -lsyscall}}			\
!    %{p:-lc_p -lsyscall_p}%{pg:-lc_p -lsyscall_p}}}"
  
  /* Provide a LIBGCC_SPEC appropriate for NetBSD.  We also want to exclude
     libgcc when -symbolic.  */


... but haven't committed it because the amount of pain involved in maintining a branched version of the toolchain just isn't worth it.

Of course, to do a toolchain build you'll need to have some slightly
gross patches around the other problem you tripped over building the
toolchain before:

Index: gcc/protoize.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gcc/protoize.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 protoize.c
*** gcc/protoize.c	2000/07/26 00:17:37	1.1.1.1
--- gcc/protoize.c	2002/02/03 21:54:23
***************
*** 48,53 ****
--- 48,54 ----
  #endif
  #endif /* 0 */
  
+ #if 0
  #ifdef POSIX /* We should be able to define _POSIX_SOURCE unconditionally,
  		but some systems respond in buggy ways to it,
  		including SunOS 4.1.1.  Which we don't classify as POSIX.  */
***************
*** 55,60 ****
--- 56,62 ----
     ask for definition of all POSIX facilities.  */
  #undef _POSIX_SOURCE
  #define _POSIX_SOURCE
+ #endif
  #endif
  
  #include "system.h"
Index: gdb/kcore-nbsd.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gdb/kcore-nbsd.c,v
retrieving revision 1.1
diff -c -r1.1 kcore-nbsd.c
*** gdb/kcore-nbsd.c	2000/08/02 21:00:33	1.1
--- gdb/kcore-nbsd.c	2002/02/03 21:54:31
***************
*** 31,36 ****
--- 31,37 ----
  
  #include <sys/param.h>
  #include <sys/time.h>
+ #include <sys/lwp.h>
  #include <sys/proc.h>
  #include <sys/user.h>
  #include <errno.h>
***************
*** 380,386 ****
    addr = (CORE_ADDR)parse_and_eval_address(arg);
  
    /* Read the PCB address in proc structure. */
!   addr += (int) &((struct proc *)0)->p_addr;
    if (kvread(addr, &val))
      error("cannot read u area ptr");
  
--- 381,387 ----
    addr = (CORE_ADDR)parse_and_eval_address(arg);
  
    /* Read the PCB address in proc structure. */
!   addr += (int) &((struct lwp *)0)->l_addr;
    if (kvread(addr, &val))
      error("cannot read u area ptr");
  
Index: defs.mk
===================================================================
RCS file: /cvsroot/gnusrc/gnu/lib/libg2c/arch/i386/defs.mk,v
retrieving revision 1.2
diff -c -r1.2 defs.mk
*** defs.mk	2001/08/14 05:15:00	1.2
--- defs.mk	2002/02/03 22:00:28
***************
*** 4,10 ****
  G_F2CEXT=abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc  signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1  besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn  dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror  getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand  isatty itime kill link lnblnk lstat ltime mclock perror rand rename  secnds second sleep srand stat symlnk time ttynam umask unlink  vxttim alarm  date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
  G_ALL_CFLAGS=-I. -I${DIST}/libf2c/libF77 -I.. -I${DIST}/libf2c/libF77/..  -DSTDC_HEADERS=1 -DRETSIGTYPE=void -DIEEE_drem=1 -DSkip_f2c_Undefs=1 -g -O2
  G_OBJS=F77_aloc.o VersionF.o main.o s_rnge.o abort_.o getarg_.o iargc_.o getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit_.o setarg.o setsig.o pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o  pow_ri.o pow_zi.o pow_zz.o  pow_qq.o c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o r_cosh.o r_dim.o r_exp.o r_imag.o r_int.o r_lg10.o r_log.o r_mod.o r_nint.o r_sign.o r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o d_cnjg.o d_cos.o d_cosh.o d_dim.o d_exp.o d_imag.o d_int.o d_lg10.o d_log.o d_mod.o d_nint.o d_prod.o d_sign.o d_sin.o d_sinh.o d_sqrt.o d_tan.o d_tanh.o i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_mod.o i_nint.o i_sign.o  h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o  h_nint.o h_sign.o l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o ef1asc_.o e!
f1cmc_.o s_cat.o s_cmp.o s_copy.o lbitbits.o lbitshft.o qbitbits.o qbitshft.o
! G_ALL_CFLAGS+=-I. -I${DIST}/libf2c/libI77 -I.. -I${DIST}/libf2c/libI77/..   -DSTDC_HEADERS=1 -D_POSIX_SOURCE=1 -DHAVE_TEMPNAM=1 -DNO_EOF_CHAR_CHECK=1 -DSkip_f2c_Undefs=1 -g -O2
  G_OBJ+=VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o  fmt.o fmtlib.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o  rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o  util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o  ftell_.o
  G_ALL_CFLAGS+=-I. -I${DIST}/libf2c/libU77 -I${DIST}/libf2c/libU77/../libI77 -I..  -I${DIST}/libf2c/libU77/..  -DHAVE_CONFIG_H -g -O2
  G_OBJS+=VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o  unlink_.o fnum_.o getpid_.o getuid_.o getgid_.o kill_.o rand_.o  srand_.o irand_.o sleep_.o idate_.o ctime_.o etime_.o  dtime_.o  isatty_.o ltime_.o fstat_.o stat_.o  lstat_.o access_.o link_.o getlog_.o ttynam_.o getcwd_.o symlnk_.o  vxttime_.o vxtidate_.o gmtime_.o fdate_.o secnds_.o  bes.o dbes.o  chdir_.o chmod_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o  umask_.o sys_clock_.o date_.o second_.o flush1_.o mclock_.o  alarm_.o datetime_.o
--- 4,10 ----
  G_F2CEXT=abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc  signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1  besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn  dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror  getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand  isatty itime kill link lnblnk lstat ltime mclock perror rand rename  secnds second sleep srand stat symlnk time ttynam umask unlink  vxttim alarm  date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
  G_ALL_CFLAGS=-I. -I${DIST}/libf2c/libF77 -I.. -I${DIST}/libf2c/libF77/..  -DSTDC_HEADERS=1 -DRETSIGTYPE=void -DIEEE_drem=1 -DSkip_f2c_Undefs=1 -g -O2
  G_OBJS=F77_aloc.o VersionF.o main.o s_rnge.o abort_.o getarg_.o iargc_.o getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit_.o setarg.o setsig.o pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o  pow_ri.o pow_zi.o pow_zz.o  pow_qq.o c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o r_cosh.o r_dim.o r_exp.o r_imag.o r_int.o r_lg10.o r_log.o r_mod.o r_nint.o r_sign.o r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o d_cnjg.o d_cos.o d_cosh.o d_dim.o d_exp.o d_imag.o d_int.o d_lg10.o d_log.o d_mod.o d_nint.o d_prod.o d_sign.o d_sin.o d_sinh.o d_sqrt.o d_tan.o d_tanh.o i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_mod.o i_nint.o i_sign.o  h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o  h_nint.o h_sign.o l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o ef1asc_.o e!
f1cmc_.o s_cat.o s_cmp.o s_copy.o lbitbits.o lbitshft.o qbitbits.o qbitshft.o
! G_ALL_CFLAGS+=-I. -I${DIST}/libf2c/libI77 -I.. -I${DIST}/libf2c/libI77/..   -DSTDC_HEADERS=1 -DHAVE_TEMPNAM=1 -DNO_EOF_CHAR_CHECK=1 -DSkip_f2c_Undefs=1 -g -O2
  G_OBJ+=VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o  fmt.o fmtlib.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o  rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o  util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o  ftell_.o
  G_ALL_CFLAGS+=-I. -I${DIST}/libf2c/libU77 -I${DIST}/libf2c/libU77/../libI77 -I..  -I${DIST}/libf2c/libU77/..  -DHAVE_CONFIG_H -g -O2
  G_OBJS+=VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o  unlink_.o fnum_.o getpid_.o getuid_.o getgid_.o kill_.o rand_.o  srand_.o irand_.o sleep_.o idate_.o ctime_.o etime_.o  dtime_.o  isatty_.o ltime_.o fstat_.o stat_.o  lstat_.o access_.o link_.o getlog_.o ttynam_.o getcwd_.o symlnk_.o  vxttime_.o vxtidate_.o gmtime_.o fdate_.o secnds_.o  bes.o dbes.o  chdir_.o chmod_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o  umask_.o sys_clock_.o date_.o second_.o flush1_.o mclock_.o  alarm_.o datetime_.o



Enjoy!

        - Nathan