[Mono-dev] Embedded mono - cross compile on cygwin and linux

Matthias D. matthi.d at googlemail.com
Mon Jun 4 14:46:31 UTC 2012


Hello,

Thank you for your fast reply.

1.
In my scenario I'm not quite sure how to do "make check" in a cross compile
scenario, there is no general solution to execute the compiled code (it
should be possible on cygwin however)... I could be wrong though
when I run "make check" in "build-cross-windows" i get

MONO_PATH=/usr/src/mono-master/mono/mcs/class/lib/net_4_5
../../runtime/mono-wrapper
/usr/src/mono-master/mono/mcs/class/lib/build/mcs.exe -unsafe
-nowarn:0162-out:TestDriver.dll -target:library
../../../mono/mini/TestDriver.cs
/usr/src/mono-master/mono/build-cross-windows/mono/mini/mono.exe: error
while loading shared libraries: ?: cannot open shared object file: No such
file or directory
Makefile:4991: recipe for target `TestDriver.dll' failed

Or did you mean other unit tests?

2.
I do use the function (mono_method_get_unmanaged_thunk) myself from
unmanaged code. I did attach the important files in my last email. The
biggest part is from the documentation on
http://www.mono-project.com/Embedding_Mono
and http://www.mono-project.com/Interop_with_Native_Libraries.
Is there anything special I should post here?

3.
On my current working copy I did (for testing purposes) the following:
I did changed usages of the function pointer from
mono_method_get_unmanaged_thunk to a call to mono_runtime_invoke
I thought this should work or at least provide a better stack trace. Here
is what i got:
#0  0x00000000 in ?? ()
#1  0x06552756 in ?? ()
#2  0x065525d0 in ?? ()
#3  0x06552518 in ?? ()
#4  0x065524a0 in ?? ()
#5  0x0655229a in ?? ()
#6  0x06551fff in ?? ()
#7  0x06551824 in ?? ()
#8  0x06551993 in ?? ()
#9  0x004a6b25 in mono_jit_runtime_invoke (method=0x4e4a6b0, obj=0x0,
    params=0x28fb50, exc=0x28fb58) at ../../../mono/mini/mini.c:5891
#10 0x0049380e in mono_runtime_invoke (method=0x4e4a6b0, obj=0x0,
    params=0x28fb50, exc=0x28fb58) at ../../../mono/metadata/object.c:2808
#11 0x0041c636 in MonoLoader::getInput (this=0x4d8e6a8, bothandle=0x6961ee0,
    status=...) at /usr/src/blobby/src/MonoLoader.cpp:164
... other code

This ?probably? is another error, as this error happens much later (when
the code has been running quite a while). Attached the changed code.


Note: I'm still trying to get this reproduced on a smaller program, but I
did not manage it jet :(.
Note also: These errors also happen in the (stable) 2.11.1 tarball. I will
always test master and 2.11.1 tarball. Did your mentioned changes are also
in there?
And: I'm not using managed classes for interop, only structs as far as i
can see? But maybe I'm missing something here.

Is your recommendation to switch to an older version?

Matthias

On Mon, Jun 4, 2012 at 2:43 PM, Robert Jordan <robertj at gmx.net> wrote:

> On 04.06.2012 13:42, Matthias D. wrote:
>
>> Hello,
>>
>> after some further digging I'm quite sure this SIGSEGV and SIGILL happens
>> on a function pointer created by mono_method_get_unmanaged_**thunk.
>> This method looks really really scarry to me
>> (mono_marshal_get_thunk_**invoke_wrapper)!
>>
>
> Since only mono's runtime tests are using this function, I guess that
> the thunk related unit tests are failing, right?
>
> If you're using the function yourself, you should post a sample.
>
> There was a change on trunk related to the struct layout of managed
> classes that might affect mono_method_get_unmanaged_**thunk consumers.
>
> Robert
>
> ______________________________**_________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.**com <Mono-devel-list at lists.ximian.com>
> http://lists.ximian.com/**mailman/listinfo/mono-devel-**list<http://lists.ximian.com/mailman/listinfo/mono-devel-list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120604/decee6ae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonoLoader.h
Type: text/x-chdr
Size: 3492 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120604/decee6ae/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonoLoader.cpp
Type: text/x-c++src
Size: 6203 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120604/decee6ae/attachment.cpp>


More information about the Mono-devel-list mailing list