Subject: pkg/24403: libgtop does not build on AMD64 (patches included)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <rkr@olib.org>
List: netbsd-bugs
Date: 02/12/2004 21:49:56
>Number:         24403
>Category:       pkg
>Synopsis:       libgtop does not build on AMD64 (patches included)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 12 21:50:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Richard Rauch
>Release:        NetBSD/amd64, current from late January.
>Organization:
>Environment:
NetBSD socrates 1.6ZI NetBSD 1.6ZI (socrates) #2: Thu Jan 29 19:56:35 CST 2004  root@socrates:/usr/netbsd/current/src/sys/arch/amd64/compile/socrates amd64

>Description:
I decided to see if Gnome would build on NetBSD/amd64.  I thought
that "gnome1" might have better luck than "gnome" (Gnome 2.0?).

Most of the problems are for lack of GNU autoconf support for the
AMD64 or "x86_64" processor.

A less trivial one is libgtop, which refuses to do anything
until you modify the Makefile.
>How-To-Repeat:
Try to build libgtop.
>Fix:
The Makefile directed me to patch-al.  I took my best guess about the
fields, since the comments were less than helpful.  It looks like we
need to supply an instruction pointer and user stack pointer, at a
guess.  I couldn't find a clearly labeled program-counter/instruction
pointer in the pcb struct, but assumed {usersp} is the other field that
was needed.  I upated the patch and the distinfo and the Makefile.

Unfortunately, I can't yet test it, since Gnome broke down when again
when it got to compile Guile.  So, I'm including the patches as I have
them so that they won't get lost/forgotton.

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libgtop/Makefile,v
retrieving revision 1.77
diff -u -r1.77 Makefile
--- Makefile    2004/01/22 08:48:49     1.77
+++ Makefile    2004/02/12 21:35:48
@@ -19,6 +19,7 @@
 
 .if ${OPSYS} == NetBSD
 .  if (${MACHINE_ARCH} != alpha) && \
+       (${MACHINE_ARCH} != amd64) && (${MACHINE_ARCH} != x86_64) && \
        (${MACHINE_ARCH} != arm) && (${MACHINE_ARCH} != arm32) && \
        (${MACHINE_ARCH} != i386) && (${MACHINE_ARCH} != m68k) && \
        (${MACHINE_ARCH} != mipsel) && (${MACHINE_ARCH} != powerpc) && \
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libgtop/distinfo,v
retrieving revision 1.11
diff -u -r1.11 distinfo
--- distinfo    2003/01/21 10:12:30     1.11
+++ distinfo    2004/02/12 21:35:48
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.11 2003/01/21 10:12:30 tron Exp $
+$NetBSD$
 
 SHA1 (libgtop-1.0.13.tar.bz2) = 7002d37ab43ebac14315298472a170ceaedbd072
 Size (libgtop-1.0.13.tar.bz2) = 733873 bytes
@@ -9,7 +9,7 @@
 SHA1 (patch-ae) = cf277165382c17d938593934b59d8035175fd8d0
 SHA1 (patch-af) = 6874f04a186a4dccfecadaa2e40a372bc9f2e2fe
 SHA1 (patch-ag) = eb02b990d1316ac5f2ec0430e49b9c4487c6dab8
-SHA1 (patch-al) = 1d24ce5af3fcabe0a50abaebd07e24c606fad9cf
+SHA1 (patch-al) = 59916b30380935c5871fb75c7ac8f77fb56cd3c5
 SHA1 (patch-an) = 339df94fd374d99565be913d1f8b59ea2f7b7881
 SHA1 (patch-ao) = 09cb66ba7ee9a7368ec1cd1d4bd40ea3f6637a31
 SHA1 (patch-ap) = 07a83340eb9d6a36a3f5b2db33eb50c74fbc4777
Index: patches/patch-al
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libgtop/patches/patch-al,v
retrieving revision 1.14
diff -u -r1.14 patch-al
--- patches/patch-al    2003/01/21 10:12:31     1.14
+++ patches/patch-al    2004/02/12 21:35:49
@@ -74,7 +74,7 @@
                       (unsigned long) &u_addr->u_pcb,
                       (char *) &pcb, sizeof (pcb)) == sizeof (pcb))
                {
-@@ -167,14 +190,39 @@
+@@ -167,14 +190,42 @@
                        /*xxx FreeBSD/Alpha? */
  #endif
  #else
@@ -90,6 +90,9 @@
 +#if defined(__m68k__)
 +                      buf->kstk_esp = (u_int64_t) pcb.pcb_usp;
 +                      buf->kstk_eip = (u_int64_t) 0;
++#elif (defined(__amd64__) || defined(__x86_64__))
++                      buf->kstk_esp = (u_int64_t) pcb.pcb_usersp; /* XXX ? */
++                      buf->kstk_eip = (u_int64_t) 0;              /* XXX ? */
 +#elif (defined(__arm32__) || defined(__powerpc__))
 +                      buf->kstk_esp = (u_int64_t) pcb.pcb_sp;
 +                      buf->kstk_eip = (u_int64_t) 0;

>Release-Note:
>Audit-Trail:
>Unformatted: