[Pljava-dev] Problems compiling under Mac OS X

From: thhal at mailblocks(dot)com (Thomas Hallgren)
To:
Subject: [Pljava-dev] Problems compiling under Mac OS X
Date: 2004-05-17 07:52:39
Message-ID: thhal-0hAeEAf3vZRI/daKKKd9OcxS16YTZ1+@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Thomas Hallgren 2004-05-18 13:51:46 [Pljava-dev] Problems compiling under Mac OS X
Previous Message Thomas Hallgren 2004-05-15 10:28:37 [Pljava-dev] Problems compiling under Mac OS X