agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] Problems compiling under Mac OS X
7+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-14 08:29
0 siblings, 1 reply; 7+ messages in thread
From: @ 2004-05-14 08:29 UTC (permalink / raw)
Hello,
Here some reports of problems I have got trying compiling pljava under
Mac OS X:
1. the jni.h file is in the JavaVM framework
This requires a simple modification of the pljva/C/Makefile
#-----------------------------------------------------------------------
--
#
# Makefile--
# Makefile for pljava
#
#-----------------------------------------------------------------------
--
NAME := pljava
include $(MODULEROOT)/Makefile.global
ifeq ($(PORTNAME), win32)
DLL_BUILD := 1
else
ifeq ($(PORTNAME), cygwin)
DLL_BUILD := 1
override CPPFLAGS := -DCYGWIN $(CPPFLAGS)
else
ifeq ($(PORTNAME), darwin)
DLL_BUILD := 0
override CPPFLAGS := -DDARWIN -framework JavaVM $(CPPFLAGS)
else
JRE_INCL := $(PORTNAME)
ifeq ($(host_cpu), i686)
JRE_LIB := lib/i386/client
else
JRE_LIB := lib/$(host_cpu)/client
endif
endif
endif
endif
2. every #include <jni.h>
should be converted to
#ifdef DARWIN
#include <JavaVM/jni.h>
#else
#include <jni.h>
#endif
3. ant 1.5.1 is installed by default on Mac OS X
the build fails with
BUILD FAILED
file:/Volumes/Data2/download_osx/PostgreSQL/org.postgresql.pljava/
build.xml:30: Could not create task or type of type: depend.
Ant could not find the task or a class this task relies upon.
Should I have to install another ant version ?
Another .jar missing ?
Any idea ?
Pascal Pochet
p3consulting at mac.com
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20040514/df226594/attachment.bin;
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-14 10:58
parent:
0 siblings, 1 reply; 7+ messages in thread
From: @ 2004-05-14 10:58 UTC (permalink / raw)
Hi Pascal,
The makefile is easy enough to change. I don't have access to a Mac OS X
based machine though, so it's hard for me to test that the change is
correct. I'd very much like your help. Some suggestions and answers to your
questions:
Instead of adding #ifdef DARWIN to the source code in order to find the
jni.h, I'd suggest that you instead add a -I flag to the CPPFLAGS. I'm a big
fan of controlling the environment through the makefile instead of using
#ifdef whenever possible.
Regarding 'ant'. There are two possibilities. Either the 'depend' task is
defined in the optional.jar (included in the ant distrib) and you don't have
that in your classpath, or you ant version is too old. In any case, I'd
recommend that you uppgrade ant. 1.5.1 whas a while ago...
If you get it up and running, I'd be happy to apply a patch.
Kind regards,
Thomas Hallgren
----- Original Message -----
From: "p3consulting" <p3consulting at mac.com>
To: <pljava-dev at gborg.postgresql.org>
Sent: Friday, May 14, 2004 10:29 AM
Subject: [Pljava-dev] Problems compiling under Mac OS X
> Hello,
>
> Here some reports of problems I have got trying compiling pljava under
> Mac OS X:
>
> 1. the jni.h file is in the JavaVM framework
> This requires a simple modification of the pljva/C/Makefile
>
> #-----------------------------------------------------------------------
> --
> #
> # Makefile--
> # Makefile for pljava
> #
> #-----------------------------------------------------------------------
> --
> NAME := pljava
>
> include $(MODULEROOT)/Makefile.global
>
> ifeq ($(PORTNAME), win32)
> DLL_BUILD := 1
> else
> ifeq ($(PORTNAME), cygwin)
> DLL_BUILD := 1
> override CPPFLAGS := -DCYGWIN $(CPPFLAGS)
> else
> ifeq ($(PORTNAME), darwin)
> DLL_BUILD := 0
> override CPPFLAGS := -DDARWIN -framework JavaVM $(CPPFLAGS)
> else
> JRE_INCL := $(PORTNAME)
> ifeq ($(host_cpu), i686)
> JRE_LIB := lib/i386/client
> else
> JRE_LIB := lib/$(host_cpu)/client
> endif
> endif
> endif
> endif
>
>
> 2. every #include <jni.h>
> should be converted to
> #ifdef DARWIN
> #include <JavaVM/jni.h>
> #else
> #include <jni.h>
> #endif
>
> 3. ant 1.5.1 is installed by default on Mac OS X
> the build fails with
>
> BUILD FAILED
> file:/Volumes/Data2/download_osx/PostgreSQL/org.postgresql.pljava/
> build.xml:30: Could not create task or type of type: depend.
>
> Ant could not find the task or a class this task relies upon.
>
> Should I have to install another ant version ?
> Another .jar missing ?
>
> Any idea ?
>
> Pascal Pochet
> p3consulting at mac.com
> ----------------------------------
> PGP
> KeyID: 0x208C5DBF
> Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-14 15:02
parent:
0 siblings, 2 replies; 7+ messages in thread
From: @ 2004-05-14 15:02 UTC (permalink / raw)
Le mai 14, 2004, ? 12:58, Thomas Hallgren a ?crit :
> Hi Pascal,
> The makefile is easy enough to change. I don't have access to a Mac OS
> X
> based machine though, so it's hard for me to test that the change is
> correct. I'd very much like your help. Some suggestions and answers to
> your
> questions:
>
> Instead of adding #ifdef DARWIN to the source code in order to find the
> jni.h, I'd suggest that you instead add a -I flag to the CPPFLAGS. I'm
> a big
> fan of controlling the environment through the makefile instead of
> using
> #ifdef whenever possible.
>
whenever possible... I agree
I do have given a try to
-I/System/Library/Frameworks/JavaVM.framework/Headers/
and it works...
a the condtion to change the linking instructions (see below).
> Regarding 'ant'. There are two possibilities. Either the 'depend' task
> is
> defined in the optional.jar (included in the ant distrib) and you
> don't have
> that in your classpath, or you ant version is too old. In any case, I'd
> recommend that you uppgrade ant. 1.5.1 whas a while ago...
>
Bingo !
the optional.jar was missing !
Now using the ant shipping with JBuilderX (1.5.4)
so the C/pljava/Makefile is now
#-----------------------------------------------------------------------
--
#
# Makefile--
# Makefile for pljava
#
#-----------------------------------------------------------------------
--
NAME := pljava
include $(MODULEROOT)/Makefile.global
ifeq ($(PORTNAME), win32)
DLL_BUILD := 1
else
ifeq ($(PORTNAME), cygwin)
DLL_BUILD := 1
override CPPFLAGS := -DCYGWIN $(CPPFLAGS)
else
ifeq ($(PORTNAME), darwin)
override CPPFLAGS :=
-I/System/Library/Frameworks/JavaVM.framework/Headers/ $(CPPFLAGS)
else
JRE_INCL := $(PORTNAME)
ifeq ($(host_cpu), i686)
JRE_LIB := lib/i386/client
else
JRE_LIB := lib/$(host_cpu)/client
endif
endif
endif
endif
ifdef DLL_BUILD
JRE_INCL := win32
JRE_LIB := bin/client
# This works but is not very nice since it affects all
# DLLTOOL invocations in Makefile.shlib. A custom flag
# is requested from postgres.
#
override DLLTOOL := $(DLLTOOL) --add-stdcall-alias
endif
ifdef USE_GCJ
override CPPFLAGS := -DGCJ $(CPPFLAGS)
SHLIB_LINK = $(BE_DLLLIBS) -lgcj -lwsock32
else
ifeq ($(PORTNAME), darwin)
SHLIB_LINK = $(BE_DLLLIBS) -L. -framework JavaVM
else
override CPPFLAGS := -I$(JDK_HOME)/include
-I$(JDK_HOME)/include/$(JRE_INCL) $(CPPFLAGS)
SHLIB_LINK = $(BE_DLLLIBS) -L. -L$(JDK_HOME)/jre/$(JRE_LIB)
-ljvm
endif
endif
... no changes after that
The change
#ifdef DARWIN
#include <JavaVM/jni.h>
#else
#include <jni.h>
#endif
shoudl not be necessary anymore.
Now everything compiles,
regarding the tests : do you have any more precise instructions to
follow than what is in the README ?
Pascal Pochet
p3consulting at mac.com
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20040514/20b3e97d/attachment.bin;
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-14 19:16
parent:
1 sibling, 1 reply; 7+ messages in thread
From: @ 2004-05-14 19:16 UTC (permalink / raw)
p3consulting wrote:
> Now everything compiles,
Great!
> regarding the tests : do you have any more precise instructions to
> follow than what is in the README ?
No, sorry, I don't, but I'd like the instructions to be as stright
forward as possible. Your opinions on what's missing are valuable. If
you run into problems or have specific questions, I'd be happy to help
(and improve the instructions).
- thomas
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-15 10:28
parent:
0 siblings, 0 replies; 7+ messages in thread
From: @ 2004-05-15 10:28 UTC (permalink / raw)
p3consulting wrote:
> Thomas,
>
> I think what could be the easiest is an independant shell script
> (triggered by make test) doing some automated testing (creating a new
> database, the tables, filling with some data, etc.) to see if
> everything is ok.
I agree. That's a good suggestion. I'll look into improving the tests. I
think I'll write the tests Java and spawn the JVM with correct classpath
using Ant rather than using make and shell-scripts though, to make it
more portable.
> Asking to look at another contrib like spi may be confusing...
> especially in case of trouble.
The Server Programming Interface (SPI) is not another contrib. It's an
integral part of the PostgreSQL core distribution and it's the function
package on which the Pl/Java JDBC driver is built. I agree it's not
ideal to refer to it but rather than copying and maintaining a vast
amount of information from the PostgreSQL manual (I have somewhat
limited resources ;-), I chosed to mention it in the user guide in order
to explain:
a) why some limitations are there that is due to the use of SPI.
b) that the JDBC connection runs within the same transaction as the invoker.
c) that detailed info regarding the command execution can be found,
reading about the SPI in the PostgreSQL manual.
> I suppose I would have to change it to:
>
> su - postgres -c 'sh -c "( export
> CLASSPATH=/Library/Java/Extensions/pljava.jar ;
> /usr/local/bin/postmaster -i -D /usr/local/pgsql/data >>
> /usr/local/pgsql/logs/logfile 2>&1 & )"'
>
> What do you think ? More to put in the CLASSPATH ? the postgresql.jar ?
Your suggested classpath looks OK. The postgresql.jar should not be in
the classpath since Pl/Java uses it's own JDBC driver that sits directly
on top of the SPI functions.
Another prerequisite is that the LD_LIBRARY_PATH is set so that the
postmaster can find the jvm shared lib (in the Java distribution).
Judging from the error you get, your setting must be correct, the pljava
shared lib wouldn't load at all if it was wrong.
Kind regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-17 07:52
parent:
1 sibling, 1 reply; 7+ messages in thread
From: @ 2004-05-17 07:52 UTC (permalink / raw)
Just an additional question before I add your makefile changes. I'm not well
acquainted with Mac OS X so perhaps this is a bad idea.
You use the absolute path "/System/Library/Frameworks" to find the JavaVM
framework. Is it mandatory that this framework is installed at this path?
The Apple version of GCC will also search "/Library/Frameworks" and
"/Local/Library/Frameworks" per default.
Perhaps it would be a good idea to introduce an overridable variable and use
the your suggested path as the default? Something like this:
ifeq ($(PORTNAME), darwin)
JAVAVM_FWX_ROOT := /System/Library/Frameworks
override CPPFLAGS
:= -I$(JAVAVM_FWX_ROOT)/JavaVM.framework/Headers $(CPPFLAGS)
else
Anyone that has JavaVM installed in some root other than
/System/Library/Frameworx can now write:
make JAVAVM_FWX_ROOT=/Local/Library/Frameworx
Kind regards,
Thomas Hallgren
----- Original Message -----
From: "p3consulting" <p3consulting at mac.com>
To: <pljava-dev at gborg.postgresql.org>
Cc: "Thomas Hallgren" <thhal at mailblocks.com>
Sent: Friday, May 14, 2004 17:02
Subject: Re: [Pljava-dev] Problems compiling under Mac OS X
Le mai 14, 2004, ? 12:58, Thomas Hallgren a ?crit :
> Hi Pascal,
> The makefile is easy enough to change. I don't have access to a Mac OS
> X
> based machine though, so it's hard for me to test that the change is
> correct. I'd very much like your help. Some suggestions and answers to
> your
> questions:
>
> Instead of adding #ifdef DARWIN to the source code in order to find the
> jni.h, I'd suggest that you instead add a -I flag to the CPPFLAGS. I'm
> a big
> fan of controlling the environment through the makefile instead of
> using
> #ifdef whenever possible.
>
whenever possible... I agree
I do have given a try to
-I/System/Library/Frameworks/JavaVM.framework/Headers/
and it works...
a the condtion to change the linking instructions (see below).
> Regarding 'ant'. There are two possibilities. Either the 'depend' task
> is
> defined in the optional.jar (included in the ant distrib) and you
> don't have
> that in your classpath, or you ant version is too old. In any case, I'd
> recommend that you uppgrade ant. 1.5.1 whas a while ago...
>
Bingo !
the optional.jar was missing !
Now using the ant shipping with JBuilderX (1.5.4)
so the C/pljava/Makefile is now
#-----------------------------------------------------------------------
--
#
# Makefile--
# Makefile for pljava
#
#-----------------------------------------------------------------------
--
NAME := pljava
include $(MODULEROOT)/Makefile.global
ifeq ($(PORTNAME), win32)
DLL_BUILD := 1
else
ifeq ($(PORTNAME), cygwin)
DLL_BUILD := 1
override CPPFLAGS := -DCYGWIN $(CPPFLAGS)
else
ifeq ($(PORTNAME), darwin)
override CPPFLAGS :=
-I/System/Library/Frameworks/JavaVM.framework/Headers/ $(CPPFLAGS)
else
JRE_INCL := $(PORTNAME)
ifeq ($(host_cpu), i686)
JRE_LIB := lib/i386/client
else
JRE_LIB := lib/$(host_cpu)/client
endif
endif
endif
endif
ifdef DLL_BUILD
JRE_INCL := win32
JRE_LIB := bin/client
# This works but is not very nice since it affects all
# DLLTOOL invocations in Makefile.shlib. A custom flag
# is requested from postgres.
#
override DLLTOOL := $(DLLTOOL) --add-stdcall-alias
endif
ifdef USE_GCJ
override CPPFLAGS := -DGCJ $(CPPFLAGS)
SHLIB_LINK = $(BE_DLLLIBS) -lgcj -lwsock32
else
ifeq ($(PORTNAME), darwin)
SHLIB_LINK = $(BE_DLLLIBS) -L. -framework JavaVM
else
override CPPFLAGS := -I$(JDK_HOME)/include
-I$(JDK_HOME)/include/$(JRE_INCL) $(CPPFLAGS)
SHLIB_LINK = $(BE_DLLLIBS) -L. -L$(JDK_HOME)/jre/$(JRE_LIB)
-ljvm
endif
endif
... no changes after that
The change
#ifdef DARWIN
#include <JavaVM/jni.h>
#else
#include <jni.h>
#endif
shoudl not be necessary anymore.
Now everything compiles,
regarding the tests : do you have any more precise instructions to
follow than what is in the README ?
Pascal Pochet
p3consulting at mac.com
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
^ permalink raw reply [nested|flat] 7+ messages in thread
* [Pljava-dev] Problems compiling under Mac OS X
@ 2004-05-18 13:51
parent:
0 siblings, 0 replies; 7+ messages in thread
From: @ 2004-05-18 13:51 UTC (permalink / raw)
What is the setting of your current "dynamic_library_path" configuration option and the LD_LIBRARY_PATH?
The pljava.jar is not the problem. The Oid class is found. The error comes when the Oid class initializer performs a System.loadLibrary("pljava") in order to let the JVM register all JNI methods (it will require to find the libpljava.so although it's loaded already). My guess is that this fails.
The JVM will use the system property "java.library.path" in order to find the libpljava.so. Currently, I'm setting this property to the union of paths defined in the config option "dynamic_library_path" (defined in postgresql.conf) and the environment LD_LIBRARY_PATH. Perhaps this should be done differently using Mac OS X?
In any case, try and set the LD_LIBRARY_PATH seen by your postmaster to include the directory where libpljava.so resides and see if this helps.
- thomas
----- Original Message -----
From: p3consulting
To: Thomas Hallgren
Sent: Tuesday, May 18, 2004 3:18 PM
Subject: Re: [Pljava-dev] Problems compiling under Mac OS X
Latest news:
still have problem make it run even after restarting postmaster with classpath set
In psql
SELECT sqlj.install_jar('samples','file:///Volumes/Data2/download_osx/PostgreSQL/org.postgresql.pljava/bin/examples.jar',true);
outputs
ERROR: Unable to load class org/postgresql/pljava/internal/Oid using CLASSPATH '/Library/Java/Extensions/pljava.jar'
(Path to examples.jar is correct since drag and dropped from Finder, no typo possible)
(Note that trying this twice leads to
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
)
At least classpath is correct and the setup of previous mail works...
In shell
ls -l /Library/Java/Extensions/pljava.jar
outputs
-rw-r--r-- 1 pascal admin 54841 14 May 16:44 /Library/Java/Extensions/pljava.jar
so pljava.jar is there (along with postgresql.jar)
and
ls /usr/local/pgsql/lib/libplj*
outputs
/usr/local/pgsql/lib/libpljava.a /usr/local/pgsql/lib/libpljava.so.1
/usr/local/pgsql/lib/libpljava.so /usr/local/pgsql/lib/libpljava.so.1.0
and in psql
\d sqlj.*
outputs:
Table "sqlj.classpath_entry"
Column | Type | Modifiers
------------+-----------------------+-----------
schemaname | character varying(30) | not null
ordinal | smallint | not null
jarid | integer | not null
Indexes:
"classpath_entry_pkey" primary key, btree (schemaname, ordinal)
Foreign-key constraints:
"$1" FOREIGN KEY (jarid) REFERENCES sqlj.jar_repository(jarid) ON DELETE CASCADE
Index "sqlj.classpath_entry_pkey"
Column | Type
------------+-----------------------
schemaname | character varying(30)
ordinal | smallint
primary key, btree, for table "sqlj.classpath_entry"
Table "sqlj.jar_entry"
Column | Type | Modifiers
------------+------------------------+--------------------------------------------------------------
entryid | integer | not null default nextval('sqlj.jar_entry_entryid_seq'::text)
entryname | character varying(200) | not null
jarid | integer | not null
entryimage | bytea | not null
Indexes:
"jar_entry_pkey" primary key, btree (entryid)
"jar_entry_jarid_key" unique, btree (jarid, entryname)
Foreign-key constraints:
"$1" FOREIGN KEY (jarid) REFERENCES sqlj.jar_repository(jarid) ON DELETE CASCADE
Sequence "sqlj.jar_entry_entryid_seq"
Column | Type
---------------+---------
sequence_name | name
last_value | bigint
increment_by | bigint
max_value | bigint
min_value | bigint
cache_value | bigint
log_cnt | bigint
is_cycled | boolean
is_called | boolean
Index "sqlj.jar_entry_jarid_key"
Column | Type
-----------+------------------------
jarid | integer
entryname | character varying(200)
unique, btree, for table "sqlj.jar_entry"
Index "sqlj.jar_entry_pkey"
Column | Type
---------+---------
entryid | integer
primary key, btree, for table "sqlj.jar_entry"
Table "sqlj.jar_repository"
Column | Type | Modifiers
----------------+------------------------+-----------------------------------------------------------------
jarid | integer | not null default nextval('sqlj.jar_repository_jarid_seq'::text)
jarname | character varying(100) | not null
jarorigin | character varying(500) | not null
deploymentdesc | integer |
Indexes:
"jar_repository_pkey" primary key, btree (jarid)
"jar_repository_jarname_key" unique, btree (jarname)
Foreign-key constraints:
"$1" FOREIGN KEY (deploymentdesc) REFERENCES sqlj.jar_entry(entryid) ON DELETE SET NULL
Sequence "sqlj.jar_repository_jarid_seq"
Column | Type
---------------+---------
sequence_name | name
last_value | bigint
increment_by | bigint
max_value | bigint
min_value | bigint
cache_value | bigint
log_cnt | bigint
is_cycled | boolean
is_called | boolean
Index "sqlj.jar_repository_jarname_key"
Column | Type
---------+------------------------
jarname | character varying(100)
unique, btree, for table "sqlj.jar_repository"
Index "sqlj.jar_repository_pkey"
Column | Type
--------+---------
jarid | integer
primary key, btree, for table "sqlj.jar_repository"
So deploy seems to have done its work.
What info more do you need to help me solve the problem ?
Regards,
Pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20040518/9de47ee8/attachment.html;
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2004-05-18 13:51 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 08:29 [Pljava-dev] Problems compiling under Mac OS X
2004-05-14 10:58 `
2004-05-14 15:02 `
2004-05-14 19:16 `
2004-05-15 10:28 `
2004-05-17 07:52 `
2004-05-18 13:51 `
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox