Subject: [Pljava-dev] Pl/Java package in Ubuntu

From: p.brewer at ltrr.arizona.edu (Peter Brewer)
Date: Tue, 08 Sep 2015 12:02:44 -0700

Hi all,

I'm one of those leeches that uses PL/Java but doesn't have the 
expertise to contribute directly.  So first of all, thanks for the great 
work!

I'm the lead developer for a scientific server/client database 
application (www.tellervo.org) that uses PL/Java.  The server portion is 
distributed as an Ubuntu package and used by a number of labs around the 
world.  The average user of my product is therefore a scientist rather 
than hard core techie.  As such I need to give them a package that can 
be easily installed and configured without them getting their hands dirty.

My last release was aimed at Ubuntu 12.04 LTS and worked fine as 
Postgres 9.1 and compatible pljava packages were available in the main 
repos.

I'm now looking at releasing the next version but see that pljava has 
been removed from the Debian repository primarily to 64 bit issues:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=743364

There is currently a pljava package for PG9.3 in the Ubuntu 14.04 
repositories but once installed even on 32bit OS it fails to run with 
the following error:
ERROR:  could not load library "/usr/lib/postgresql/9.3/lib/pljava.so": 
/usr/lib/postgresql/9.3/lib/pljava.so: undefined symbol: HeapTupleGetOid

So in summary, pljava won't work "out-of-the-box" on Ubuntu beyond 12.04 
and with the end-of-life date rapidly approaching I'm beginning to panic 
a bit!

Is anyone working on this?  Are there substantial technical issues that 
need solving or is it just a matter of the packaging?  A PPA package for 
32bit pljava PG9.3 would be great or even a roadmap as to when such a 
package might be available!

Many thanks

Peter

-- 
*********************************
Dr Peter Brewer
Research Associate
Rm 405, Bryant Bannister Building
Laboratory of Tree-Ring Research
1215 E Lowell St
Tucson AZ 85721
USA
Phone: +1 520 621 0753
Fax  : +1 520 621 8229
Email: p.brewer at ltrr.arizona.edu
Web  : http://ltrr.arizona.edu
*********************************

---

From: bgiles at coyotesong.com (Bear Giles)
Date: Tue, 8 Sep 2015 13:42:31 -0600

I looked at that recently so let me try to recap...

1. 12.04 required the GNU "gcj" compiler. That compiler was never widely
used and further development stopped a long time ago.

2. You can build pl/java yourself now using the 'maven' tool chain. I think
the wiki was just updated on how to do that.

3. The Debian/Ubuntu package is built around the GNU tool chain. It would
need a rewrite today.

4. (I haven't done Debian/Ubuntu packaging for a long time so my knowledge
on how to build modern packages is stale.)

5. There is a way to package an existing deployment - you create a
directory with all of the files you want, run the tool, and it produces the
.deb file. That's probably your best bet - build systems for 32- and 64-bit
systems and then bundle them up. I don't know the name of the tool, just
that it undoubtedly starts with "deb". :-)

6. You can use init scripts to autoinstall (and autoremove) pl/java in the
database

7. But you also need to edit /etc/postgresql/9.x/main/postgresql.conf
(iirc). Editing conf files programmatically is always iffy - you'll need
them to do that themselves unless you are absolutely certain you know their
configuration. (hint: you don't.)

8. Finally get a second or third opinion. I had to scratch an itch a few
months ago so I asked many of these questions but there's no guarantee that
I understood the answers.

HTH,

Bear

On Tue, Sep 8, 2015 at 1:02 PM, Peter Brewer <p.brewer at ltrr.arizona.edu>
wrote:

> Hi all,
>
> I'm one of those leeches that uses PL/Java but doesn't have the expertise
> to contribute directly.  So first of all, thanks for the great work!
>
> I'm the lead developer for a scientific server/client database application
> (www.tellervo.org) that uses PL/Java.  The server portion is distributed
> as an Ubuntu package and used by a number of labs around the world.  The
> average user of my product is therefore a scientist rather than hard core
> techie.  As such I need to give them a package that can be easily installed
> and configured without them getting their hands dirty.
>
> My last release was aimed at Ubuntu 12.04 LTS and worked fine as Postgres
> 9.1 and compatible pljava packages were available in the main repos.
>
> I'm now looking at releasing the next version but see that pljava has been
> removed from the Debian repository primarily to 64 bit issues:
> repositories but once installed even on 32bit OS it fails to run with the
> following error:
> and with the end-of-life date rapidly approaching I'm beginning to panic a
> bit!
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at lists.pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20150908/b5d2a54e/attachment.html>

---

From: p.brewer at ltrr.arizona.edu (Peter Brewer)
Date: Tue, 08 Sep 2015 14:56:19 -0700

Thanks for the recap Bear.

I checked the PLJava archives after I sent my email I reminded myself 
that I sent out a pretty similar email in 2010 with regard support for 
PLJava with PG8.4!  As you point out the tool chain could do with 
rewriting to make building newer versions simpler and quicker so that 
we're not back at this point again in 2020. :-)

It's great that PLJava has moved to Maven.  There are of course Maven 
plugins for generating debian (and rpm) packages which are pretty simple 
to use.  I've used Maven to do single click builds for Windows, OSX, 
Debian/Ubuntu and Redhat for a couple of years now.  I'd be happy to 
lend a hand but I fear I'd be way out of my depth with the actual pljava 
stuff - especially your point 7 below.

Anyone else out there fancy giving their second or third opinion?

Thanks

Peter

On 09/08/2015 12:42 PM, Bear Giles wrote:
> 1. 12.04 required the GNU "gcj" compiler. That compiler was never 
> widely used and further development stopped a long time ago.
>
> 2. You can build pl/java yourself now using the 'maven' tool chain. I 
> think the wiki was just updated on how to do that.
>
> 3. The Debian/Ubuntu package is built around the GNU tool chain. It 
> would need a rewrite today.
>
> 4. (I haven't done Debian/Ubuntu packaging for a long time so my 
> knowledge on how to build modern packages is stale.)
>
> directory with all of the files you want, run the tool, and it 
> produces the .deb file. That's probably your best bet - build systems 
> for 32- and 64-bit systems and then bundle them up. I don't know the 
> name of the tool, just that it undoubtedly starts with "deb". :-)
>
> 6. You can use init scripts to autoinstall (and autoremove) pl/java in 
> the database
>
> (iirc). Editing conf files programmatically is always iffy - you'll 
> need them to do that themselves unless you are absolutely certain you 
> know their configuration. (hint: you don't.)
>
> 8. Finally get a second or third opinion. I had to scratch an itch a 
> few months ago so I asked many of these questions but there's no 
> guarantee that I understood the answers.
>
> HTH,
>
> Bear
>
>
> On Tue, Sep 8, 2015 at 1:02 PM, Peter Brewer 
> <p.brewer at ltrr.arizona.edu <mailto:p.brewer at ltrr.arizona.edu>> wrote:
>
>     Hi all,
>
>     expertise to contribute directly.  So first of all, thanks for the
>     great work!
>
>     application (www.tellervo.org <http://www.tellervo.org>) that uses
>     PL/Java.  The server portion is distributed as an Ubuntu package
>     and used by a number of labs around the world. The average user of
>     my product is therefore a scientist rather than hard core techie. 
>     As such I need to give them a package that can be easily installed
>     Postgres 9.1 and compatible pljava packages were available in the
>     main repos.
>
>     I'm now looking at releasing the next version but see that pljava
>     has been removed from the Debian repository primarily to 64 bit
>     issues:
>     repositories but once installed even on 32bit OS it fails to run
>     with the following error:
>     So in summary, pljava won't work "out-of-the-box" on Ubuntu beyond
>     12.04 and with the end-of-life date rapidly approaching I'm
>     beginning to panic a bit!
>
>     Is anyone working on this?  Are there substantial technical issues
>     that need solving or is it just a matter of the packaging?  A PPA
>     package for 32bit pljava PG9.3 would be great or even a roadmap as
>     to when such a package might be available!
>
>     Many thanks
>
>     Peter
>
>     -- 
>     Phone: +1 520 621 0753 <tel:%2B1%20520%20621%200753>
>     Fax  : +1 520 621 8229 <tel:%2B1%20520%20621%208229>
>     Email: p.brewer at ltrr.arizona.edu <mailto:p.brewer at ltrr.arizona.edu>
>     Pljava-dev at lists.pgfoundry.org <mailto:Pljava-dev at lists.pgfoundry.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20150908/4e1b305e/attachment.html>

---

From: chap at anastigmatix.net (Chapman Flack)
Date: Sat, 12 Sep 2015 14:21:10 -0400

> /usr/lib/postgresql/9.3/lib/pljava.so: undefined symbol: HeapTupleGetOid

Hmm ... PG 9.3.3. is what I've got installed here, and pljava loads just
fine.  I think this has to be a problem in how that Ubuntu package was
built, because HeapTupleGetOid is a preprocessor macro defined in a
PostgreSQL header file (/usr/include/postgresql/server/access/htup_details.h
or wherever it lives in your distro) ... and it has been since 2002, if
git blame can be believed.

So, if that name ended up in the shared object as an undefined symbol ref,
I have to think that Ubuntu build must have been made somehow without all
the right PostgreSQL includes on the path ... very strange, I wouldn't
expect it to work very well.

> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=743364

I took a look at that report; the particular C diagnostics they show
there do not show up when I build (on x86_64) and I think you will get
a working build if you just run 'mvn package' and then put the .so and
.jar where they need to be, and make the right postgresql.conf settings.

There are still a lot of C diagnostics in the build, more than I like
to see, and until now I've been taking the attitude of "hmm, look at those
later" because they don't stop the build and it loads and runs tests.
I have begun to look at them... by my count, it's 112 warnings at 109
locations in 57 functions in 26 .c files, and I'd like to get those numbers
moving in a downward direction. A lot of them are signed/unsigned
disagreements between things like pgsql's, C's, and JNI's ideas of a
'size' type, and so on.

I'm also working on the build process and documentation. It might be
less fiddly soon (that's higher priority for me really than the C warnings).
But in the meantime I think the current process should work and allow you
to build what you need.

-Chap

---

From: chap at anastigmatix.net (Chapman Flack)
Date: Sat, 12 Sep 2015 17:35:06 -0400

On 09/12/15 14:21, Chapman Flack wrote:

> to see ... 112 warnings at 109 locations in 57 functions in 26 .c files

broken down by gcc's warning categories:

     86 sign-conversion
     22 conversion
      3 switch
      1 dflt: argument 2 of RegisterTimeout from incompatible pointer type

-Chap