Derby
  1. Derby
  2. DERBY-5189

PropertySetter should ignore GCJ installations

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.8.1.2
    • Fix Version/s: 10.9.1.0
    • Component/s: Build tools
    • Labels:
      None

      Description

      Many Linux platforms come with GCJ installed. GCJ implements most of the Java SE API, but not all of it, so it cannot be used to build Derby. Unfortunately, PropertySetter sometimes get confused by it and constructs a compile classpath using GCJ's libraries.

      For example, on a machine running Debian 6.0.1, I have the sun-java6-jdk package as well as the gcj-jdk package installed. When running ant to build Derby (with no ~/ant.properties), I get these compile classpaths constructed:

      printCompilerProperties:
      [echo] After setting properties: compilerPropsAlreadySet = true
      [echo] After setting properties: compilerLevel16 = 1.6
      [echo] After setting properties: jsr169compile.classpath = /home/kah/derby/trunk/classes/stubs/jsr169:/usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/rt.ja
      r
      [echo] After setting properties: j14lib = $

      {j14lib}

      [echo] After setting properties: java14compile.classpath = /usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/rt.jar
      [echo] After setting properties: j15lib = $

      {j15lib}

      [echo] After setting properties: java15compile.classpath = /usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/rt.jar
      [echo] After setting properties: j16lib = $

      {jdk16}

      /jre/lib
      [echo] After setting properties: java16compile.classpath = /usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/alt-rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre
      /lib/alt-string.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/charsets.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/deploy.jar:/usr/lib/jvm/java-6-sun-1.6
      .0.24/jre/lib/javaws.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/jsse.jar:/usr/lib/jvm/java-6-sun-1.6.0
      .24/jre/lib/management-agent.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/plugin.jar:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/resources.jar:/usr/lib/jvm/
      java-6-sun-1.6.0.24/jre/lib/rt.jar

      Since java15compile.classpath is based on GCJ, and GCJ lacks some classes in the javax.management.remote package, the build fails when it gets to the JMX tests:

      compile_jdk15:
      [javac] Compiling 14 source files to /home/kah/derby/trunk/classes
      [javac] /home/kah/derby/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionDecorator.java:26: cannot find symbol
      [javac] symbol : class JMXServiceURL
      [javac] location: package javax.management.remote
      [javac] import javax.management.remote.JMXServiceURL;
      [javac] ^
      (...)
      [javac] /home/kah/derby/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java:73: cannot find symbol
      [javac] symbol : class JMXConnector
      [javac] location: class org.apache.derbyTesting.functionTests.tests.management.RemoteConnectionGetter
      [javac] JMXConnector jmxc = conns.remove(jmxConnection);
      [javac] ^
      [javac] 17 errors

      BUILD FAILED
      /home/kah/derby/trunk/build.xml:596: The following error occurred while executing this line:
      /home/kah/derby/trunk/java/testing/build.xml:80: The following error occurred while executing this line:
      /home/kah/derby/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml:53: Compile failed; see the compiler error output for details.

      Total time: 1 minute 30 seconds

      PropertySetter should ignore GCJ installations to prevent this problem. If it hadn't found GCJ, it would have constructed java15compile.classpath from java16compile.classpath, and the build would have succeeded.

      1. derby-5189-1a.diff
        2 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Thanks, Rick! Committed revision 1092333.

        Show
        Knut Anders Hatlen added a comment - Thanks, Rick! Committed revision 1092333.
        Hide
        Rick Hillegas added a comment -

        Thanks for the patch, Knut. To m this looks like a reasonable heuristic for excluding gcj. I applied the patch and verified that it does not interfere with the build on my Mac. +1

        Show
        Rick Hillegas added a comment - Thanks for the patch, Knut. To m this looks like a reasonable heuristic for excluding gcj. I applied the patch and verified that it does not interfere with the build on my Mac. +1
        Hide
        Knut Anders Hatlen added a comment -

        The attached patch skips directories that contain the string "gcj" in their names when searching for Java libraries. This made the build succeed on the Debian machine where it used to fail.

        Show
        Knut Anders Hatlen added a comment - The attached patch skips directories that contain the string "gcj" in their names when searching for Java libraries. This made the build succeed on the Debian machine where it used to fail.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development