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

"expr: syntax error" due to gcc -dumpversion excluding micro

    Details

    • Subcomponent:
    • Resolved In Build:
      b93

      Description

      Building hotspot on certain systems results in a series of:
      expr: syntax error
      expr: syntax error
      expr: syntax error
      expr: syntax error

      Volker Simonis provided the following analysis and suggested fix:

      It is caused by a peculiarity of the gcc version on Ubuntu where "gcc
      -dumpversion" doesn't print a micro-version:

      Ubuntu:
      $ gcc -dumpversion
      4.6

      Any other Linux:
      $ gcc -dumpversion
      4.8.3

      This "feature" is tracked under
      https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1360404 and has
      been fixed for gcc 4.9 but won't be fixed for older versions of gcc.

      In hotspot/make/linux/makefiles/gcc.make we parse the micro-version of
      gcc and use it in the following way:

      CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3)

      ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \&
      $(CC_VER_MICRO) = 1), 1)
        $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not
      supported because of
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724")
      endif

      The shell expression results in a syntax error if $(CC_VER_MICRO)
      because it expaands to something like "expr 4 = 4 & 3 = 1 & = 1"

      I haven't fixed it until now because it does no harm. The
      corresponding check is for gcc 4.1.1 but the affected Ubuntu gcc
      compilers are 4.6, 4.7 and 4.8.

      A trivial fix would be to set CC_VER_MICRO to "0" by default.

        Attachments

          Activity

            People

            • Assignee:
              simonis Volker Simonis
              Reporter:
              ihse Magnus Ihse Bursie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: