Subject: Re: pkg/19316: I can't get pkgsrc work on Slackware Linux. Bootstrap
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 12/23/2002 20:52:36
Today, I decided to use newest bootstrap-pkgsrc, because
pkgtools/pkg_install wouldn't build (under Linux).

===> Creating sample mk.conf
===> Installing bmake
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking for a BSD compatible install... /usr/bin/install
checking for AIX... no
checking for minix/config.h... no
checking for POSIXized ISC... no
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ar.h... yes
checking for ranlib.h... no
checking for fcntl.h... yes
checking for paths.h... yes
checking for sys/select.h... yes
checking for sys/time.h... yes
checking for unistd.h... yes
checking for string.h... yes
checking for utime.h... yes
checking for poll.h... yes
checking for sys/uio.h... yes
checking for sys/cdefs.h... yes
checking whether sys/cdefs.h is compatible... no
checking whether byte ordering is bigendian... no
checking for working const... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for sys_siglist declaration in signal.h or unistd.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking return type of signal handlers... void
checking for vfork.h... no
checking for working vfork... yes
checking for vprintf... yes
checking for wait3 that fills in rusage... yes
checking for getcwd... yes
checking for getwd... yes
checking for getopt... yes
checking for putenv... yes
checking for select... yes
checking for strdup... yes
checking for strerror... yes
checking for strtod... yes
checking for strtol... yes
checking for setenv... yes
checking for getenv... yes
checking for vsnprintf... yes
checking for snprintf... yes
checking for strftime... yes
checking for sigaction... yes
checking for sigvec... yes
checking for waitpid... yes
checking for wait4... yes
checking for wait3... yes
checking for getenv... (cached) yes
checking whether stat file-mode macros are broken... no
checking for st_rdev in struct stat... yes
Checking for MACHINE & MACHINE_ARCH... defaults: MACHINE=linux2, MACHINE_ARCH=i686
Using: MACHINE=linux2, MACHINE_ARCH=i686
updating cache ./config.cache
creating ./config.status
creating Makefile
creating makefile.boot
creating lst.lib/makefile.boot
creating config.h

You can now run

	make -f makefile.boot bootstrap

to produce a fully functional bmake.  You can then use

	make -f makefile.boot install

for an initial installation.  If you already have macros installed
you can use:

	./bmake -f Makefile

to install etc.

gcc -I. -I. -DHAVE_CONFIG_H  -I./missing -DNEED_HOST_CDEFS_H "-D_PATH_DEFSYSPATH=\"//share/mk\"" -DMAKE_BOOTSTRAP    -c -o arch.o arch.c
gcc -I. -I. -DHAVE_CONFIG_H  -I./missing -DNEED_HOST_CDEFS_H "-D_PATH_DEFSYSPATH=\"//share/mk\"" -DMAKE_BOOTSTRAP    -c -o buf.o buf.c
gcc -I. -I. -DHAVE_CONFIG_H  -I./missing -DNEED_HOST_CDEFS_H "-D_PATH_DEFSYSPATH=\"//share/mk\"" -DMAKE_BOOTSTRAP    -c -o compat.o compat.c
compat.c: In function `CompatRunCommand':
compat.c:318: incompatible type for argument 1 of `wait'
make: *** [compat.o] Error 1
bmake installation failed.



I have a working bmake, so then I did:

  cd pkg_install ; ./configure --prefix=/ --with-pkgdbdir=/home/jeremy/netbsd/usr/pkgsrc && make


cd lib && make
make[1]: Entering directory `/home/jeremy/netbsd/othersrc/bootstrap-pkgsrc/pkg_install/lib'
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c digest.c -o digest.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c exec.c -o exec.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c file.c -o file.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c fgetln.c -o fgetln.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c ftpio.c -o ftpio.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c global.c -o global.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c lpkg.c -o lpkg.o
gcc -DHAVE_CONFIG_H -I. -I.  -g -O2 -c pen.c -o pen.o
pen.c:277: redefinition of `struct statfs'
pen.c: In function `vfs2fs':
pen.c:367: structure has no member named `val'
pen.c:370: structure has no member named `f_basetype'
pen.c:370: structure has no member named `f_basetype'
pen.c:370: structure has no member named `f_basetype'
pen.c:370: structure has no member named `f_basetype'
pen.c:370: structure has no member named `f_basetype'
make[1]: *** [pen.o] Error 1
make[1]: Leaving directory `/home/jeremy/netbsd/othersrc/bootstrap-pkgsrc/pkg_install/lib'
make: *** [libdir] Error 2



So I changed lib/pen.c so it would be like it was before.
#ifndef HAVE_STATVFS

Then it failed later with:

cd create && make
make[1]: Entering directory
`/home/jeremy/netbsd/othersrc/bootstrap-pkgsrc/pkg_install/create'
gcc -DHAVE_CONFIG_H -I. -I. -I../lib  -g -O2 -c main.c -o main.o
gcc -DHAVE_CONFIG_H -I. -I. -I../lib  -g -O2 -c perform.c -o perform.o
perform.c: In function `make_dist':
perform.c:169: incompatible type for argument 1 of `wait'
make[1]: *** [perform.o] Error 1
make[1]: Leaving directory
`/home/jeremy/netbsd/othersrc/bootstrap-pkgsrc/pkg_install/create'
make: *** [createdir] Error 2


These were same errors as when I tried to build under
pkgsrc/pkgtools/pkg_install/. But this is the bootstrap.

My version of wait.h as installed with glibc-2.2.5 has:

...

# ifdef	__USE_BSD

/* Lots of hair to allow traditional BSD use of `union wait'
   as well as POSIX.1 use of `int' for the status word.  */

#  if defined __GNUC__ && !defined __cplusplus
#   define __WAIT_INT(status)						      \
  (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
		    __u.__in = (status); __u.__i; }))
#  else
#   define __WAIT_INT(status)	(*(int *) &(status))
#  endif

/* This is the type of the argument to `wait'.  The funky union
   causes redeclarations with ether `int *' or `union wait *' to be
   allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
   the actual function definitions.  */

#  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
#   define __WAIT_STATUS	void *
#   define __WAIT_STATUS_DEFN	void *
#  else
/* This works in GCC 2.6.1 and later.  */
typedef union
  {
    union wait *__uptr;
    int *__iptr;
  } __WAIT_STATUS __attribute__ ((__transparent_union__));
#   define __WAIT_STATUS_DEFN	int *
#  endif

# else /* Don't use BSD.  */

#  define __WAIT_INT(status)	(status)
#  define __WAIT_STATUS		int *
#  define __WAIT_STATUS_DEFN	int *

# endif /* Use BSD.  */

...


This bootstrap-pkgsrc was checkout today. Makefile.in,v 1.1.1.1 and
lib/pen.c,v 1.5

This did work a couple months ago.

This is Linux with glibc-2.2.5.

   Jeremy C. Reed
   http://bsd.reedmedia.net/

p.s. Chris, I did post some of my pkgsrc for Linux over a month ago, but I
have made many changes since then. Once I can adequately test them some
more, I will send-pr them.