patchGNU Octave - Patches: patch #9439, Fix Java >1.8 on Mac

 
 

patch #9439: Fix Java >1.8 on Mac

Submitted by:  None
Submitted on:  Sun 20 Aug 2017 11:54:33 AM UTC  
 
Category: Core : otherPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Ben Abbott <bpabbott>Originator Email: -unavailable-
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Wed 17 Jan 2018 05:52:48 AM UTC, comment #34:

Per Ben Abbott's request, I can verify this works with Java 9 on High Sierra for me also. See the output below.

octave:3> javaclasspath
STATIC JAVA PATH

- empty -

DYNAMIC JAVA PATH

- empty -

octave:4> class = 'java.lang.String';
octave:5> text = 'hello';
octave:6> strObj = javaObject(class, text);
octave:7> whos
Variables in the current scope:

Attr Name Size Bytes Class
==== ==== ==== ===== =====
ans 1x1 8 double
class 1x16 16 char
strObj 1x1 0 java.lang.String
text 1x5 5 char

Total is 23 elements using 29 bytes

John Swensen <jpswensen>
Sun 14 Jan 2018 03:42:13 PM UTC, comment #33:

Pushed the change

http://hg.savannah.gnu.org/hgweb/octave/rev/6c3b7ca0cb90

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 13 Jan 2018 04:11:47 PM UTC, comment #32:

Essentially, the JAVA_CPPFLAGS are the same as for linux, with "linux" replaced by "darwin". As with Linux, JAVA_LIBS is empty, and there are no changes to LDFLAGS.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 13 Jan 2018 10:59:55 AM UTC, comment #31:

Yes, file #42899 works for me (I tested my favourite example from here http://wiki.octave.org/Cookbook#Load_XML_files). I did not have the time to look at the changes in the patch. What did you do? Just cleaning up the path? Thanks!

Sebastian <sschoeps>
Sat 13 Jan 2018 05:55:45 AM UTC, comment #30:

@Sebastian,

I'm attaching a changeset that works for me. Please confirm it works for you as well. This is essentially you patch with the include paths trimmed down.

(file #42899)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 13 Jan 2018 03:05:44 AM UTC, comment #29:

@Sebastian

I uninstalled /Library/Java/JavaVirtualMachines/1.6.0.jdk and although Octave still configures with Java Support, I also encounter the dialog you attached (file #42887).

I then used (file #42102) and Octave configured with Java support, and ran without the dialog showing up.

I'd hoped to use the Oracle approach to select the Java version, and would prefer to allow Octave to configure without specifying a lot of detail.

I'll tinker a bit more, but expect to push a changeset soon.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Fri 12 Jan 2018 02:31:02 AM UTC, comment #28:

The -source and -target options are correct (so that bytecode is compiled in a backwards compatible way) and the Note diagnostics printed are the same on GNU/Linux with Java 8. These are warnings that have showed up since the -source and -target were updated to 1.6 that haven't been addressed in the Java source code yet.

Mike Miller <mtmiller>
Project Administrator
Fri 12 Jan 2018 01:57:03 AM UTC, comment #27:

@Sebastian

I just noticed the following while building Octave.

The "-source 1.6 -target 1.6" looks to indicate v1.6 of JavaVM is being used. I don't know what to think about the "Note"s.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Thu 11 Jan 2018 02:34:56 PM UTC, comment #26:

@Sebastian

My configure finds ...

Does your configure report the same?

I'd thought it was easy to switch between java versions, even if multiple versions are installed.

https://wimdeblauwe.wordpress.com/2014/03/20/switching-easily-between-java-jdks-on-mac-os-x/

I have 1.6, 1.8, and 9 installed, and have JAVA_HOME pointing to 9.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Thu 11 Jan 2018 12:48:57 PM UTC, comment #25:

@Ben:

your patch does work in the sense that I can compile octave with Java. However, on start, I have to install the old and outdated Java SE6 framework from Apple. We should avoid this as Java SE6 is not maintained anymore and probably one big security issue. Screenshot attached.

(file #42887)

Sebastian <sschoeps>
Wed 10 Jan 2018 02:15:41 PM UTC, comment #24:

@Sebastian,

I spent more time looking at configure.ac, and found that if darwin is treated like linux, but with the Framework added, Java works. Below is the snippet from configure.ac.
I'm attaching a new patch (octave_devel_mac_java8.patch).

(file #42883)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Tue 21 Nov 2017 07:57:27 AM UTC, comment #23:

@Ben:

if you do not care about the gui, then you do not need the extra steps explained in my blog post. Installing homebrew and then "brew install octave --with-java" is enough (please contact me if you need help to install homebrew somewhere else then /usr/local/).

Sebastian <sschoeps>
Tue 21 Nov 2017 01:08:47 AM UTC, comment #22:

@Sebastian,

To try the default branch using home-brew, do I follow the instructions at the link below?

http://www.schoeps.org/home/2017/10/octave-on-macos-with-gui/

Regarding including "Wl,-framework,JavaVM"" in JAVA_LIBS, the framework would be removed from LDFLAGS.

Ben

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Mon 20 Nov 2017 09:31:09 PM UTC, comment #21:

@Ben: maybe you could install homebrew to see if that works for you?

>The text below is from you configure log attached to comment #11.


> Java home:
>/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
> Java JVM path:
>/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server
> Java CPPFLAGS:
>-I/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/include
>-I/System/Library/Frameworks/JavaVM.framework/Home/include
>-I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers
>-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
> Java libraries:
>
>After installing Java, I do not see a "Home" directory in
>"/System/Library/Frameworks/JavaVM.framework/". I don't expect including a
>non-existent directory will break anything, but either our Java installs have
>produced different results, or the patch should be cleaned up. Would you
>verify this directory exists for you (I'm running macOS High Sierra -
>10.13.1).


I agree, some of the includes are superfluous. They are hardcoded in configure.ac.
I did not change them because older macOS systems might still install stuff there.
Probably it's ok to erase them. I do not have "/System/Library/Frameworks/JavaVM.framework/Home" nor "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/". However, "/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/" is a match.

>Also, shouldn't the Java framework (i.e. "-Wl,-framework,JavaVM") be specified
>in "Java libraries"?


Sorry don't know. I do not seem to need it.

Sebastian

Sebastian <sschoeps>
Mon 20 Nov 2017 09:18:30 PM UTC, comment #20:

@Sebastian

I also do not have have a CurrentJDK directory which I see in your config.log, i.e. "-I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" directory.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Mon 20 Nov 2017 08:56:37 PM UTC, comment #19:

@Sebastian

Also there is a difference in the JAVA_CPPFLAGS for Linux and Darwin. For Linux ...

Should Darwin's also include the "darwin" directory in ${JAVA_HOME}/include? i.e.

Ben

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Mon 20 Nov 2017 08:45:21 PM UTC, comment #18:

@Sebastian

I'm still not able to get Java working, but have some comments/questions about the proposed patch.

The text below is from you configure log attached to comment #11.

After installing Java, I do not see a "Home" directory in "/System/Library/Frameworks/JavaVM.framework/". I don't expect including a non-existent directory will break anything, but either our Java installs have produced different results, or the patch should be cleaned up. Would you verify this directory exists for you (I'm running macOS High Sierra - 10.13.1).

Also, shouldn't the Java framework (i.e. "-Wl,-framework,JavaVM") be specified in "Java libraries"?

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 14 Oct 2017 03:14:56 PM UTC, comment #17:

ugh! When I tried to confirm by bootstrap -> configure -> make -> ./run-octave -> foo = javaclasspath() the SEGV is still present.

Its likely I forgot the bootstrap while debugging.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 14 Oct 2017 12:26:20 PM UTC, comment #16:

So you can confirm that Java works for you on Mac OS with this patch? If yes, then Mike could push it, right?

Bye
Sebastian

Sebastian <sschoeps>
Sat 14 Oct 2017 12:21:33 PM UTC, comment #15:

Clarification, I no longer get the "AddressSanitizer: SEGV on unknown address" error when using Qt4 on macOS when the address sanitizer is disabled.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 14 Oct 2017 12:20:26 PM UTC, comment #14:

Opps. After checking again the ASAN_OPTIONS change to run-octave.in does not have any effect. I must have inadvertently bungled my period test.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Fri 13 Oct 2017 07:34:00 PM UTC, comment #13:

I adjusted the patch and am now able to run the GUI using qt4 on macOS.

The trick was to set and export ASAN_OPTIONS to an empty string when the address sanitizer wasn't being used.

(file #42139)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Tue 10 Oct 2017 01:27:11 PM UTC, comment #12:

Ok. Thanks. I don't think I'm doing anything to introduce the address sanitizer.

From the summary, it looks to me as if my Qt4 was compiled with the AddressSanitizer enabled.

I'll ask the Fink support team if this is the case, and if it can be disabled.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Tue 10 Oct 2017 07:18:29 AM UTC, comment #11:

@Ben: I can compile and run octave-devel with clang ("Apple LLVM version 9.0.0 (clang-900.0.37)") on High Sierra and the patch attached (actually I also apply the gui patch from https://savannah.gnu.org/bugs/?50025). I use Apple's BLAS (therefore one needs the library "veclibfort")

This is my configure string

./configure --prefix=/usr/local/octave/ --disable-dependency-tracking --disable-silent-rules --enable-link-all-dependencies --enable-shared --disable-static --disable-docs --without-OSMesa --with-hdf5-includedir=/usr/local/opt/hdf5/include --with-hdf5-libdir=/usr/local/opt/hdf5/lib --with-x=no --with-blas=-L/usr/local/opt/veclibfort/lib -lvecLibFort --with-portaudio --with-sndfile

Some version numbers of dependencies: arpack 3.5.0, fftw 3.3.6, java 9+181, qhull 2015.2, qrupdate 1.1.2, qscintilla2 2.10.1, qt 5.9.1, suite-sparse 4.5.5, sundials 2.7.0. Find the configure report attached.

Then, without crash...

>> javaclasspath

STATIC JAVA PATH

- empty -

DYNAMIC JAVA PATH

- empty -

(file #42108)

Sebastian <sschoeps>
Mon 09 Oct 2017 08:36:43 PM UTC, comment #10:

@Sebastian,

I still encounter the address sanitizer error and crash (seg-fault). I don't see where I've enabled that setting. Has Apple made that a default that In need to disable?

Or maybe Fink has it turned on for one of the dependencies?

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Mon 09 Oct 2017 06:16:52 PM UTC, comment #9:

@Ben: it seems that I need the includes defined in JAVA_CPPFLAGS (-I/System/Library/Framework/...). Then Java 9 works for me. See patch below.

(file #42102)

Sebastian <sschoeps>
Mon 09 Oct 2017 04:17:20 PM UTC, comment #8:

Absolutely, works here with Java 8 perfectly. There are some small Java library differences causing some test failures with Java 9, but works other than that.

AFAICT bug #52061 only happens when AddressSanitizer is enabled. Without it everything is fine (at least doesn't crash).

Mike Miller <mtmiller>
Project Administrator
Mon 09 Oct 2017 03:10:00 PM UTC, comment #7:

Mike

I can't tell from bug #52061, does Java work on any version of Linux using Java 8 or 9?

Since Java 8, it looks to me as if using JDK for macOS is similar to linux. If you or someone else can confirm Java 8 or 9 works and what options you've used, I expect I can get the same to work on macOS.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sun 08 Oct 2017 11:22:13 PM UTC, comment #6:

I'm happy to review and apply the revised patch once someone is able to demonstrate that Java can work.

Mike Miller <mtmiller>
Project Administrator
Sun 08 Oct 2017 07:20:14 PM UTC, comment #5:

The seg-fault I'm seeing may have the same underlying cause as the same/similar problem seen on Linux

https://savannah.gnu.org/bugs/?52061

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sun 08 Oct 2017 07:18:12 PM UTC, comment #4:

I'm attaching an updated patch with context, that works for me for Java 9 on macOS 10.13 (High Sierra). By "works for me", I mean Octave builds. Unfortunately, a seg-fault occurs if Java is used by Octave.

In any event, if someone can verify this patch works for Sierra and Java 8, then perhaps it should be pushed.

(file #42096)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sun 20 Aug 2017 06:12:46 PM UTC, comment #3:

ok, version 2 of the patch does change "scripts/java/module.mk" anymore.

(file #41593)

Sebastian <sschoeps>
Sun 20 Aug 2017 05:29:08 PM UTC, comment #2:

See bug #51803 for dropping support for Java 1.3.

Mike Miller <mtmiller>
Project Administrator
Sun 20 Aug 2017 04:48:12 PM UTC, comment #1:

I can confirm that Java 9 no longer allows building with -source 1.3 -target 1.3. I think that should be fixed separately, this is not a macOS issue.

Mike Miller <mtmiller>
Project Administrator
Sun 20 Aug 2017 11:54:33 AM UTC, original submission:

jwe proposed to unify Java handling in https://lists.gnu.org/archive/html/octave-maintainers/2016-05/msg00151.html. The attached patch (for devel) works and gets rid of an unintended Java 1.6 requirement caused by including "-framework JavaVM". Additionall, "-source 1.3 -target 1.3" in "scripts/java/module.mk" is dropped as it will not work with Java 1.9 anymore (minimum is 1.6).

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #42899:  changeset.patch added by bpabbott (3KiB - application/octet-stream)
file #42887:  screenshot.png added by sschoeps (49KiB - image/png - dialog asking for Java SE6 (sorry in German))
file #42883:  octave_devel_mac_java8.patch added by bpabbott (3KiB - application/octet-stream)
file #42139:  octave_devel_mac_java6.patch added by bpabbott (3KiB - application/octet-stream)
file #42108:  configure.txt added by sschoeps (8KiB - text/plain)
file #42102:  octave_devel_mac_java5.patch added by sschoeps (2KiB - application/octet-stream)
file #42096:  octave_devel_mac_java4.patch added by bpabbott (2KiB - application/octet-stream)
file #41593:  octave_devel_mac_java2.patch added by sschoeps (2KiB - application/octet-stream)
file #41586:  octave_devel_mac_java.patch added by None (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jpswensen (Posted a comment)
  • -unavailable- added by bpabbott (Updated the item)
  • -unavailable- added by sschoeps (Updated the item)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 14 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 17 Jan 2018 02:59:23 PM UTCbpabbottStatusReady For Test=>Done
      Open/ClosedOpen=>Closed
    Sun 14 Jan 2018 03:42:13 PM UTCbpabbottStatusIn Progress=>Ready For Test
    Sat 13 Jan 2018 06:54:56 PM UTCbpabbottStatusNone=>In Progress
      Assigned toNone=>bpabbott
    Sat 13 Jan 2018 05:55:45 AM UTCbpabbottAttached File-=>Added changeset.patch, #42899
    Thu 11 Jan 2018 12:48:57 PM UTCsschoepsAttached File-=>Added screenshot.png, #42887
    Wed 10 Jan 2018 02:15:41 PM UTCbpabbottAttached File-=>Added octave_devel_mac_java8.patch, #42883
    Fri 13 Oct 2017 07:34:00 PM UTCbpabbottAttached File-=>Added octave_devel_mac_java6.patch, #42139
    Tue 10 Oct 2017 07:18:29 AM UTCsschoepsAttached File-=>Added configure.txt, #42108
    Mon 09 Oct 2017 06:16:52 PM UTCsschoepsAttached File-=>Added octave_devel_mac_java5.patch, #42102
    Sun 08 Oct 2017 07:18:12 PM UTCbpabbottAttached File-=>Added octave_devel_mac_java4.patch, #42096
    Sun 20 Aug 2017 06:12:46 PM UTCsschoepsAttached File-=>Added octave_devel_mac_java2.patch, #41593
    Sun 20 Aug 2017 11:54:33 AM UTCNoneAttached File-=>Added octave_devel_mac_java.patch, #41586

    Back to the top


    Powered by Savane 3.1-cleanup1