[gdal-dev] Building for Java on MacOS

David Rush david.rush at wyo.gov
Mon Apr 27 12:56:45 PDT 2020


Alright, since jni_md.h was referenced from jni.h, I tried copying jni_md.h
into the same directory as jni.h, which seems to have helped.  Or at least
got to the next error:

gnm_wrap.cpp:471:21: warning: unused function 'SWIG_JavaArrayOutDouble'
[-Wunused-function]
static jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result,
jsize sz);
                    ^
94 warnings generated.
/bin/sh /Users/david/w/gdal/gdal-3.0.4/libtool --mode=link --silent g++
-std=c++11 -dynamiclib -single_module -flat_namespace -undefined suppress
gdalconst_wrap.lo gdal_wrap.lo osr_wrap.lo ogr_wrap.lo gnm_wrap.lo
 /Users/david/w/gdal/gdal-3.0.4/libgdal.la -o libgdalalljni.la -rpath
/usr/local/lib -no-undefined -version-info 26:4:0
libtool:   error: cannot find the library '/Users/david/w/gdal/gdal-3.0.4/
libgdal.la' or unhandled argument '/Users/david/w/gdal/gdal-3.0.4/libgdal.la
'
make: *** [libgdalalljni.la] Error 1

Indeed gdal-3.0.4/libgdal.la isn't there.  How do I get it?

David

On Mon, Apr 27, 2020 at 1:26 PM David Rush <david.rush at wyo.gov> wrote:

> Andrew:
>
> That's what I thought.  I do have the JDK (OpenJDK 11.0.2).
>
> Ah, found it.  I think I may have both a JRE and JVM confusing things
> (confusing me, at least).  Both appear to be the same version, at least.
>
> I've changed my JAVA_HOME in java.opt to reflect where my JDK is
> installed.  Also had to change the JAVA_INCLUDE in java.opt because jni.h
> is under $JAVA_HOME/include rather than $JAVA_HOME/Headers.
>
> Then it couldn't find "jni_md.h" (machine dependent things, apparently).
> I found it in my JDK installation, and copied it to the current directory
> (gdal/swig/java), but it still can't seem to find it:
>
> In file included from gdalconst_wrap.c:154:
> /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/include/jni.h:45:10:
> fatal error: 'jni_md.h' file not found
> #include "jni_md.h"
>
> Since the include is in quotes, it should be looking in the current
> directory for it, right?  The gdalconst_wrap.c file is in the current
> directory, so I'm in the right place.
>
> Suggestions?
>
> David
>
> On Mon, Apr 27, 2020 at 11:52 AM Andrew C Aitchison <
> andrew at aitchison.me.uk> wrote:
>
>> On Mon, 27 Apr 2020, David Rush wrote:
>>
>> > Ivan:
>> >
>> > Thanks!  That worked.  On to the next error (with make in
>> gdal/swig/java)
>> > ...
>> >
>> > gdalconst_wrap.c:154:10: fatal error: 'jni.h' file not found
>> > #include <jni.h>
>> >         ^~~~~~~
>> > 1 error generated.
>> > make: *** [gdalconst_wrap.lo] Error 1
>> >
>> > Where *should* jni.h come from?  I can't find it anywhere in my Java
>> > installation.
>>
>> I believe it should be in the JDK (Java Development Kit)
>> - do you just have the JRE or Java Runtime Environment ?
>>
>> --
>> Andrew C. Aitchison                                     Kendal, UK
>>                         andrew at aitchison.me.uk
>>
>

-- 

E-Mail to and from me, in connection with the transaction 
of public 
business, is subject to the Wyoming Public Records 
Act and may be 
disclosed to third parties.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200427/256664f6/attachment.html>


More information about the gdal-dev mailing list