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

Build failure from multiple ptrace.h

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      svc
    • Resolved In Build:
      b22
    • OS:
      linux

      Backports

        Description

        "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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: