Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8046408

Build failure from multiple ptrace.h

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • hotspot
    • None
    • svc
    • b22
    • linux

        "I" in the following is kim.barrett@oracle.com. I don't have a JIRA account yet.

        Attempting to build jdk9/dev on SuSE 13.1, I encountered the following build error:

        In file included from /home/kab/sandboxes/kab-test/hotspot/agent/src/os/linux/libproc.h:37:0,
                         from /home/kab/sandboxes/kab-test/hotspot/agent/src/os/linux/libproc_impl.h:30,
                         from /home/kab/sandboxes/kab-test/hotspot/agent/src/os/linux/ps_proc.c:33:
        /usr/include/linux/ptrace.h:58:8: error: redefinition of ‘struct ptrace_peeksiginfo_args’
         struct ptrace_peeksiginfo_args {
                ^
        In file included from /home/kab/sandboxes/kab-test/hotspot/agent/src/os/linux/ps_proc.c:32:0:
        /usr/include/sys/ptrace.h:191:8: note: originally defined here
         struct ptrace_peeksiginfo_args
                ^

        The problem is that ps_proc.c is directly including <sys/ptrace.h> and indirect including <linux/ptrace.h> (via "libproc.h"), and they appear to be incompatible on the system in question. A bit of web searches would seem to indicate that including both is generally not a good idea. For example, linux/ptrace.h defines as macros some names that sys/ptrace.h defines as enum constants. An include order of linux/ptrace.h first then sys/ptrace.h likely results in lots of syntax errors.

        The include of <linux/ptrace.h> was added here:
          mikael c884ec3ea87f Tue Apr 29 22:05:10 2014 -0700: #include <linux/ptrace.h>

        I'm not sure why I'm getting a compiler error here but presumably most other folks are not. It may have something to do with the combination of compiler version (g++4.8.1).

        Changing hotspot/agent/src/os/linux/libproc.h to include <sys/ptrace.h> rather than <linux/ptrace.h> eliminated the error for me, and allowed my build to run.

              mikael Mikael Vidstedt
              jwilhelm Jesper Wilhelmsson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: