Thread: org.postgresql.Driver.java compile problem

org.postgresql.Driver.java compile problem

From
Juhan-Peep Ernits
Date:
Hello!

I got the CVS version today and tried to compile postgres and jdbc
driver. The latter did not succeed without manual intervention, since
Driver.java is not parsed correctly: 

${major} and ${minor} stay unreplaced

and generate error while compiling. 

Java is IBM-SDK1.3 and ant is Ant version 1.2 compiled on October 24 2000.


May be I do something wrong, but the same procedure has succeeded earlier,
that failed today. 

Juhan Ernits





Re: org.postgresql.Driver.java compile problem

From
Marko Kreen
Date:
Try the following patch.

- ant 1.2 does not understand defines after target
- ant 1.2 cannot create .jar without manifest file

On Mon, Mar 19, 2001 at 01:06:30PM +0200, Juhan-Peep Ernits wrote:
> I got the CVS version today and tried to compile postgres and jdbc
> driver. The latter did not succeed without manual intervention, since
> Driver.java is not parsed correctly:
>
> ${major} and ${minor} stay unreplaced
>
> and generate error while compiling.
>
> Java is IBM-SDK1.3 and ant is Ant version 1.2 compiled on October 24 2000.
>
>
> May be I do something wrong, but the same procedure has succeeded earlier,
> that failed today.

Dunno if you noticed it or not: do not use ant directly in jdbc/
dir, use make.

--
marko


diff -urNX /home/marko/misc/diff-exclude pgsql.orig/contrib/retep/build.xml pgsql/contrib/retep/build.xml
--- pgsql.orig/contrib/retep/build.xml    Mon Mar 19 20:52:45 2001
+++ pgsql/contrib/retep/build.xml    Mon Mar 19 15:27:29 2001
@@ -43,7 +43,8 @@

   <!-- Builds the various jar files -->
   <target name="jar" depends="compile">
-    <jar jarfile="${jars}/retepTools.jar" basedir="${dest}">
+    <jar jarfile="${jars}/retepTools.jar" basedir="${dest}"
+        manifest="manifest">
       <include name="${package}/**" />
     </jar>
   </target>
diff -urNX /home/marko/misc/diff-exclude pgsql.orig/contrib/retep/manifest pgsql/contrib/retep/manifest
--- pgsql.orig/contrib/retep/manifest    Thu Jan  1 03:00:00 1970
+++ pgsql/contrib/retep/manifest    Mon Mar 19 15:27:38 2001
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff -urNX /home/marko/misc/diff-exclude pgsql.orig/src/interfaces/jdbc/Makefile pgsql/src/interfaces/jdbc/Makefile
--- pgsql.orig/src/interfaces/jdbc/Makefile    Mon Mar 19 20:53:50 2001
+++ pgsql/src/interfaces/jdbc/Makefile    Mon Mar 19 20:55:38 2001
@@ -20,12 +20,12 @@
         -Ddef_pgport=$(DEF_PGPORT)

 all:
-    $(ANT) -buildfile $(top_srcdir)/build.xml $(properties)
+    $(ANT) $(properties) -buildfile $(top_srcdir)/build.xml

 install: installdirs
     $(ANT) -Dinstall.directory=$(DESTDIR)$(datadir)/java \
-        -buildfile $(top_srcdir)/build.xml \
-        install $(properties)
+        $(properties) -buildfile $(top_srcdir)/build.xml \
+        install

 installdirs:
     $(mkinstalldirs) $(DESTDIR)$(datadir)/java
diff -urNX /home/marko/misc/diff-exclude pgsql.orig/src/interfaces/jdbc/build.xml pgsql/src/interfaces/jdbc/build.xml
--- pgsql.orig/src/interfaces/jdbc/build.xml    Mon Mar 19 20:53:14 2001
+++ pgsql/src/interfaces/jdbc/build.xml    Mon Mar 19 15:24:13 2001
@@ -15,6 +15,9 @@
   <property name="dest"    value="build" />
   <property name="package" value="org/postgresql" />

+  <!-- for some reason ant 1.2 cannot create jar without manifest file -->
+  <property name="manifest" value="${src}/manifest" />
+
   <!--
     defaults for the tests - overide these if required
     junit.ui is one of textui, awtui or swingui
@@ -135,8 +138,13 @@

   <!-- This builds the jar file containing the driver -->
   <target name="jar" depends="compile,examples">
-    <jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="${package}/**" excludes="${package}/test/**"/>
-    <jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**" />
+    <jar jarfile="${jars}/postgresql.jar" basedir="${dest}"
+            includes="${package}/**"
+        excludes="${package}/test/**"
+        manifest="${manifest}"/>
+    <jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}"
+        includes="example/**"
+        manifest="${manifest}"/>
   </target>

   <!--
diff -urNX /home/marko/misc/diff-exclude pgsql.orig/src/interfaces/jdbc/manifest pgsql/src/interfaces/jdbc/manifest
--- pgsql.orig/src/interfaces/jdbc/manifest    Thu Jan  1 03:00:00 1970
+++ pgsql/src/interfaces/jdbc/manifest    Mon Mar 19 15:16:23 2001
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+

Re: [PATCHES] Re: org.postgresql.Driver.java compile problem

From
Peter Eisentraut
Date:
Marko Kreen writes:

> - ant 1.2 does not understand defines after target
> - ant 1.2 cannot create .jar without manifest file

I'm using Ant 1.2 here and both of these work.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: [PATCHES] Re: org.postgresql.Driver.java compile problem

From
Marko Kreen
Date:
On Mon, Mar 19, 2001 at 09:01:36PM +0100, Peter Eisentraut wrote:
> Marko Kreen writes:
>
> > - ant 1.2 does not understand defines after target
> > - ant 1.2 cannot create .jar without manifest file
>
> I'm using Ant 1.2 here and both of these work.

I have ant 1.2 Nov 21 build from Debian and they do not work.
With both JDK 1.2.2 & JDK 1.3.

The first seems official from 'ant -h', as it shows
'ant [options] targets+'.  About the second point I can
say only it does not work without it here.

Seems like others have problems too...

Does these changes break anything?

--
marko


Re: org.postgresql.Driver.java compile problem

From
Juhan-Peep Ernits
Date:
Hello!

I applied the patches that Marko Kreen provided, but it seems that it did
not
solve my problem. (System is Debian "woody", source is CVS 20.03.2001, 
ant is Ant version 1.2 compiled on October 24 2000). Should I upgrade ant
or am I doing something else wrong?

Configuration options:


CFLAGS="-m486 -O2" \       ./configure \       --enable-multibyte \       --enable-unicode-conversion \
--with-maxbackends=64\       --with-gnu-ld \       --with-java \       --prefix=/opt/postgres
 


Excerpt of make results:


make[3]: Leaving directory
`/home/juhan/sources/pgsql/src/interfaces/libpgeasy'
make[3]: Entering directory
`/home/juhan/sources/pgsql/src/interfaces/jdbc'
/opt/ant/bin//ant -Dmajor=7 -Dminor=1 -Dfullversion=7.1beta6
-Ddef_pgport=5432 -buildfile ../../../build.xml
Buildfile: ../../../build.xml

jar:

call:

prepare:

check_versions:

driver:
Configured build for the JDBC2 edition driver.

compile:   [javac] Compiling 41 source files to
/home/juhan/sources/pgsql/src/interfaces/jdbc/build   [javac]
/home/juhan/sources/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:199: ';'
expected   [javac]     return ${major};   [javac]             ^   [javac]
/home/juhan/sources/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:209: ';'
expected   [javac]     return ${minor};   [javac]             ^   [javac]
/home/juhan/sources/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:199: cannot
resolve symbol   [javac] symbol  : variable $     [javac] location: class org.postgresql.Driver   [javac]     return
${major};  [javac]            ^   [javac]
 
/home/juhan/sources/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:209: cannot
resolve symbol   [javac] symbol  : variable $     [javac] location: class org.postgresql.Driver   [javac]     return
${minor};  [javac]            ^   [javac] Note: Some input files use or override a deprecated API.   [javac] Note:
Recompilewith -deprecation for details.   [javac] 4 errors
 

BUILD FAILED

/home/juhan/sources/pgsql/src/interfaces/jdbc/build.xml:105: Compile
failed, messages should have been provided.

Total time: 12 seconds
make[3]: *** [all] Error 1
make[3]: Leaving directory `/home/juhan/sources/pgsql/src/interfaces/jdbc'


Regards,

Juhan Ernits




Re: org.postgresql.Driver.java compile problem

From
Marko Kreen
Date:
On Tue, Mar 20, 2001 at 10:36:25AM +0200, Juhan-Peep Ernits wrote:
> 
> I applied the patches that Marko Kreen provided, but it seems that it did
> not
> solve my problem. (System is Debian "woody", source is CVS 20.03.2001, 
> ant is Ant version 1.2 compiled on October 24 2000). Should I upgrade ant
> or am I doing something else wrong?

Does 'make clean' help?

-- 
marko



Re: org.postgresql.Driver.java compile problem

From
Juhan-Peep Ernits
Date:

On Tue, 20 Mar 2001, Marko Kreen wrote:

> On Tue, Mar 20, 2001 at 10:36:25AM +0200, Juhan-Peep Ernits wrote:
> > 
> > I applied the patches that Marko Kreen provided, but it seems that it did
> > not
> > solve my problem. (System is Debian "woody", source is CVS 20.03.2001, 
> > ant is Ant version 1.2 compiled on October 24 2000). Should I upgrade ant
> > or am I doing something else wrong?
> 
> Does 'make clean' help?

Stupid me! Of course it helped!

Juhan Ernits