From: ecf at goldencode.com (Eric Faulhaber) Date: Fri, 31 Aug 2007 15:47:37 -0400 Subject: [Pljava-dev] Building from source for PG 8.2.4 In-Reply-To: References: <46D79E76.1020005@goldencode.com> Message-ID: <46D87059.6080905@goldencode.com> Kris Jurka wrote: > > > On Fri, 31 Aug 2007, Eric Faulhaber wrote: > >> Curiously, I ended up with a pljava.so that was nearly 5 times larger >> than the version which was distributed with the PL/Java 1.3.0 >> release. Any idea why this would be? Does the default build included >> debug symbols? >> > > It will pick up the compile options used for the server it's built > against (see pg_config --cflags). I'm not sure how the release was > made, but you can certainly check your own config. pg_config --cflags output: -g -Wall -O2 -fPIC -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g Interesting. I installed PG 8.2.4 using Kubuntu's package manager. Odd that they would distribute a production release with debug symbols (and they seem to want to be sure of it; '-g' shows up twice!). Well, that explains the huge library file. > >> Anyway, when I try to deploy to a database using install.sql, it >> complains that it is unable to locate the JVM: >> >> psql:install.sql:6: ERROR: could not load library >> "/usr/lib/postgresql/8.2/lib/pljava.so": >> /usr/lib/postgresql/8.2/lib/pljava.so: undefined symbol: >> JNI_CreateJavaVM >> >> I've made all the same changes to postgresql.conf that were necessary to >> get this to work with my previous PG 8.1.8 installation. Likewise, I >> have set LD_LIBRARY_PATH in exactly the same way as was working before. >> For Kubuntu, this is set in /etc/postgresql/8.2//environment, >> as in: > > Have you restarted the postgres server? These changes won't take > effect without that. Yes. BTW, on Kubuntu, apparently it's not enough to SIGHUP the postmaster if you make changes to the /etc/postgresql/8.2//environment file; a full restart seems to be necessary. Actually, it turns out something was wrong with my build: pljava.so was not linking to libjvm.so. The problem area for me was with the setup of the directory in which we look to link to the JVM (in src/C/pljava/Makefile): JVM_LIB := $(firstword $(shell /bin/ls -d \ $(JRE_LIB)/client \ $(JRE_LIB)/server \ $(JRE_LIB)/jrockit \ 2> /dev/null)) For me, this was resulting in an empty string for JVM_LIB: cc -g -Wall -O2 -fPIC -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -fpic -shared -Wl,-soname,pljava.so JNICalls.o Iterator.o SPI.o PgObject.o SQLOutputToChunk.o SQLOutputToTuple.o ExecutionPlan.o SQLInputFromChunk.o Exception.o PgSavepoint.o Session.o SubXactListener.o XactListener.o HashMap.o type/Void.o type/Double.o type/Float.o type/ErrorData.o type/Array.o type/Date.o type/Timestamp.o type/Boolean.o type/Coerce.o type/Any.o type/Long.o type/AclId.o type/String.o type/HeapTupleHeader.o type/Type.o type/Byte.o type/JavaWrapper.o type/Short.o type/Portal.o type/BigDecimal.o type/LargeObject.o type/Integer.o type/UDT.o type/Time.o type/Oid.o type/TriggerData.o type/Relation.o type/Tuple.o type/TupleDesc.o type/Composite.o type/TupleTable.o type/byte_array.o backports.o Invocation.o Function.o SQLInputFromTuple.o Backend.o -L/usr/lib -L. -L"" -ljvm -o pljava.so I temporarily worked around this by hard-coding the target JVM_LIB directory in the Makefile, but clearly this is not a permanent solution. So, something appears to be invalid with my build environment. I had JAVA_HOME set to my Java 1.5 directory. Something else I should have set? > > Kris Jurka > > Thanks for your feedback! Regards, Eric Faulhaber