octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Success: core Java support in MXE build


From: PhilipNienhuis
Subject: Success: core Java support in MXE build
Date: Thu, 11 Jul 2013 09:15:22 -0700 (PDT)

Michael Goffioul wrote
> On Wed, Jul 3, 2013 at 5:55 PM, PhilipNienhuis <

> pr.nienhuis@

> >wrote:
> 
>> John W. Eaton wrote
>> > On 07/03/2013 03:51 PM, PhilipNienhuis wrote:
>> >> John W. Eaton wrote
>> >  >>
>> >>> I think the right thing to do is to not check for the JVM.  We just
>> need
>> >>> enough "java" to be able to compile.  I think that's really just
>> jni.h.
> <snip>
>> >>>    We load the JVM at run time, so that's when Octave should be
>> checking
>> >>> for it and complaining if it doesn't exist.
> <snip>
> Alternatively, we could download them from:
> http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/raw-file/tip/src/share/javavm/export/jni.h
> http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/raw-file/tip/src/windows/javavm/export/jni_md.h
> 
> The last change on these files is from 3 years ago, so they don't change
> much :)
> 
> AFAIK, these are the only thing that you need to compile java support are
> those 2 headers.

A few days ago I succeeded both with building Octave with built-in java
support on MinGW and cross-compiling it (MXE) on my Linux box.
Cross-compiling is as follows: (beware it's a bit of a kludge just meant as
a proof-of-concept)


1. Patch configure.ac to add "-Wl,--export-all-symbols" to the load flags in
the mingw section (bug# 39454). This is required for any mingw Octave build.
(There's some discussion whether this is the best fix - for including core
Java support it is OK but other MinGW packages may need another place for
this fix.)


2. Make sure the platform-dependent jni_md.h can be found.
## Kludge warning: 
## I copied <Windows><jdk>/include/win32/ subdir + contents over to my
##   Linux <jdk>/include subdir.
## I also did a "touch jvm.dll" somewhere (actually in 
##   <Linux_JDK>/jre/lib/i386/client) to comfort configure that
##   complained it couldn't find jvm.dll.
##   (I think this is a bug in configure)
Add the following in <mxe-octave>/src/octave.mk in the configure section:
--with-java-includedir=</full/path/to/linux/jdk>   ## Omit include/ subdir
in this path!
--with-java-libdir=</full/path/to/some/place/with/dummy/jvm.dll>
(maybe on MingW/native build:)
--with-java-homedir=</full/path/to/jdk>     ## Not sure if this is needed


(3. If you want the latest dev version, build a "make all dist"
octave-<version>.tar.gz, copy it over to <mxe-octave>/pkg, do "openssl sha1
octave-<version>.tar.gz" and substitute the checksum in
<mxe-octave>/src/octave.mk)


4. Run ./mk-dist <options>
When cross-compiling on Linux Octave's configure will probably find the
javac and jar executables from the build platform.
When building on MinGW, JAVA_HOME should be set properly.


Things to improve:

A. Find out if we could just dld/copy the contents of <jdk>/include &
<jdk>/include/win32, or download them from theURLs Michael gave above, and
point --with-java-includedir=  to it.

B. Fix configure / configure.ac so that it doesn't try to find jvm.dll for
MinGW builds, so that the dummy jvm.dll can be avoided. I'll enter a bug
report for this.


So to have java support built-in with mxe-octave for a Windows Octave
binary, I conclude the following tools and files are needed:

- A Java JDK. Or more precise, javac and jar executables + their possible
implicit dependencies. 

- jni.h + win32/jni_md.h

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Java-support-in-MXE-build-tp4652996p4655522.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]