Subject: Re: pkg/36778 (sysutils/strace fails to build on linux)
To: None <christos@NetBSD.org, gnats-admin@netbsd.org,>
From: Yakovetsky Vladimir <yx@x.ua>
List: pkgsrc-bugs
Date: 12/06/2007 15:30:03
The following reply was made to PR pkg/36778; it has been noted by GNATS.

From: Yakovetsky Vladimir <yx@x.ua>
To: gnats-bugs@NetBSD.org
Cc: christos@NetBSD.org, pkgsrc-bugs@NetBSD.org,
	gnats-admin@NetBSD.org
Subject: Re: pkg/36778 (sysutils/strace fails to build on linux)
Date: Thu, 6 Dec 2007 17:27:22 +0200

 On Wed, Dec 05, 2007 at 04:33:13PM +0000, christos@NetBSD.org wrote:
 > Synopsis: sysutils/strace fails to build on linux
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: christos@netbsd.org
 > State-Changed-When: Wed, 05 Dec 2007 11:33:12 -0500
 > State-Changed-Why:
 > I imported a newer version of strace. Can you please check if it fixes
 > your problems?
 > 
   Has checked up, failures+fixes for strace-4.5.15 in linux below.
 
 
 1st failure (net.c sockpacketoptions):
 % cd sysutils/strace && bmake
 ...
 if gcc -DHAVE_CONFIG_H -I. -I. -I. -Ilinux/i386 -I./linux/i386 -Ilinux -I./linux    -Wall -O2 -march=native -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -MT net.o -MD -MP -MF ".deps/net.Tpo" -c -o net.o net.c;  then mv -f ".deps/net.Tpo" ".deps/net.Po"; else rm -f ".deps/net.Tpo"; exit 1; fi
 net.c:809: error: 'PACKET_ADD_MEMBERSHIP' undeclared here (not in a function)
 net.c:810: error: 'PACKET_DROP_MEMBERSHIP' undeclared here (not in a function)
 ...
 
 
 1st fix (based on strace/net.c,v 1.56 2007/11/1)
 :r sysutils/strace/patches/patch-bf
 --- net.c.~1~
 +++ net.c
 @@ -806,8 +806,12 @@
  
  #ifdef SOL_PACKET
  static const struct xlat sockpacketoptions[] = {
 +#ifdef PACKET_ADD_MEMBERSHIP
  	{ PACKET_ADD_MEMBERSHIP,	"PACKET_ADD_MEMBERSHIP"	},
 +#endif
 +#ifdef PACKET_DROP_MEMBERSHIP
  	{ PACKET_DROP_MEMBERSHIP,	"PACKET_DROP_MEMBERSHIP"},
 +#endif
  #if defined(PACKET_RECV_OUTPUT)
  	{ PACKET_RECV_OUTPUT,		"PACKET_RECV_OUTPUT"	},
  #endif
 
 
 
 2nd failure (probably `configure' with `linux-libc-dev' issue):
 % cd sysutils/strace && bmake
 ...
 checking for linux/if_packet.h... no
 ...
 if gcc -DHAVE_CONFIG_H -I. -I. -I. -Ilinux/i386 -I./linux/i386 -Ilinux -I./linux    -Wall -O2 -march=native -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -MT net.o -MD -MP -MF ".deps/net.Tpo" -c -o net.o net.c;  then mv -f ".deps/net.Tpo" ".deps/net.Po"; else rm -f ".deps/net.Tpo"; exit 1; fi
 net.c: In function 'printsock':
 net.c:964: error: field 'll' has incomplete type
 net.c:967: error: field 'nl' has incomplete type
 ...
 
 
 2nd fix (sysutils/strace/patches/patch-bg and sysutils/strace/Makefile.diff):
 :r sysutils/strace/patches/patch-bg
 --- configure.ac.~1~
 +++ configure.ac
 @@ -202,7 +202,8 @@
  AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
  AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h inttypes.h], [], [])
  AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
 -                 [], [], [#include <linux/socket.h>])
 +                 [], [], [#include <stddef.h>
 +#include <linux/socket.h>])
  AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
  AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
 
 --- sysutils/strace/Makefile.~1~
 +++ sysutils/strace/Makefile
 @@ -22,4 +22,11 @@
  
  REPLACE_PERL=		strace-graph
  
 +.include "../../mk/bsd.prefs.mk"
 +.if ${OPSYS} == "Linux"
 +USE_TOOLS+=		autoconf
 +pre-configure:
 +	cd ${WRKSRC} && autoconf
 +.endif
 +
  .include "../../mk/bsd.pkg.mk"
 
 
 
 3rd failure (patches/patch-ag issue in linux: PTRACE_PEEKUSER redefined as PTRACE_PEEKTEXT):
 % cd sysutils/strace && bmake
 ...
 if gcc -DHAVE_CONFIG_H -I. -I. -I. -Ilinux/i386 -I./linux/i386 -Ilinux -I./linux    -Wall -O2 -march=native -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -MT process.o -MD -MP -MF ".deps/process.Tpo" -c -o process.o process.c;  then mv -f ".deps/process.Tpo" ".deps/process.Po"; else rm -f ".deps/process.Tpo"; exit 1; fi
 process.c: In function 'sys_ptrace':
 process.c:3030: error: duplicate case value
 process.c:3029: error: previously used here
 process.c:3046: error: duplicate case value
 process.c:3045: error: previously used here
 ...
 
 
 3rd fix (make new definitions from patch-ag conditional):
 :r sysutils/strace/patches/patch-bh
 --- defs.h.~1~
 +++ defs.h
 @@ -267,6 +267,7 @@
  #define PR_FAULTED      S_CORE
  #endif
  
 +#ifndef LINUX
  #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)
  #define PTRACE_ATTACH PT_ATTACH
  #endif
 @@ -297,6 +298,7 @@
  #if !defined(PTRACE_SETREGS) && defined(PT_SETREGS)
  #define PTRACE_SETREGS PT_SETREGS
  #endif
 +#endif
  
  /* Trace Control Block */
  struct tcb {
 
 
 Kind Regards,
 
 -- 
 Yakovetsky Vladimir