bugGNU Octave - Bugs: bug #57202, missing bit-compatible...

 
 

bug #57202: missing bit-compatible MSVCR100.dll reports as 'java not found'

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Sun 10 Nov 2019 08:12:06 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 29 Nov 2019 07:43:20 PM UTC, comment #11: 

It's been nearly two weeks since the bug was marked "Ready for Test".  I assume it has been fixed since there has been no response.  Closing report.

Rik <rik5>
Group administrator
Sun 17 Nov 2019 10:42:08 AM UTC, comment #10: 

I pushed a follow-up patch to include the error number in the message in case the formatted text provided by Windows should be too cryptic:
http://hg.savannah.gnu.org/hgweb/octave/rev/847dece1ae10

Markus Mützel <mmuetzel>
Group administrator
Sat 16 Nov 2019 04:08:09 PM UTC, comment #9: 

@Philip, comment #6:  yes, I did read that. the security implications alone are a bit concerning.

@markus: I think so.  at least once it's in the wild we'll see if it makes any of the 'why is my java not working' easier to diagnose.

Nicholas Jankowski <nrjank>
Group Member
Sat 16 Nov 2019 02:36:14 PM UTC, comment #8: 

Oops, wrong link. Here the correct one:
http://hg.savannah.gnu.org/hgweb/octave/rev/6455c82d5180

And another change that makes the error message for "version -java" more verbose:
http://hg.savannah.gnu.org/hgweb/octave/rev/ca48da9ab16c

If invoking Java fails, the error message now reads e.g. "no usable Java Runtime Environment (x86_64) found:" followed by the caught error message (most likely from the "dynamic_library" class).

Is this enough to fix this bug?

Markus Mützel <mmuetzel>
Group administrator
Sat 16 Nov 2019 02:18:39 PM UTC, comment #7: 

I pushed the following change to get the error message from the OS:
http://hg.savannah.gnu.org/hgweb/octave/rev/748aea34aecd

Hopefully, their own phrasing will be more useful.

Markus Mützel <mmuetzel>
Group administrator
Sat 16 Nov 2019 12:26:00 PM UTC, comment #6: 

@Nick, comment #3:
Matlab (at least on Windows) comes with its own JRE, usually some major releases behind on what Oracle currently supplies.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 15 Nov 2019 01:05:29 AM UTC, comment #5: 

Right, it should be possible to improve octave_w32_shlib to test for the existence of the file separately from the call to LoadLibrary, and return a more accurate error message to indicate whether the file is truly not found or whether it could not be loaded for another reason. I think that would help improve the ambiguity of the current error message you get from javaMethod: "could not find library or dependencies". That's the first point.

I agree that javachk should not be extended. Calling it with the feature name "jvm" is the simplest documented method to test for whether Java exists and works or not. It's possible we could add more expressive error messages to that function as well. That's the second point, how to best propagate error messages that are useful for the user who calls "version -java" and "javachk" and wants to know how to diagnose it when Java isn't found.

Mike Miller <mtmiller>
Group Member
Tue 12 Nov 2019 09:30:27 PM UTC, comment #4: 

@nrjank: I was referring to extending the syntax for "javachk" and allow calling it without input arguments.

It's probably a good idea to extent the string returned by "version -java".

I'm not sure whether we can detect that a jre is installed that doesn't match Octave's bit width. Maybe we could insert a "uname ().machine" such that the message would read, e.g.:
"No usable Java Runtime Environment (x86_64) could be found."

It should be possible though to indicate whether the .dll itself is missing, or it cannot be loaded because of a missing dependency - at least on Windows.

Markus Mützel <mmuetzel>
Group administrator
Tue 12 Nov 2019 07:31:38 PM UTC, comment #3: 

Markus, I'm not certain you're was referring to with matlab function syntax. does anyone know what Matlab error would be produced with a similar problem? (I don't have Matlab on an unmanaged system to test)

Mike, that would be better i think.  I guess, based on this and past culprits, is there a way to differentiate between java actually not being installed, the installed java being bitwise incompatible, and/or an underlying dependency problem like i had?

Nicholas Jankowski <nrjank>
Group Member
Tue 12 Nov 2019 07:26:51 PM UTC, comment #2: 

Would this be resolved by simply propagating the error message out of the try-catch in version.m? Is the error message from javaMethod good enough for you? Or is this about getting an even more specific error message than that?

This is the error message on my Debian system with libjvm is missing


>> jversion = javaMethod ("getProperty", "java.lang.System", "java.runtime.version")
error: javaMethod: /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so: failed to load: /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so: cannot open shared object file: No such file or directory


Mike Miller <mtmiller>
Group Member
Mon 11 Nov 2019 09:05:53 AM UTC, comment #1: 

This is likely due to a packaging error in the installer for Java 8 Runtime Environment 64bit. Or something might have been bogged on the affected system.

Nevertheless, would it have helped if the message from "version -java" had been "No usable Java Runtime Environment could be found."?

We could also use distinct error messages for ERROR_DLL_NOT_FOUND and ERROR_MOD_NOT_FOUND in oct-shlib.cc (octave_w32_shlib::octave_w32_shlib) to indicate that is was a dependency that was missing. Unfortunately, I don't think it's possible to tell which missing dependency is the culprit.

I'm somewhat reluctant to extent the syntax of Matlab functions. This has the habit of coming back around on us. But I don't have a strong opinion on syntax extensions, and others might feel differently about it.

Markus Mützel <mmuetzel>
Group administrator
Sun 10 Nov 2019 08:12:06 PM UTC, original submission:  

a recent mailing list discussion [1] describes troubleshooting the apparent inability of Octave to see a java installation.  I'll put a summary below to document the issue for the next person, but the bug report is about whether there's a better way to handle error messaging that might better indicate the error.

Running Windows 10, 64bit, Octave 5.1.0 x64, (both exe and zip install packages), JRE 1.8.0_231

Symptom: unable to run any java functions within Octave despite both Octave and Java being installed and re-installed on the machine, verified both are bit-compatible (both 64bit. bit-mismatch was the cause of most previous reports of this nature.) Verifyied that the proper Java registry keys were present as per [2]. 
On reinstallation, if no Java installed the exe installer properly warned about missing Java, and no warning if it was installed. But no matter what Octave reported:


>> system("java -version")
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
ans = 0

>> version -java
ans = no Java available


Looking inside version to see how it checks for java, I tried running one of the commands manually hoping for a more informative error. I got:


>>  jname = javaMethod ("getProperty", "java.lang.System", "java.vm.name");

error: javaMethod: could not find library or dependencies: C:\Program Files\Java\jre1.8.0_231\bin\server\jvm.dll


JVM.dll was present, and Octave was able to see and navigate to it. It was suggested the error might be with a dependency as it said.  Running Dependency Walker [3] on jvm.dll, a series of dependency missing reports popped up. Ignoring the ones under /windows/system32 (kernel32, user32, advapi32, wsock32, winmm, version, psapi), the last one missing was MSCVR100.dll  (MS Virtual C++ Redistributable 10.0 (2010)). 

Looking under Control Panel / Apps - I saw that MSVCR 2010 was installed, but only x86 (32bit version).  I downloaded the latest version of both the x86 and x64 bit versions from [4] and [5], uninstalled the one that was there, reinstalled both x86 and x64 versions, and suddenly java in octave worked (no reboot required)

both exe and zip installed copies on the PC produced

>> version -java
ans = Java 1.8.0_231-b11 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode


So, is there a better way to somehow handle the error messaging for 'version -java'?  is there a more informative response something like javachk (without arguments) could give? Something to the effect of 'yes we see java, no we can't open it for some reason'?

(I'm also looking to see if JRE installer is supposed to flag/fix missing MSVCR100.dll, and maybe file a java bug report, but haven't yet found what they expect to be normal behavior there. pointers welcome)


[1] https://octave.1599824.n4.nabble.com/JRE-not-found-windows-tp4694512.html
[2] https://octave.org/doc/interpreter/Set-up-the-JVM.html
[3] http://www.dependencywalker.com/
[4] https://www.microsoft.com/en-pk/download/details.aspx?id=8328
[5] https://www.microsoft.com/en-us/download/details.aspx?id=13523

Nicholas Jankowski <nrjank>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by svillemot
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by nrjank (Submitted the item)
  • -email is unavailable- added by nrjank
  • -email is unavailable- added by nrjank
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-20 svillemot Carbon-Copy- Added svillemot
    2019-11-29 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-11-16 mmuetzel StatusNeed Info Ready For Test
        Release5.1.0 dev
    2019-11-12 mtmiller StatusNone Need Info
    2019-11-10 nrjank Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code