[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#805846: openjdk-7: FTBFS on sparc64, missing asm/ptrace header, patch attached



Source: openjdk-7
Severity: important
Tags: patch
Justification: fails to build from source
User: debian-sparc@lists.debian.org
Usertags: sparc64

Dear Maintainer,

Currently openjdk-7 is configured to use the zero vm on
sparc64. However zero doesn't seem to build. If hotspot is enabled for
sparc64 the build fails with several similar errors concerning a
struct, you can see here:

https://buildd.debian.org/status/fetch.php?pkg=openjdk-7&arch=sparc64&ver=7u85-2.6.1-1&stamp=1441319505

/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/ps_core.c: In function 'core_handle_prstatus':
/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/ps_core.c:542:49: error: invalid application of 'sizeof' to incomplete type 'struct pt_regs'
    memcpy(&newthr->regs, prstat->pr_reg, sizeof(struct user_regs_struct));
                                                 ^
In file included from /«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c:27:0:
/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/libproc.h:80:27: warning: 'struct pt_regs' declared inside parameter list
 #define user_regs_struct  pt_regs
                           ^
/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/libproc.h:114:65: note: in expansion of macro 'user_regs_struct'
 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs);
                                                                 ^
/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/libproc.h:80:27: warning: its scope is only this definition or declaration, which is probably not what you want
 #define user_regs_struct  pt_regs
                           ^
/«PKGBUILDDIR»/build/openjdk-boot/hotspot/agent/src/os/linux/libproc.h:114:65: note: in expansion of macro 'user_regs_struct'
 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs);


What's happening is that 'user_regs_struct' is defined to be 'pt_regs'
but 'pt_regs' isn't declared anywhere so the compiler interprets the
first use of 'struct user_regs_struct' to be the declaration. Then
because it's not fully defined the compiler complains that it doesn't
know the size of the incomplete type and the build fails.

So the real problem is 'struct pt_regs'.

A simple fix would be to add the header 'asm/ptrace.h' to the file
'openjdk/hotspot/agent/src/os/linux/libproc.h'. With this change the
build completes successfully for me. I've attached a patch to achieve
this.

If sparc64 is added to the list of hotspot archs and this patch
included in DISTRIBUTION_PATCHES in debian/rules should fix the
build for sparc64.

Thanks!
David


-- System Information:
Debian Release: stretch/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: sparc64

Kernel: Linux 4.3.0-gentoo (SMP w/1 CPU core)
Locale: LANG=en_SG.UTF-8, LC_CTYPE=en_SG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
Index: openjdk/hotspot/agent/src/os/linux/libproc.h
===================================================================
--- openjdk/hotspot/agent/src/os/linux/libproc.h.old	2015-11-12 22:57:20.000000000 -0600
+++ openjdk/hotspot/agent/src/os/linux/libproc.h		2015-11-22 10:49:17.684049960 -0600
@@ -34,6 +34,7 @@
 #include "libproc_md.h"
 #endif
 
+#include <asm/ptrace.h>
 #include <sys/ptrace.h>
 
 /************************************************************************************

Reply to: