You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Ray Kiddy <ki...@apple.com> on 2006/07/03 05:13:00 UTC

building Derby on Mac OS X

I tried to build derby on Mac OS X and I had issues that I had not  
expected.

I just wanted to report these for now and see it anyone has  
suggestions on how to proceed. I am on a 10.4.7 system. The default  
at this point is usually 1.5, but I set the default JVM back to 1.4.2  
for the purposes of building derby. The 1.3 JVM that is on the system  
is deprecated. Really, it cannot be relied on for anything modern.

1) The build seems to assume that the default JVM is 1.3, but then it  
does not actually build if one uses that setting. I changed the  
places in the build.xml files where it hard-coded the "source" and  
"target" attributes of the javac task to "1.3" to "$ 
{default.version.JVM}". I set that variable in the ant.properties  
file. Well, I left the "1.3" where it did not break the build, but  
this value should be a variable, and not hard-coded into the  
build.xml files.

2) There were methods missing from some of the java.sql classes. A  
couple of the interfaces were not completely implemented. I put in  
stubs so that derby will compile. I would not expect them to work,  
though.

3) The code, as I checked it out, could not seem to find the  
JVMInfo.J2SE_16 ivar. I see where this is defined, but I do not see  
where the build system includes that class in the classpath of the  
other build.xml files. I just changed the references to  
JVMInfo.J2SE_16 to its value, 7.

Obviously, these are not the solutions to the issues. Are there other  
solutions already in progress? Has anyone else build Derby on a Tiger  
Mac OS X system? I will include my diffs below. I will also put the  
contents of my ~/ant.properties file here.

thanx - ray

% cd
% cat ant.properties
j13lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/ 
Classes
j14lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/ 
Classes
javatools.dir=${basedir}/tools/java

java13compile.classpath=${j13lib}/classes.jar:${j13lib}/ui.jar:$ 
{j13lib}/i18n.jar:${j13lib}/sunrsasign.jar:${javatools.dir}/jdbc2_0- 
stdext.jar

java14compile.classpath=${j14lib}/classes.jar:${j14lib}/ui.jar:$ 
{j14lib}/laf.jar:${j14lib}/sunrsasign.jar:${j14lib}/jsse.jar:$ 
{j14lib}/jce.jar:${j14lib}/charsets.jar

compile.classpath=${java14compile.classpath}
javadoc.tool.jdk14=${java.home}/bin/javadoc

default.version.JVM=1.4
%
% cd Projects/derby
%
% svn diff
Index: java/tools/org/apache/derby/impl/tools/ij/xaHelper.java
===================================================================
--- java/tools/org/apache/derby/impl/tools/ij/xaHelper.java	(revision  
418662)
+++ java/tools/org/apache/derby/impl/tools/ij/xaHelper.java	(working  
copy)
@@ -502,7 +502,7 @@
				return (XADataSource)
					(Class.forName("com.ibm.db2.jcc.DB2XADataSource").newInstance());
			else if (isNetClient){
-                            if (JVMInfo.JDK_ID >= JVMInfo.J2SE_16) {
+                            if (JVMInfo.JDK_ID >= 7) {
                                  //running under jdk1.6 or higher
                                  // try instantiating  
EmbeddedXADataSource40
                                  try {
@@ -520,7 +520,7 @@
                                      ).newInstance());
                          }
			else {
-                            if (JVMInfo.JDK_ID >= JVMInfo.J2SE_16) {
+                            if (JVMInfo.JDK_ID >= 7) {
                                  //running under jdk1.6 or higher
                                  // try instantiating  
EmbeddedXADataSource40
                                  try {
Index: java/tools/org/apache/derby/impl/tools/build.xml
===================================================================
--- java/tools/org/apache/derby/impl/tools/build.xml	(revision 418662)
+++ java/tools/org/apache/derby/impl/tools/build.xml	(working copy)
@@ -39,7 +39,6 @@
    </target>
    <target name="compile_tools_impl">
-
      <javac
        source="1.3"
        target="1.3"
@@ -56,6 +55,7 @@
        <classpath>
          <pathelement path="${compile.classpath}"/>
          <pathelement path="${jta1_2}"/>
+        <pathelement path="${out.dir}"/>
        </classpath>
        <include name="${derby.dir}/impl/tools/**"/>
        <exclude name="${derby.dir}/impl/tools/ij/mtGrammar.java"/>
Index: java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java	 
(revision 418662)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java	 
(working copy)
@@ -52,6 +52,7 @@
import java.sql.PreparedStatement;
import java.sql.CallableStatement;
import java.sql.DatabaseMetaData;
+import java.sql.Savepoint;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
@@ -93,6 +94,12 @@
	private static final StandardException exceptionClose =  
StandardException.closeException();

+    public void releaseSavepoint(Savepoint savepoint) throws  
java.sql.SQLException { }
+    public Savepoint setSavepoint() throws java.sql.SQLException  
{ return null; }
+    public Savepoint setSavepoint(String name) throws  
java.sql.SQLException { return null; }
+    public void rollback(Savepoint savepoint) throws  
java.sql.SQLException { }
+
+
      /**
       * Static exception to be thrown when a Connection request can not
       * be fulfilled due to lack of memory. A static exception as  
the lack
Index: java/engine/org/apache/derby/impl/services/build.xml
===================================================================
--- java/engine/org/apache/derby/impl/services/build.xml	(revision  
418662)
+++ java/engine/org/apache/derby/impl/services/build.xml	(working copy)
@@ -20,8 +20,8 @@
    <target name="compile_impl_services_169">
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -42,8 +42,8 @@

   <target name="compile_impl_services"  
depends="compile_impl_services_169">
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -56,7 +56,7 @@
        destdir="${out.dir}">
        <classpath>
          <pathelement location="${jce1_2_1}"/>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${java14compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/impl/services/jce/**"/>
      </javac>
Index: java/engine/org/apache/derby/jdbc/build.xml
===================================================================
--- java/engine/org/apache/derby/jdbc/build.xml	(revision 418662)
+++ java/engine/org/apache/derby/jdbc/build.xml	(working copy)
@@ -23,8 +23,8 @@
<!-- first build all non-special (non jdbc2.0) targets-->
    <target name="compile_jsr169">
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -45,8 +45,8 @@
    </target>
	  <target name="compile_jsr169_opt">
	    <javac
-	      source="1.3"
-	      target="1.3"
+	      source="${default.version.JVM}"
+	      target="${default.version.JVM}"
	      bootclasspath="${empty}"
	      nowarn="on"
	      debug="${debug}"
@@ -77,7 +77,7 @@
      <!-- Jikes 1.22 in the gump nightly build.                       
-->
      <javac
        source="${jikes.source}"
-      target="1.3"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -89,7 +89,7 @@
        srcdir="${derby.engine.src.dir}"
        destdir="${out.dir}">
        <classpath>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/jdbc/EmbeddedDriver.java"/>
        <include name="${derby.dir}/jdbc/ReferenceableDataSource.java"/>
@@ -104,8 +104,8 @@
      <!-- Do not use source attribute on javac to remain compatible  
with versions -->
      <!-- of Jikes that do not have the source  
option.                            -->
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -117,7 +117,7 @@
        srcdir="${derby.engine.src.dir}"
        destdir="${out.dir}">
        <classpath>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/jdbc/EmbeddedDriver.java"/>
        <include name="${derby.dir}/jdbc/ReferenceableDataSource.java"/>
@@ -130,8 +130,8 @@
   <target name="compile_jdbc3">
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
Index: java/engine/org/apache/derby/catalog/ 
TriggerNewTransitionRows.java
===================================================================
--- java/engine/org/apache/derby/catalog/ 
TriggerNewTransitionRows.java	(revision 418662)
+++ java/engine/org/apache/derby/catalog/ 
TriggerNewTransitionRows.java	(working copy)
@@ -25,6 +25,7 @@
import org.apache.derby.iapi.reference.JDBC20Translation;
import java.sql.Connection;
+import java.sql.ParameterMetaData;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@@ -81,6 +82,18 @@
          return resultSet.getMetaData();
      }

+    public ParameterMetaData getParameterMetaData() throws  
java.sql.SQLException { return null; }
+    public void setURL(int parameterIndex, java.net.URL x) throws  
java.sql.SQLException { }
+    public int getResultSetHoldability() throws  
java.sql.SQLException { return 0; }
+    public boolean execute(String sql, String[] columnNames) throws  
java.sql.SQLException { return false; }
+    public boolean execute(String sql, int[] columnIndexes) throws  
java.sql.SQLException { return false; }
+    public boolean execute(String sql, int autoGeneratedKeys) throws  
java.sql.SQLException { return false; }
+    public int executeUpdate(String sql, int autoGeneratedKeys)  
throws java.sql.SQLException { return 0; }
+    public int executeUpdate(String sql, int[] columnIndexes) throws  
java.sql.SQLException { return 0; }
+    public int executeUpdate(String sql, String[] columnNames)  
throws java.sql.SQLException { return 0; }
+    public ResultSet getGeneratedKeys() throws java.sql.SQLException  
{ return null; }
+    public boolean getMoreResults(int current) throws  
java.sql.SQLException { return false; }
+
     public ResultSet executeQuery() {
         return resultSet;
     }
Index: java/engine/org/apache/derby/catalog/build.xml
===================================================================
--- java/engine/org/apache/derby/catalog/build.xml	(revision 418662)
+++ java/engine/org/apache/derby/catalog/build.xml	(working copy)
@@ -21,8 +21,8 @@
    <target name="compile_catalog">
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
Index: java/engine/org/apache/derby/catalog/ 
TriggerOldTransitionRows.java
===================================================================
--- java/engine/org/apache/derby/catalog/ 
TriggerOldTransitionRows.java	(revision 418662)
+++ java/engine/org/apache/derby/catalog/ 
TriggerOldTransitionRows.java	(working copy)
@@ -25,6 +25,7 @@
import org.apache.derby.iapi.reference.JDBC20Translation;
import java.sql.Connection;
+import java.sql.ParameterMetaData;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@@ -81,6 +82,18 @@
             return resultSet;
         }

+    public ParameterMetaData getParameterMetaData() throws  
java.sql.SQLException { return null; }
+    public void setURL(int parameterIndex, java.net.URL x) throws  
java.sql.SQLException { }
+    public int getResultSetHoldability() throws  
java.sql.SQLException { return 0; }
+    public boolean execute(String sql, String[] columnNames) throws  
java.sql.SQLException { return false; }
+    public boolean execute(String sql, int[] columnIndexes) throws  
java.sql.SQLException { return false; }
+    public boolean execute(String sql, int autoGeneratedKeys) throws  
java.sql.SQLException { return false; }
+    public int executeUpdate(String sql, int autoGeneratedKeys)  
throws java.sql.SQLException { return 0; }
+    public int executeUpdate(String sql, int[] columnIndexes) throws  
java.sql.SQLException { return 0; }
+    public int executeUpdate(String sql, String[] columnNames)  
throws java.sql.SQLException { return 0; }
+    public ResultSet getGeneratedKeys() throws java.sql.SQLException  
{ return null; }
+    public boolean getMoreResults(int current) throws  
java.sql.SQLException { return false; }
+
         public int getResultSetConcurrency() {
              return JDBC20Translation.CONCUR_READ_ONLY;
         }
Index: java/drda/org/apache/derby/impl/drda/build.xml
===================================================================
--- java/drda/org/apache/derby/impl/drda/build.xml	(revision 418662)
+++ java/drda/org/apache/derby/impl/drda/build.xml	(working copy)
@@ -21,8 +21,8 @@
    <target name="compile">
    <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -35,13 +35,13 @@
        destdir="${out.dir}">
        <classpath>
          <pathelement location="${jce1_2_1}"/>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/impl/drda/DecryptionManager.java"/>
      </javac>
    <javac
-    source="1.3"
-    target="1.3"
+    source="${default.version.JVM}"
+    target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -54,15 +54,15 @@
        destdir="${out.dir}">
        <classpath>
        <pathelement location="${jta1_2}"/>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/impl/drda/DRDAXAProtocol.java"/>
        <include name="${derby.dir}/impl/drda/DRDAXid.java"/>
        <include name="${derby.dir}/impl/drda/XADatabase.java"/>
      </javac>
      <javac
-      source="1.3"
-      target="1.3"
+      source="${default.version.JVM}"
+      target="${default.version.JVM}"
        bootclasspath="${empty}"
        nowarn="on"
        debug="${debug}"
@@ -74,7 +74,7 @@
        srcdir="${derby.drda.src.dir}"
        destdir="${out.dir}">
        <classpath>
-        <pathelement path="${java13compile.classpath}"/>
+        <pathelement path="${compile.classpath}"/>
        </classpath>
        <include name="${derby.dir}/impl/drda/*.java"/>
        <exclude name="${derby.dir}/impl/drda/DecryptionManager.java"/>
Index: java/client/org/apache/derby/client/am/Configuration.java
===================================================================
--- java/client/org/apache/derby/client/am/Configuration.java	 
(revision 418662)
+++ java/client/org/apache/derby/client/am/Configuration.java	 
(working copy)
@@ -204,7 +204,7 @@
       */

      public static boolean supportsJDBC40() {
-        if (JVMInfo.JDK_ID >= JVMInfo.J2SE_16) {
+        if (JVMInfo.JDK_ID >= 7) {
              return true;
          }
          return false;


Re: building Derby on Mac OS X

Posted by Ray Kiddy <ki...@apple.com>.
On Jul 2, 2006, at 9:39 PM, Andrew McIntyre wrote:

> On 7/2/06, Ray Kiddy <ki...@apple.com> wrote:
>>
>> I tried to build derby on Mac OS X and I had issues that I had not
>> expected.
>>
>> I just wanted to report these for now and see it anyone has
>> suggestions on how to proceed. I am on a 10.4.7 system. The default
>> at this point is usually 1.5, but I set the default JVM back to 1.4.2
>> for the purposes of building derby.
>
> It is necessary do this to build Derby 10.1 on any platform. See the
> previous thread today concerning that. I thought that is was mentioned
> in the build instructions (BUILDING.txt), but maybe not.

You said:

	"However, only the JDK 1.4 and JDK 1.3 Java runtime libraries are  
needed to compile or run Derby."

This is different than saying that 1.3 and 1.4 are the only ones that  
work.

>
>> 1) </snip description of modifying the source/target attributes>
>
> This should not be necessary. Could you post the errors you received
> trying to build an unmodified source tree?

Sure. I will attach the log.


>
>> 2) There were methods missing from some of the java.sql classes. A
>> couple of the interfaces were not completely implemented. I put in
>> stubs so that derby will compile. I would not expect them to work,
>> though.
>
> This should not be the case. Could you also post these errors?

It said just that the classes were not abstract and did not implement  
all the required methods.

 From java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java:

+    public void releaseSavepoint(Savepoint savepoint) throws  
java.sql.SQLException { }
+    public Savepoint setSavepoint() throws java.sql.SQLException  
{ return null; }
+    public Savepoint setSavepoint(String name) throws  
java.sql.SQLException { return null; }
+    public void rollback(Savepoint savepoint) throws  
java.sql.SQLException { }

You see that there methods are in the Connection interface, yes?  
There is no super-class of this class that might implement them.

AFAIK, if you are building against the 1.4.2 version of the classes,  
this is what you get.

>
>> 3) The code, as I checked it out, could not seem to find the
>> JVMInfo.J2SE_16 ivar. I see where this is defined, but I do not see
>> where the build system includes that class in the classpath of the
>> other build.xml files. I just changed the references to
>> JVMInfo.J2SE_16 to its value, 7.
>
> I see the change that you made was to a file in the client code. When
> the client code is built, the JVMInfo class, part of the engine,
> should already have been built and be present in the output directory.
> The compiler should pick it up from the output directory and not the
> classpath.

I did not do an "ant clobber" after every attempt. Maybe I should.  
Perhaps there is something indeterminate in the build if parts of it  
fail.

>
>> Obviously, these are not the solutions to the issues. Are there other
>> solutions already in progress? Has anyone else build Derby on a Tiger
>> Mac OS X system? I will include my diffs below. I will also put the
>> contents of my ~/ant.properties file here.
>
> I build on Mac OS X all the time without needing any source
> modifications, as it's my primary development platform.
>
> In case it helps, here's my ant.properties:
> ...
> j13lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/ 
> Classes
> j14lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/ 
> Classes
>
> java13compile.classpath=${j13lib}/classes.jar;${j13lib}/ui.jar;$ 
> {j13lib}/i18n.jar;${j13lib}/sunrsasign.jar;${javatools.dir}/jdbc2_0- 
> stdext.jar;${j14lib}/dt.jar
> java14compile.classpath=${j14lib}/classes.jar;${j14lib}/ui.jar;$ 
> {j14lib}/laf.jar;${j14lib}/sunrsasign.jar;${j14lib}/jsse.jar;$ 
> {j14lib}/jce.jar;${j14lib}/charsets.jar;${j14lib}/dt.jar
> deprecation=off
>
> compile.classpath=${java13compile.classpath}
> javatools.dir=${basedir}/tools/java
> javadoc.tool.jdk14=${java.home}/bin/javadoc
> ...
>

The setting of the compile.classpath variable was deliberate. That  
was to make it work.
> The main difference seems to be the setting of the compile.classpath
> variable. Try setting it equal to java13compile.classpath and let me
> know if that helps.
>

What version of the system are you running? Which java is your default?

Do you have this?

% java -version
java version "1.4.2_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-232)
Java HotSpot(TM) Client VM (build 1.4.2-54, mixed mode)
%

- ray

> cheers,
> andrew


I tried setting my default version to 1.3 and I get this:

compile:
     [javac] Compiling 11 source files to /Users/ray/Projects/derby/ 
classes
     [javac] /Users/ray/Projects/derby/java/shared/org/apache/derby/ 
shared/common/reference/JDBC20Translation.java:24: cannot access  
javax.transaction.xa.XAResource
     [javac] bad class file: /Users/ray/Projects/derby/tools/java/ 
geronimo-spec-jta-1.0.1B-rc4.jar(javax/transaction/xa/XAResource.class)
     [javac] class file has wrong version 48.0, should be 47.0
     [javac] Please remove or make sure it appears in the correct  
subdirectory of the classpath.
     [javac] import javax.transaction.xa.XAResource;
     [javac]                             ^
     [javac] 1 error


I tried setting my defualt to 1.4.2 and I get:

compile_impl_services:
     [javac] Compiling 3 source files to /Users/ray/Projects/derby/ 
classes
     [javac] /Users/ray/Projects/derby/java/engine/org/apache/derby/ 
impl/services/jce/JCECipherFactory.java:52: package javax.crypto does  
not exist
     [javac] import javax.crypto.KeyGenerator;
     [javac]                     ^
     [javac] /Users/ray/Projects/derby/java/engine/org/apache/derby/ 
impl/services/jce/JCECipherFactory.java:53: package javax.crypto does  
not exist
     [javac] import javax.crypto.SecretKey;
     [javac]                     ^
     [javac] /Users/ray/Projects/derby/java/engine/org/apache/derby/ 
impl/services/jce/JCECipherFactory.java:54: package javax.crypto does  
not exist
     [javac] import javax.crypto.SecretKeyFactory;
     [javac]                     ^
     [javac] /Users/ray/Projects/derby/java/engine/org/apache/derby/ 
impl/services/jce/JCECipherFactory.java:55: package javax.crypto.spec  
does not exist
     [javac] import javax.crypto.spec.DESKeySpec;
     [javac]                          ^
     [javac] /Users/ray/Projects/derby/java/engine/org/apache/derby/ 
impl/services/jce/JCECipherFactory.java:56: package javax.crypto.spec  
does not exist
     [javac] import javax.crypto.spec.SecretKeySpec;
     [javac]                          ^



Your second e-mail:

> 	From: 	  mcintyre.a@gmail.com
> 	Subject: 	Re: building Derby on Mac OS X
> 	Date: 	July 2, 2006 10:22:34 PM PDT
> 	To: 	  derby-user@db.apache.org
> 	Reply-To: 	  derby-user@db.apache.org
>
> So, I think that setting compile.classpath=${java14compile.classpath}
> is definitely the problem here, since I just tried that on my machine
> and the build breaks in similar ways to what you described.
>
> On 7/2/06, Ray Kiddy <ki...@apple.com> wrote:
>
>> The 1.3 JVM that is on the system
>> is deprecated. Really, it cannot be relied on for anything modern.
>>
>
> What the build is looking for is not the 1.3 JVM, but its class
> libraries. Derby currently maintains compatibility with JDK 1.3.1
> (JDBC 2.0), and so it needs to reference the class libraries to
> compile the classes necessary to run Derby on JDK 1.3.1. But, you
> should run Ant with a 1.4.2 JVM (for Derby 10.1 or earlier) or with
> 1.4.2, 1.5, or 1.6 (b86 or later) for Derby 10.2 / trunk in order to
> build.
>

I'll have to parse this out.

I have a feeling it may be possible to be more explicit about the  
version stuff going on here.

- ray

>
>> 1) The build seems to assume that the default JVM is 1.3, but then it
>> does not actually build if one uses that setting.
>>
>
> The lowest JVM level that Derby supports is 1.3.1, but you need to run
> Ant with a 1.4.2 or later JVM as mentioned above in order to build it.
> Perhaps this should be made more explicit in BUILDING.txt.
>
>
>> compile.classpath=${java14compile.classpath}
>>
>
> should be set to the java13compile.classpath so that the class
> libraries for JDK 1.3.1 are picked up for the compilations that
> require them. From BUILDING.txt section 2.2:
>
> (1) Derby build environment requires you to install two levels of
>    Java Development Kit (JDK) - 1.3.x and 1.4.x as Derby is designed
>    to work in JDK1.3.x (JDBC 2.0) and JDK 1.4.x (JDBC 3.0)
>    environments. The Derby build is set up such that that most of
>    the code is compiled against JDK 1.3.x libraries so that no
>    dependencies on JDK 1.4.x classes exist, except for the code
>    that only runs in JDK1.4.x. In addition Derby's JDBC 2.0
>    implementation must compile against JDBC 2.0 class definitions
>    and the JDBC 3.0 implementation against JDBC 3.0 class
>    definitions.
>
> Conveniently, Mac OS X already has both 1.3.1 and 1.4.2 installed.
> Note that there are some other libraries that need to be downloaded to
> build a complete build, and these are mentioned in BUILDING.txt.
>
> Note that when building to target a J2ME environment, that
> compile.classpath should actually be set to reference the J2ME
> classes, and not the JDK 1.3.1 classes. This isn't your concern, but
> it's why there is a difference between compile.classpath and
> java13compile.classpath.
>
> So, try setting compile.classpath=${java13compile.classpath} in your
> ~/ant.properties and let me know if that solves your problem.
>
> thanks,
> andrew



Re: building Derby on Mac OS X

Posted by Andrew McIntyre <mc...@gmail.com>.
On 7/2/06, Ray Kiddy <ki...@apple.com> wrote:
>
> I tried to build derby on Mac OS X and I had issues that I had not
> expected.
>
> I just wanted to report these for now and see it anyone has
> suggestions on how to proceed. I am on a 10.4.7 system. The default
> at this point is usually 1.5, but I set the default JVM back to 1.4.2
> for the purposes of building derby.

It is necessary do this to build Derby 10.1 on any platform. See the
previous thread today concerning that. I thought that is was mentioned
in the build instructions (BUILDING.txt), but maybe not.

> 1) </snip description of modifying the source/target attributes>

This should not be necessary. Could you post the errors you received
trying to build an unmodified source tree?

> 2) There were methods missing from some of the java.sql classes. A
> couple of the interfaces were not completely implemented. I put in
> stubs so that derby will compile. I would not expect them to work,
> though.

This should not be the case. Could you also post these errors?

> 3) The code, as I checked it out, could not seem to find the
> JVMInfo.J2SE_16 ivar. I see where this is defined, but I do not see
> where the build system includes that class in the classpath of the
> other build.xml files. I just changed the references to
> JVMInfo.J2SE_16 to its value, 7.

I see the change that you made was to a file in the client code. When
the client code is built, the JVMInfo class, part of the engine,
should already have been built and be present in the output directory.
The compiler should pick it up from the output directory and not the
classpath.

> Obviously, these are not the solutions to the issues. Are there other
> solutions already in progress? Has anyone else build Derby on a Tiger
> Mac OS X system? I will include my diffs below. I will also put the
> contents of my ~/ant.properties file here.

I build on Mac OS X all the time without needing any source
modifications, as it's my primary development platform.

In case it helps, here's my ant.properties:
...
j13lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Classes
j14lib=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes

java13compile.classpath=${j13lib}/classes.jar;${j13lib}/ui.jar;${j13lib}/i18n.jar;${j13lib}/sunrsasign.jar;${javatools.dir}/jdbc2_0-stdext.jar;${j14lib}/dt.jar
java14compile.classpath=${j14lib}/classes.jar;${j14lib}/ui.jar;${j14lib}/laf.jar;${j14lib}/sunrsasign.jar;${j14lib}/jsse.jar;${j14lib}/jce.jar;${j14lib}/charsets.jar;${j14lib}/dt.jar
deprecation=off

compile.classpath=${java13compile.classpath}
javatools.dir=${basedir}/tools/java
javadoc.tool.jdk14=${java.home}/bin/javadoc
...

The main difference seems to be the setting of the compile.classpath
variable. Try setting it equal to java13compile.classpath and let me
know if that helps.


cheers,
andrew

Re: building Derby on Mac OS X

Posted by Andrew McIntyre <mc...@gmail.com>.
So, I think that setting compile.classpath=${java14compile.classpath}
is definitely the problem here, since I just tried that on my machine
and the build breaks in similar ways to what you described.

On 7/2/06, Ray Kiddy <ki...@apple.com> wrote:
> The 1.3 JVM that is on the system
> is deprecated. Really, it cannot be relied on for anything modern.

What the build is looking for is not the 1.3 JVM, but its class
libraries. Derby currently maintains compatibility with JDK 1.3.1
(JDBC 2.0), and so it needs to reference the class libraries to
compile the classes necessary to run Derby on JDK 1.3.1. But, you
should run Ant with a 1.4.2 JVM (for Derby 10.1 or earlier) or with
1.4.2, 1.5, or 1.6 (b86 or later) for Derby 10.2 / trunk in order to
build.

> 1) The build seems to assume that the default JVM is 1.3, but then it
> does not actually build if one uses that setting.

The lowest JVM level that Derby supports is 1.3.1, but you need to run
Ant with a 1.4.2 or later JVM as mentioned above in order to build it.
Perhaps this should be made more explicit in BUILDING.txt.

> compile.classpath=${java14compile.classpath}

should be set to the java13compile.classpath so that the class
libraries for JDK 1.3.1 are picked up for the compilations that
require them. From BUILDING.txt section 2.2:

(1) Derby build environment requires you to install two levels of
    Java Development Kit (JDK) - 1.3.x and 1.4.x as Derby is designed
    to work in JDK1.3.x (JDBC 2.0) and JDK 1.4.x (JDBC 3.0)
    environments. The Derby build is set up such that that most of
    the code is compiled against JDK 1.3.x libraries so that no
    dependencies on JDK 1.4.x classes exist, except for the code
    that only runs in JDK1.4.x. In addition Derby's JDBC 2.0
    implementation must compile against JDBC 2.0 class definitions
    and the JDBC 3.0 implementation against JDBC 3.0 class
    definitions.

Conveniently, Mac OS X already has both 1.3.1 and 1.4.2 installed.
Note that there are some other libraries that need to be downloaded to
build a complete build, and these are mentioned in BUILDING.txt.

Note that when building to target a J2ME environment, that
compile.classpath should actually be set to reference the J2ME
classes, and not the JDK 1.3.1 classes. This isn't your concern, but
it's why there is a difference between compile.classpath and
java13compile.classpath.

So, try setting compile.classpath=${java13compile.classpath} in your
~/ant.properties and let me know if that solves your problem.

thanks,
andrew