madewokherd/wine-mono

KeePass Plugins cannot be loaded

Opened this issue · 5 comments

Whereas they work with mono complete, plugins cannot be loaded because according to different sources the easiest way to make plugins work is installing mono-complete and wine-mono-5.1.1 seems not equal to mono-complete ! ...

01

[0000000000000114:] EXCEPTION handling: System.DllNotFoundException: libc assembly:<unknown assembly> type:<unknown type> member:(null)

"<unnamed thread>" tid=0000000000000114 this=0000000002AD0130 , thread handle : 00000000002291C0, state : not waiting
  at (wrapper managed-to-native) Mono.CSharp.UnixUtils._isatty (int) [0x00000] in <07fb74b071d740b2b717e1913a9c9a42>:0
  at Mono.CSharp.UnixUtils.isatty (int) [0x00000] in <07fb74b071d740b2b717e1913a9c9a42>:0
  at Mono.CSharp.ConsoleReportPrinter..cctor () [0x00066] in <07fb74b071d740b2b717e1913a9c9a42>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0002a] in <3fb22c323aff493faff06427607e4b25>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_generic_class_init (intptr) [0x00000] in <3fb22c323aff493faff06427607e4b25>:0
  at Mono.CSharp.Driver.Main (string[]) [0x0003b] in <07fb74b071d740b2b717e1913a9c9a42>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x0002a] in <07fb74b071d740b2b717e1913a9c9a42>:0

This exception occurs in an mcs process, apparently keepass is trying to compile C# code to create a .dll for the plugin. It seems we are missing this "isatty" function or we should be using a codepath that doesn't require it.

This is the code that's failing: https://github.com/mono/mono/blob/master/mcs/mcs/support.cs#L206

We do have an "isatty" function in Wine's libc (well, msvcrt), I'm not sure why it isn't found in this case.

Well, this was a hassle to find the actual error messages but:

[0000000000000110: 0.00062 1] LEAVE:c Mono.CSharp.AbstractMessage:get_Text ()([STRING:0000000001109C68:Metadata file `System.dll' could not be found]

They seem to be invoking mcs.exe directly from within wine-mono, which probably means they are using Microsoft.CSharp.CSharpCodeGenerator.

So the question is, why can't mcs.exe find libraries to link to when invoked from within a wine-mono install?

OK, so the issue is in how we package wine-mono.

Normally, lib/mono/4.5 contains symlinks to the libraries in lib/mono/gac. We aren't able to package symlinks properly, so we remove these to not waste space. It seems mcs searches this directory for libraries to link to by default.

I can work around this with cp -n lib/mono/4.0-api/* lib/mono/4.5. (I also have a work-around for the isatty error which may be required.)

We still don't want to put the real libraries there, but as a packaging step we may copy the reference assemblies from 4.8-api.

Fixes pushed to master branch:
771613a
madewokherd/mono@c32e952

Expect this in the next wine-mono release. For now, you should be able to work around this by copying .dll files as explained in my previous comment (the -n switch is important, we don't want to overwrite anything already in lib/4.5), and editing etc/mono/config.