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

hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6

XMLWordPrintable

    • b01
    • x86
    • linux, linux_2.6

        I tried compiling openjdk6 b08 on ubuntu 8.04. The default compiler is gcc 4.2.x. The following
        does not occur on ubuntu 7.10 where the default gcc is 4.1.x.

        Some hotspot files fail to compile due to warnings. The default hotspot makefiles use
        the -Werror flag, making warnings into errors and the build fails. The warnings are
        about type conversion of strings to constants.

        The obvious workaround is to edit the hotspot makefile to not use -Werror. This works.

        I also made the following source changes and had a successful compile. The idea is to
        in some cases change some declarations to use "const char *" instead of "char *"
        and in other cases cast string constants to "char *" depending on the context.

        --- ./hotspot/src/share/vm/opto/escape-orig.cpp 2008-03-24 14:42:12.000000000 -0700
        +++ ./hotspot/src/share/vm/opto/escape.cpp 2008-03-24 14:45:09.000000000 -0700
        @@ -54,21 +54,21 @@
         }
         
         #ifndef PRODUCT
        -static char *node_type_names[] = {
        +static const char *node_type_names[] = {
           "UnknownType",
           "JavaObject",
           "LocalVar",
           "Field"
         };
         
        -static char *esc_names[] = {
        +static const char *esc_names[] = {
           "UnknownEscape",
           "NoEscape ",
           "ArgEscape ",
           "GlobalEscape "
         };
         
        -static char *edge_type_suffix[] = {
        +static const char *edge_type_suffix[] = {
          "?", // UnknownEdge
          "P", // PointsToEdge
          "D", // DeferredEdge
        --- ./hotspot/src/share/vm/ci/ciMethodBlocks-orig.cpp 2008-03-24 14:39:19.000000000 -0700
        +++ ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp 2008-03-24 14:40:06.000000000 -0700
        @@ -321,7 +321,7 @@
         }
         
         #ifndef PRODUCT
        -static char *flagnames[] = {
        +static const char *flagnames[] = {
           "Processed",
           "Handler",
           "MayThrow",
        --- ./hotspot/src/os/linux/vm/jvm_linux-orig.cpp 2008-03-24 14:01:55.000000000 -0700
        +++ ./hotspot/src/os/linux/vm/jvm_linux.cpp 2008-03-24 14:02:07.000000000 -0700
        @@ -135,7 +135,7 @@
         */
         
         struct siglabel {
        - char *name;
        + const char *name;
           int number;
         };
         
        --- ./hotspot/src/os/linux/vm/vmError_linux-orig.cpp 2008-03-24 14:25:17.000000000 -0700
        +++ ./hotspot/src/os/linux/vm/vmError_linux.cpp 2008-03-24 14:26:01.000000000 -0700
        @@ -50,8 +50,8 @@
         // doesn't block SIGINT et al.
         int VMError::fork_and_exec(char* cmd) {
           char * argv[4];
        - argv[0] = "sh";
        - argv[1] = "-c";
        + argv[0] = (char *)"sh";
        + argv[1] = (char *)"-c";
           argv[2] = cmd;
           argv[3] = NULL;

              xlu Xiaobin Lu (Inactive)
              dherronsunw David Herron (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: