[Mono-dev] Crosscompiling Mono 5.0.0.100

Bernhard Urban beurba at microsoft.com
Fri May 26 14:22:40 UTC 2017


Hi Angelo,

here's the proper fix: https://github.com/mono/mono/pull/4926/files


-Bernhard
________________________________________
From: Mono-devel-list <mono-devel-list-bounces at lists.dot.net> on behalf of Bernhard Urban via Mono-devel-list <mono-devel-list at lists.dot.net>
Sent: Wednesday, May 24, 2017 11:56:32 PM
To: Angelo Compagnucci
Cc: Mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Crosscompiling Mono 5.0.0.100

Hello Angelo,

the culprit is this instruction "mrc p15, 0, <Rd>, c13, c0, 3" that we use to obtain some TLS related value. Apparently,  ARM926EJ-S doesn't implement opcode 3 for this coprocessor [1] (look at [2] for some nice overview), and also isn't required to per specification. Vlad is working on a fix. For what it's worth, your workaround is fine in your usecase.

Thanks for the report!
-Bernhard


[1] https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Finfocenter.arm.com%2Fhelp%2Findex.jsp%3Ftopic%3D%2Fcom.arm.doc.ddi0198e%2FI1002240.html&data=02%7C01%7Cbeurba%40microsoft.com%7Ceeee8c40aafc4201dbad08d4a2efc4c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636312598096067089&sdata=4QWLx9QSfiK301InH8WA1%2F6JY9FUMmQ4tayvOYvyHA8%3D&reserved=0
[2] https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fiphonedevwiki.net%2Findex.php%2FCoprocessors&data=02%7C01%7Cbeurba%40microsoft.com%7Ceeee8c40aafc4201dbad08d4a2efc4c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636312598096067089&sdata=UnoCzsowRgj30DiUiiP%2BfXagTXDd0DUfrUCKeyb8dqg%3D&reserved=0
________________________________________
From: Angelo Compagnucci <angelo.compagnucci at gmail.com>
Sent: Wednesday, May 24, 2017 9:26:07 AM
To: Bernhard Urban
Cc: Mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Crosscompiling Mono 5.0.0.100

Dear Bernhard,

2017-05-24 7:19 GMT+02:00 Angelo Compagnucci <angelo.compagnucci at gmail.com>:
> Dear Bernhard,
>
> 2017-05-23 23:17 GMT+02:00 Bernhard Urban <beurba at microsoft.com>:
>> alas that isn't useful :(  for some reason the system fails somewhere in libc.
>>
>> can you do `thread apply all bt` in gdb? ideally, you pass `-O0 -g` as CFLAGS so you'll get proper line numbers.
>
> Sorry, should have of this before ...
>
> Here it is a complete dump from gdb:
>
> Debug info from gdb:
>
> [New LWP 122]
> [New LWP 123]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/libthread_db.so.1".
> 0xb6e7e268 in waitpid () from /lib/libpthread.so.0
>   Id   Target Id         Frame
> * 1    Thread 0xb6f75000 (LWP 121) "mono" 0xb6e7e268 in waitpid ()
> from /lib/libpthread.so.0
>   2    Thread 0xb67ff440 (LWP 122) "SGen worker" 0xb6e797e8 in
> pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
>   3    Thread 0xb52a8440 (LWP 123) "Finalizer" 0xb6e7bd18 in
> do_futex_wait () from /lib/libpthread.so.0
>
> Thread 3 (Thread 0xb52a8440 (LWP 123)):
> #0  0xb6e7bd18 in do_futex_wait () from /lib/libpthread.so.0
> #1  0xb6e7bde0 in sem_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
> #2  0x002b0d48 in mono_os_sem_wait (sem=0x4b9d98 <finalizer_sem>,
> flags=MONO_SEM_FLAGS_ALERTABLE) at
> ../../mono/utils/mono-os-semaphore.h:209
> #3  0x002b131c in mono_coop_sem_wait (sem=0x4b9d98 <finalizer_sem>,
> flags=MONO_SEM_FLAGS_ALERTABLE) at
> ../../mono/utils/mono-coop-semaphore.h:40
> #4  0x002b3684 in finalizer_thread (unused=0x0) at gc.c:907
> #5  0x0026d004 in start_wrapper_internal (start_info=0x0,
> stack_ptr=0xb52a7e04) at threads.c:837
> #6  0x0026d188 in start_wrapper (data=0x50a948) at threads.c:889
> #7  0x003c8ab4 in inner_start_thread (data=0x50a978) at mono-threads.c:1170
> #8  0xb6e743f4 in start_thread () from /lib/libpthread.so.0
> #9  0xb6dd6f18 in ?? () from /lib/libc.so.6
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>
> Thread 2 (Thread 0xb67ff440 (LWP 122)):
> #0  0xb6e797e8 in pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
> #1  0x003a2564 in mono_os_cond_wait (cond=0x4c1bd0 <work_cond>,
> mutex=0x4c1bb8 <lock>) at ../../mono/utils/mono-os-mutex.h:146
> #2  0x003a3814 in thread_func (thread_data=0xb6cc0004) at sgen-thread-pool.c:129
> #3  0xb6e743f4 in start_thread () from /lib/libpthread.so.0
> #4  0xb6dd6f18 in ?? () from /lib/libc.so.6
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>
> Thread 1 (Thread 0xb6f75000 (LWP 121)):
> #0  0xb6e7e268 in waitpid () from /lib/libpthread.so.0
> #1  0x000f8dc0 in mono_handle_native_crash (signal=0x3ea5b8 "SIGILL",
> ctx=0xbedcda60, info=0xbedcd9e0) at mini-exceptions.c:2567
> #2  0x0001f8bc in mono_sigill_signal_handler (_dummy=4,
> _info=0xbedcd9e0, context=0xbedcda60) at mini-runtime.c:2773
> #3  <signal handler called>
> #4  mono_arch_have_fast_tls () at mini-arm.c:348
> #5  0x0014494c in emit_save_lmf (cfg=0x513258, code=0x512da8 "",
> lmf_offset=8) at mini-arm.c:386
> #6  0x00161f50 in mono_arch_emit_prolog (cfg=0x513258) at mini-arm.c:6414
> #7  0x00175cac in mono_codegen (cfg=0x513258) at mini.c:2246
> #8  0x0017a930 in mini_method_compile (method=0x511270,
> opts=370223615, domain=0x4cc3b8, flags=JIT_FLAG_RUN_CCTORS, parts=0,
> aot_method_index=-1) at mini.c:3866
> #9  0x0017b7d0 in mono_jit_compile_method_inner (method=0x511270,
> target_domain=0x4cc3b8, opt=370223615, error=0xbedce4c8) at
> mini.c:4194
> #10 0x0001d470 in mono_jit_compile_method_with_opt (method=0x511270,
> opt=370223615, error=0xbedce4c8) at mini-runtime.c:1888
> #11 0x0001d670 in mono_jit_compile_method (method=0x511270,
> error=0xbedce4c8) at mini-runtime.c:1932
> #12 0x002ba198 in mono_compile_method_checked (method=0x511270,
> error=0xbedce4c8) at object.c:674
> #13 0x0017b2fc in mono_jit_compile_method_inner (method=0x511200,
> target_domain=0x4cc3b8, opt=370223615, error=0xbedce4c8) at
> mini.c:4093
> #14 0x0001d470 in mono_jit_compile_method_with_opt (method=0x511200,
> opt=370223615, error=0xbedce4c8) at mini-runtime.c:1888
> #15 0x0001d670 in mono_jit_compile_method (method=0x511200,
> error=0xbedce4c8) at mini-runtime.c:1932
> #16 0x000fc0dc in common_call_trampoline (regs=0xbedce5a8,
> code=0xb6cafe00 "", m=0x511200, vt=0x0, vtable_slot=0x0,
> error=0xbedce4c8) at mini-trampolines.c:699
> #17 0x000fc6d8 in mono_magic_trampoline (regs=0xbedce5a8,
> code=0xb6cafe00 "", arg=0x511200, tramp=0x4fe6c0
> "\020\345\334\276\200iO") at mini-trampolines.c:829
> #18 0xb6cf406c in ?? ()
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>
> =================================================================
> Got a SIGILL while executing native code. This usually indicates
> a fatal error in the mono runtime or one of the native libraries
> used by your application.
> =================================================================

As a quick and dirty hack I modified the source of
mono/mini/mini-arch.c with this:

gboolean
mono_arch_have_fast_tls (void)
{
        return FALSE;
}

And everithing started working! So IMHO there is something wrong with
the new mechanism for selectiong TLS features.

Sincerely, Angelo

>
>> ________________________________________
>> From: Angelo Compagnucci <angelo.compagnucci at gmail.com>
>> Sent: Tuesday, May 23, 2017 11:04:01 PM
>> To: Bernhard Urban
>> Cc: Mono-devel-list at lists.ximian.com
>> Subject: Re: [Mono-dev] Crosscompiling Mono 5.0.0.100
>>
>> Dearh Bernhard,
>>
>> 2017-05-23 19:54 GMT+02:00 Bernhard Urban <beurba at microsoft.com>:
>>>  >      Host:          arm-buildroot-linux-gnueabi
>>>  >      Target:        arm-buildroot-linux-gnueabi
>>>
>>> so... you aren't actually cross-compiling, am I right?
>>
>> I'm actually crosscompiling inside buildroot wich somewhat cheats.
>>
>>> That's weird then, configure should pick up all the right settings. I'm curious to see the emitted code around the crash site. If you use gdb, something like `x/100i $pc-0x40` should do the trick.
>>
>>
>> =================================================================
>> Got a SIGILL while executing native code. This usually indicates
>> a fatal error in the mono runtime or one of the native libraries
>> used by your application.
>> =================================================================
>>
>>
>> Thread 1 "mono-sgen" received signal SIGABRT, Aborted.
>> 0xb6cede50 in raise () from /lib/libc.so.6
>> (gdb) x/100i $pc-0x40
>>    0xb6cede10 <ssignal+196>:    andseq  r1, r1, r12, ror #8
>>    0xb6cede14 <ssignal+200>:
>>                 ; <UNDEFINED> instruction: 0x0010e2b8
>>    0xb6cede18 <raise>:  push    {r7, lr}
>>    0xb6cede1c <raise+4>:        mov     r2, r0
>>    0xb6cede20 <raise+8>:        bl      0xb6cd8650
>>    0xb6cede24 <raise+12>:       ldr     r1, [r0, #-1112]        ; 0xfffffba8
>>    0xb6cede28 <raise+16>:       mov     r12, r0
>>    0xb6cede2c <raise+20>:       cmp     r1, #0
>>    0xb6cede30 <raise+24>:       ldr     r0, [r0, #-1108]        ; 0xfffffbac
>>    0xb6cede34 <raise+28>:       bne     0xb6cede64 <raise+76>
>>    0xb6cede38 <raise+32>:       mov     r7, #224        ; 0xe0
>>    0xb6cede3c <raise+36>:       svc     0x00000000
>>    0xb6cede40 <raise+40>:       mov     r1, r0
>>    0xb6cede44 <raise+44>:       str     r0, [r12, #-1112]       ; 0xfffffba8
>>    0xb6cede48 <raise+48>:       mov     r7, #268        ; 0x10c
>>    0xb6cede4c <raise+52>:       svc     0x00000000
>> => 0xb6cede50 <raise+56>:       cmn     r0, #4096       ; 0x1000
>>    0xb6cede54 <raise+60>:       mov     r3, r0
>>    0xb6cede58 <raise+64>:       bhi     0xb6cede80 <raise+104>
>>    0xb6cede5c <raise+68>:       mov     r0, r3
>>    0xb6cede60 <raise+72>:       pop     {r7, pc}
>>    0xb6cede64 <raise+76>:       cmp     r0, #0
>> ---Type <return> to continue, or q <return> to quit---
>>    0xb6cede68 <raise+80>:       bgt     0xb6cede48 <raise+48>
>>    0xb6cede6c <raise+84>:       bic     r3, r0, #-2147483648    ; 0x80000000
>>    0xb6cede70 <raise+88>:       cmp     r3, #0
>>    0xb6cede74 <raise+92>:       rsbne   r0, r0, #0
>>    0xb6cede78 <raise+96>:       moveq   r0, r1
>>    0xb6cede7c <raise+100>:      b       0xb6cede48 <raise+48>
>>    0xb6cede80 <raise+104>:
>>     ldr r2, [pc, #20]   ; 0xb6cede9c <raise+132>
>>    0xb6cede84 <raise+108>:      rsb     r1, r0, #0
>>    0xb6cede88 <raise+112>:      ldr     r2, [pc, r2]
>>    0xb6cede8c <raise+116>:      bl      0xb6cd8650
>>    0xb6cede90 <raise+120>:      mvn     r3, #0
>>    0xb6cede94 <raise+124>:      str     r1, [r0, r2]
>>    0xb6cede98 <raise+128>:      b       0xb6cede5c <raise+68>
>>    0xb6cede9c <raise+132>:      andseq  lr, r0, r8, lsr #4
>>    0xb6cedea0 <killpg>: cmp     r0, #0
>>    0xb6cedea4 <killpg+4>:       push    {lr}            ; (str lr, [sp, #-4]!)
>>    0xb6cedea8 <killpg+8>:       blt     0xb6cedeb8 <killpg+24>
>>    0xb6cedeac <killpg+12>:      rsb     r0, r0, #0
>>    0xb6cedeb0 <killpg+16>:      pop     {lr}            ; (ldr lr, [sp], #4)
>>    0xb6cedeb4 <killpg+20>:      b       0xb6cee120 <kill>
>>    0xb6cedeb8 <killpg+24>:
>>     ldr r3, [pc, #20]   ; 0xb6ceded4 <killpg+52>
>> ---Type <return> to continue, or q <return> to quit---
>>    0xb6cedebc <killpg+28>:      bl      0xb6cd8650
>>    0xb6cedec0 <killpg+32>:      ldr     r3, [pc, r3]
>>    0xb6cedec4 <killpg+36>:      mov     r2, #22
>>    0xb6cedec8 <killpg+40>:      str     r2, [r0, r3]
>>    0xb6cedecc <killpg+44>:      mvn     r0, #0
>>    0xb6ceded0 <killpg+48>:      pop     {pc}            ; (ldr pc, [sp], #4)
>>    0xb6ceded4 <killpg+52>:
>>                 ; <UNDEFINED> instruction: 0x0010e1f0
>>    0xb6ceded8:  push    {r4, r5, r6, r7, lr}
>>    0xb6cededc:  ldr     r6, [pc, #324]  ; 0xb6cee028
>>    0xb6cedee0:  subs    r5, r1, #0
>>    0xb6cedee4:  sub     sp, sp, #284    ; 0x11c
>>    0xb6cedee8:  mov     r7, r0
>>    0xb6cedeec:  mov     r4, r2
>>    0xb6cedef0:  add     r6, pc, r6
>>    0xb6cedef4:  beq     0xb6cedf28
>>    0xb6cedef8:  mov     r1, r5
>>    0xb6cedefc:  ldr     r3, [r1], #4
>>    0xb6cedf00:  add     r0, sp, #12
>>    0xb6cedf04:  mov     r2, #128        ; 0x80
>>    0xb6cedf08:  str     r3, [sp]
>>    0xb6cedf0c:  bl      0xb6d3d7a0 <memcpy>
>>    0xb6cedf10:  ldr     r3, [r5, #132]  ; 0x84
>> ---Type <return> to continue, or q <return> to quit---
>>    0xb6cedf14:  str     r3, [sp, #4]
>>    0xb6cedf18:  tst     r3, #67108864   ; 0x4000000
>>    0xb6cedf1c:  beq     0xb6cedfa8
>>    0xb6cedf20:  ldr     r3, [r5, #136]  ; 0x88
>>    0xb6cedf24:  str     r3, [sp, #8]
>>    0xb6cedf28:  cmp     r4, #0
>>    0xb6cedf2c:  addne   r2, sp, #140    ; 0x8c
>>    0xb6cedf30:  moveq   r2, r4
>>    0xb6cedf34:  cmp     r5, #0
>>    0xb6cedf38:  mov     r0, r7
>>    0xb6cedf3c:  movne   r1, sp
>>    0xb6cedf40:  moveq   r1, r5
>>    0xb6cedf44:  mov     r3, #8
>>    0xb6cedf48:  mov     r7, #174        ; 0xae
>>    0xb6cedf4c:  svc     0x00000000
>>    0xb6cedf50:  cmn     r0, #4096       ; 0x1000
>>    0xb6cedf54:  mov     r5, r0
>>    0xb6cedf58:  bhi     0xb6cee00c
>>    0xb6cedf5c:  adds    r3, r4, #0
>>    0xb6cedf60:  movne   r3, #1
>>    0xb6cedf64:  cmp     r0, #0
>>    0xb6cedf68:  movlt   r3, #0
>>    0xb6cedf6c:  cmp     r3, #0
>> ---Type <return> to continue, or q <return> to quit---
>>    0xb6cedf70:  beq     0xb6cedf9c
>>    0xb6cedf74:  ldr     r3, [sp, #140]  ; 0x8c
>>    0xb6cedf78:  mov     r0, r4
>>    0xb6cedf7c:  str     r3, [r0], #4
>>    0xb6cedf80:  mov     r2, #128        ; 0x80
>>    0xb6cedf84:  add     r1, sp, #152    ; 0x98
>>    0xb6cedf88:  bl      0xb6d3d7a0 <memcpy>
>>    0xb6cedf8c:  ldr     r2, [sp, #144]  ; 0x90
>>    0xb6cedf90:  ldr     r3, [sp, #148]  ; 0x94
>>    0xb6cedf94:  str     r2, [r4, #132]  ; 0x84
>>    0xb6cedf98:  str     r3, [r4, #136]  ; 0x88
>>    0xb6cedf9c:  mov     r0, r5
>>
>> The file command reports:
>>
>> /usr/bin/mono-sgen: ELF 32-bit LSB executable, ARM, EABI5 version 1
>> (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for
>> GNU/Linux 2.6.16, stripped
>>
>> So the cross compilation went well.
>>
>> Sincerely, Angelo
>>
>>>
>>> -Bernhard
>>> ________________________________________
>>> From: Angelo Compagnucci <angelo.compagnucci at gmail.com>
>>> Sent: Tuesday, May 23, 2017 6:35:06 PM
>>> To: Bernhard Urban
>>> Cc: Mono-devel-list at lists.ximian.com
>>> Subject: Re: [Mono-dev] Crosscompiling Mono 5.0.0.100
>>>
>>> Hello Bernhard,
>>>
>>> The recpie is this one:
>>>
>>> ################################################################################
>>> #
>>> # mono
>>> #
>>> ################################################################################
>>>
>>> MONO_VERSION = 5.0.0.100
>>> MONO_SITE = https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdownload.mono-project.com%2Fsources%2Fmono&data=02%7C01%7Cbeurba%40microsoft.com%7C25ae3075088c4b176de708d4a1f9c451%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311541495053555&sdata=gh4wrnniTrAEH5C7lGkDBF8dLLusjvGNkJR9KCkHzH4%3D&reserved=0
>>> MONO_SOURCE = mono-$(MONO_VERSION).tar.bz2
>>> MONO_LICENSE = GPL-2.0 or MIT (compiler, tools), MIT (libs) or commercial
>>> MONO_LICENSE_FILES = LICENSE mcs/COPYING eglib/COPYING \
>>>     external/Newtonsoft.Json/Tools/7-zip/copying.txt
>>> MONO_INSTALL_STAGING = YES
>>>
>>> ## Mono native
>>>
>>> # patching configure.ac
>>> MONO_AUTORECONF = YES
>>>
>>> # Disable managed code (mcs folder) from building
>>> MONO_CONF_OPTS = --with-mcs-docs=no \
>>>     --with-ikvm-native=no \
>>>     --enable-minimal=profiler,aot \
>>>     --disable-mcs-build \
>>>     --with-xen_opt=no \
>>>     --disable-btls \
>>>     --enable-static
>>>
>>> # The libraries have been built by the host-mono build. Since they are
>>> # architecture-independent, we simply copy them to the target.
>>> define MONO_INSTALL_LIBS
>>>     rsync -av --exclude=*.so --exclude=*.mdb \
>>>         $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/
>>> endef
>>>
>>> MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS
>>>
>>> ifeq ($(BR2_PACKAGE_LIBICONV),y)
>>> MONO_DEPENDENCIES += libiconv
>>> endif
>>>
>>> MONO_DEPENDENCIES += host-mono
>>>
>>> ## Mono managed
>>>
>>> HOST_MONO_CONF_OPTS = --with-mcs-docs=no \
>>>     --disable-libraries \
>>>     --with-ikvm-native=no \
>>>     --enable-minimal=profiler,aot \
>>>     --with-xen_opt=no \
>>>     --disable-btls \
>>>     --enable-static
>>>
>>> # ensure monolite is used
>>> HOST_MONO_MAKE_OPTS += EXTERNAL_MCS=false
>>>
>>> HOST_MONO_DEPENDENCIES = host-monolite host-gettext
>>>
>>> define HOST_MONO_SETUP_MONOLITE
>>>     rm -rf $(@D)/mcs/class/lib/monolite
>>>     (cd $(@D)/mcs/class/lib; ln -s $(HOST_DIR)/usr/lib/monolite monolite)
>>> endef
>>>
>>> HOST_MONO_POST_CONFIGURE_HOOKS += HOST_MONO_SETUP_MONOLITE
>>>
>>> $(eval $(autotools-package))
>>> $(eval $(host-autotools-package))
>>>
>>>
>>> The package is compiled in two phases: the first compiles host-mono,
>>> which in reality only compiles the libraries using monolite. Then the
>>> recipe compiles mono native.
>>> All the cross compiling options is passed to the recipe by buildroot.
>>>
>>> Configure output:
>>>
>>>         mcs source:    mcs
>>>         C# Compiler:   roslyn
>>>
>>>    Engine:
>>>         Host:          arm-buildroot-linux-gnueabi
>>>         Target:        arm-buildroot-linux-gnueabi
>>>         GC:            sgen (concurrent by default) and Included Boehm
>>> GC with typed GC and parallel mark
>>>         TLS:           __thread
>>>         SIGALTSTACK:   yes
>>>         Engine:        Building and using the JIT
>>>         BigArrays:     no
>>>         DTrace:        no
>>>         LLVM Back End: no (dynamically loaded: no)
>>>         Interpreter:   no
>>>
>>>    Libraries:
>>>         .NET 4.x:        no
>>>         Xamarin.Android: no
>>>         Xamarin.iOS:     no
>>>         Xamarin.WatchOS: no
>>>         Xamarin.TVOS:    no
>>>         Xamarin.Mac:     no
>>>         Windows AOT:     no
>>>         Orbis:           no
>>>         Test profiles:   AOT Full (no), AOT Hybrid (no)
>>>         JNI support:
>>>         libgdiplus:      assumed to be installed
>>>         zlib:
>>>         BTLS:            no
>>>         Disabled:      profiler,aot
>>>
>>>
>>> Consider that the same recipe with mono 4.8.1.0 works like expected.
>>>
>>> Sincerely, Angelo
>>>
>>> 2017-05-23 18:21 GMT+02:00 Bernhard Urban <beurba at microsoft.com>:
>>>> How does your configure line look like and what's the output?
>>>>
>>>> -Bernhard
>>>> ________________________________________
>>>> From: Angelo Compagnucci <angelo.compagnucci at gmail.com>
>>>> Sent: Tuesday, May 23, 2017 6:07:07 PM
>>>> To: Bernhard Urban
>>>> Cc: Mono-devel-list at lists.ximian.com
>>>> Subject: Re: [Mono-dev] Crosscompiling Mono 5.0.0.100
>>>>
>>>> Hello Bernhard,
>>>>
>>>> 2017-05-23 17:21 GMT+02:00 Bernhard Urban <beurba at microsoft.com>:
>>>>> Hello Angelo,
>>>>>
>>>>> could you install gdb (or lldb) on your target?  It looks like the target device doesn't support some instructions that mono generates (hence SIGILL). It would be useful to get a native stack trace, or a disassembly around the crash site.
>>>>
>>>> I have gdb but I'm not having success with a backtrace, I'll try more!
>>>>
>>>>> What CPU architecture/platform are you targeting?
>>>>
>>>> Qemu versatile, so it's an ARM926EJ-S
>>>>
>>>>> That might be helpful as well: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mono-project.com%2Fdocs%2Fdebug%2Bprofile%2Fdebug%2F&data=02%7C01%7Cbeurba%40microsoft.com%7C843ac485cb334abb79e208d4a1f5db83%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311524711368693&sdata=ZWTL2w5DPPR2ldn8JWj6wV5FxTGLpKSijP6VG8DpNu0%3D&reserved=0
>>>>
>>>> I'm looking at it!
>>>>
>>>> Thanks!
>>>>
>>>>>
>>>>>
>>>>> -Bernhard
>>>>> ________________________________________
>>>>> From: Mono-devel-list <mono-devel-list-bounces at lists.dot.net> on behalf of Angelo Compagnucci <angelo.compagnucci at gmail.com>
>>>>> Sent: Tuesday, May 23, 2017 2:43:48 PM
>>>>> To: Mono-devel-list at lists.ximian.com
>>>>> Subject: [Mono-dev] Crosscompiling Mono 5.0.0.100
>>>>>
>>>>> Hello developers,
>>>>>
>>>>> I'm trying to crosscompile mono for qemu versatile with the buildroot
>>>>> crosscompiling system. More precisely, I'm trying to update the recipe
>>>>> bundled with buildroot for mono 4.8.1.100.
>>>>> I'm actually not a novice in this sort of thing, I actually
>>>>> contributed the recipe in the first place and contributed several
>>>>> patches to the mono build system to be cross compilable and musl
>>>>> compatible.
>>>>>
>>>>> Actually I have a working recipe, the same one i use for 4.8.1.100 and
>>>>> which works, and I can successfully compile mono 5.0.0.100.
>>>>>
>>>>> Unfortunately, compiling a simple hello world produces this error:
>>>>>
>>>>> # mcs hello.cs
>>>>> Stacktrace:
>>>>>
>>>>>   at <unknown> <0xffffffff>
>>>>>   at Mono.SafeStringMarshal.get_Value () [0x0001a] in
>>>>> <a1ccf43d50c94435a9f0fcab25017dca>:0
>>>>>   at System.Environment.internalGetEnvironmentVariable (string)
>>>>> [0x0000c] in <a1ccf43d50c94435a9f0fcab25017dca>:0
>>>>>   at System.Environment.GetEnvironmentVariable (string) [0x00000] in
>>>>> <a1ccf43d50c94435a9f0fcab25017dca>:0
>>>>>   at Mono.CSharp.Driver.Main (string[]) [0x00000] in
>>>>> <65e20f41151e464c8d313246de15d1a3>:0
>>>>>   at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object
>>>>> (object,intptr,intptr,intptr) [0x00054] in
>>>>> <65e20f41151e464c8d313246de15d1a3>:0
>>>>> /proc/self/maps:
>>>>> 00008000-00299000 r-xp 00000000 08:00 3367       /usr/bin/mono-sgen
>>>>> 002a0000-002a2000 rwxp 00290000 08:00 3367       /usr/bin/mono-sgen
>>>>> 002a2000-0033b000 rwxp 00000000 00:00 0          [heap]
>>>>> b4c91000-b4f09000 r-xp 00000000 08:00 3263
>>>>> /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
>>>>> b4f09000-b5000000 r-xp 00000000 08:00 2599
>>>>> /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
>>>>> b5000000-b5021000 rwxp 00000000 00:00 0
>>>>> b5021000-b5100000 ---p 00000000 00:00 0
>>>>> b51a9000-b51aa000 ---p 00000000 00:00 0
>>>>> b51aa000-b52a9000 rwxp 00000000 00:00 0
>>>>> b52a9000-b5652000 r-xp 00000000 08:00 1491       /usr/lib/mono/4.5/mscorlib.dll
>>>>> b5652000-b5800000 r-xp 00000000 08:00 1270       /usr/lib/mono/4.5/mcs.exe
>>>>> b5800000-b6000000 rwxp 00000000 00:00 0
>>>>> b6000000-b6001000 ---p 00000000 00:00 0
>>>>> b6001000-b6c00000 rwxp 00000000 00:00 0
>>>>> b6c70000-b6cf0000 rwxp 00000000 00:00 0
>>>>> b6cf2000-b6d0b000 rwxp 00000000 00:00 0
>>>>> b6d0b000-b6d3a000 ---p 00000000 00:00 0
>>>>> b6d3a000-b6d4a000 rwxp 00000000 00:00 0
>>>>> b6d4a000-b6e7d000 r-xp 00000000 08:00 3567       /lib/libc-2.18.so
>>>>> b6e7d000-b6e84000 ---p 00133000 08:00 3567       /lib/libc-2.18.so
>>>>> b6e84000-b6e86000 r-xp 00132000 08:00 3567       /lib/libc-2.18.so
>>>>> b6e86000-b6e87000 rwxp 00134000 08:00 3567       /lib/libc-2.18.so
>>>>> b6e87000-b6e8a000 rwxp 00000000 00:00 0
>>>>> b6e8a000-b6eab000 r-xp 00000000 08:00 543        /lib/libgcc_s.so.1
>>>>> b6eab000-b6eb2000 ---p 00021000 08:00 543        /lib/libgcc_s.so.1
>>>>> b6eb2000-b6eb3000 rwxp 00020000 08:00 543        /lib/libgcc_s.so.1
>>>>> b6eb3000-b6ec9000 r-xp 00000000 08:00 991        /lib/libpthread-2.18.so
>>>>> b6ec9000-b6ed0000 ---p 00016000 08:00 991        /lib/libpthread-2.18.so
>>>>> b6ed0000-b6ed1000 r-xp 00015000 08:00 991        /lib/libpthread-2.18.so
>>>>> b6ed1000-b6ed2000 rwxp 00016000 08:00 991        /lib/libpthread-2.18.so
>>>>> b6ed2000-b6ed4000 rwxp 00000000 00:00 0
>>>>> b6ed4000-b6ed8000 r-xp 00000000 08:00 209        /lib/libdl-2.18.so
>>>>> b6ed8000-b6edf000 ---p 00004000 08:00 209        /lib/libdl-2.18.so
>>>>> b6edf000-b6ee0000 r-xp 00003000 08:00 209        /lib/libdl-2.18.so
>>>>> b6ee0000-b6ee1000 rwxp 00004000 08:00 209        /lib/libdl-2.18.so
>>>>> b6ee1000-b6ee7000 r-xp 00000000 08:00 1327       /lib/librt-2.18.so
>>>>> b6ee7000-b6eee000 ---p 00006000 08:00 1327       /lib/librt-2.18.so
>>>>> b6eee000-b6eef000 r-xp 00005000 08:00 1327       /lib/librt-2.18.so
>>>>> b6eef000-b6ef0000 rwxp 00006000 08:00 1327       /lib/librt-2.18.so
>>>>> b6ef0000-b6f8d000 r-xp 00000000 08:00 207        /lib/libm-2.18.so
>>>>> b6f8d000-b6f95000 ---p 0009d000 08:00 207        /lib/libm-2.18.so
>>>>> b6f95000-b6f96000 r-xp 0009d000 08:00 207        /lib/libm-2.18.so
>>>>> b6f96000-b6f97000 rwxp 0009e000 08:00 207        /lib/libm-2.18.so
>>>>> b6f97000-b6fb7000 r-xp 00000000 08:00 2447       /lib/ld-2.18.so
>>>>> b6fb7000-b6fb8000 rwxp 00000000 00:00 0
>>>>> b6fb8000-b6fb9000 rwxs 00000000 00:0c 225        /dev/shm/mono.110
>>>>> b6fb9000-b6fba000 ---p 00000000 00:00 0
>>>>> b6fba000-b6fbb000 r-xp 00000000 00:00 0
>>>>> b6fbb000-b6fbe000 rwxp 00000000 00:00 0
>>>>> b6fbe000-b6fbf000 r-xp 0001f000 08:00 2447       /lib/ld-2.18.so
>>>>> b6fbf000-b6fc0000 rwxp 00020000 08:00 2447       /lib/ld-2.18.so
>>>>> bec63000-bec84000 rw-p 00000000 00:00 0          [stack]
>>>>> bee69000-bee6a000 r-xp 00000000 00:00 0          [sigpage]
>>>>> ffff0000-ffff1000 r-xp 00000000 00:00 0          [vectors]
>>>>>
>>>>> Native stacktrace:
>>>>>
>>>>>
>>>>> Debug info from gdb:
>>>>>
>>>>> mono_gdb_render_native_backtraces not supported on this platform,
>>>>> unable to find gdb or lldb
>>>>>
>>>>> =================================================================
>>>>> Got a SIGILL while executing native code. This usually indicates
>>>>> a fatal error in the mono runtime or one of the native libraries
>>>>> used by your application.
>>>>> =================================================================
>>>>>
>>>>> Aborted
>>>>>
>>>>>
>>>>> I've not followed too closely the latests development bits for mono 5
>>>>> and I'm asking you some advice to understand what's going on.
>>>>>
>>>>> Thank your for your time!
>>>>>
>>>>> --
>>>>> Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7C45f4a2e117e24f05457c08d4a1d977cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311402805633277&sdata=5c%2B%2FVLvlqXKfMT%2FrWza5OzHG6rIOTizHCIx%2BNO5FPWc%3D&reserved=0
>>>>> _______________________________________________
>>>>> Mono-devel-list mailing list
>>>>> Mono-devel-list at lists.dot.net
>>>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.dot.net%2Fmailman%2Flistinfo%2Fmono-devel-list&data=02%7C01%7Cbeurba%40microsoft.com%7C45f4a2e117e24f05457c08d4a1d977cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311402805633277&sdata=9BYjnZLHRW%2FzaNJWZ88dN%2BSfPka1fDh51ooKtzA2aGM%3D&reserved=0
>>>>
>>>>
>>>>
>>>> --
>>>> Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7C843ac485cb334abb79e208d4a1f5db83%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311524711368693&sdata=JscpGNCYRmwrNeRGtc7jza5ZRiLSC2Ll9YbpYn02hc8%3D&reserved=0
>>>
>>>
>>>
>>> --
>>> Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7C25ae3075088c4b176de708d4a1f9c451%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311541495053555&sdata=wYlpKZ7x0VxrFBN25TrRNW8OJt8%2FbwWMDPDvj6EaQSE%3D&reserved=0
>>
>>
>>
>> --
>> Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7C91e7175d17ba4b85b6d408d4a21f560b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636311702860949950&sdata=wjU6u%2Bc%2FqEjtzxtt%2FqGYfYKBhhJ9K1wVMx5rf8t1CcU%3D&reserved=0
>
>
>
> --
> Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7Ceeee8c40aafc4201dbad08d4a2efc4c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636312598096067089&sdata=z81Gsdu2jXk7IAfHZi1cqtLr%2FhOcJTc%2FrV25M7Pps6c%3D&reserved=0



--
Profile: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fit.linkedin.com%2Fin%2Fcompagnucciangelo&data=02%7C01%7Cbeurba%40microsoft.com%7Ceeee8c40aafc4201dbad08d4a2efc4c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636312598096067089&sdata=z81Gsdu2jXk7IAfHZi1cqtLr%2FhOcJTc%2FrV25M7Pps6c%3D&reserved=0
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.dot.net
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.dot.net%2Fmailman%2Flistinfo%2Fmono-devel-list&data=02%7C01%7Cbeurba%40microsoft.com%7Ceeee8c40aafc4201dbad08d4a2efc4c3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636312598096067089&sdata=ZtNEVSOfq4kCfEB4ybaA6FOALWXQN5LMypDeWhQLrQM%3D&reserved=0


More information about the Mono-devel-list mailing list