gluck / il-repack

Open-source alternative to ILMerge
Apache License 2.0
1.15k stars 214 forks source link

Cannot merge in linux, SIGABRT while executing native code #287

Closed MauroFoti closed 5 months ago

MauroFoti commented 3 years ago

I have a solution with two projects:

Server depends on lib, It also has a dependency with CommandLine.dll, that gets copied to the output directory after build. At the end, in the build directory bin/net48 there are server.exe, lib.dll, CommandLine.dll, and various .pdb and .config files. Both projects are generated with .net48 and C#9. I would like to merge these three assemblies in one (like server-release.exe).

I tried this command in the directory of server:

mono ~/.nuget/packages/ilrepack/2.1.0-beta1/tools/ILRepack.exe /out:bin/net48/server-release.exe bin/net48/server.exe bin/net48/lib.dll bin/net48/CommandLine.dll

The output is

* Assertion at marshal-ilgen.c:4412, condition `mtype != NULL' not met

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x55d96febeeb5 - mono : (null)
    0x55d96febf250 - mono : (null)
    0x55d96fe6c129 - mono : (null)
    0x55d96febe467 - mono : (null)
    0x7f05b83973c0 - /lib/x86_64-linux-gnu/libpthread.so.0 : (null)
    0x7f05b81bb18b - /lib/x86_64-linux-gnu/libc.so.6 : gsignal
    0x7f05b819a859 - /lib/x86_64-linux-gnu/libc.so.6 : abort
    0x55d96fe2f2eb - mono : (null)
    0x55d97011c1a5 - mono : (null)
    0x55d970139b2e - mono : (null)
    0x55d97013a113 - mono : monoeg_assertion_message
    0x55d9700b23f9 - mono : (null)
    0x55d9700b1220 - mono : (null)
    0x55d97000e681 - mono : (null)
    0x55d96fef1995 - mono : (null)
    0x55d96fec4258 - mono : (null)
    0x55d96fec63c6 - mono : (null)
    0x55d96fe37e7a - mono : (null)
    0x55d96fe6fab6 - mono : (null)
    0x55d96fe70634 - mono : (null)
    0x419af393 - Unknown

=================================================================
    Telemetry Dumper:
=================================================================
Pkilling 0x7f05b7a47700 from 0x7f05b8170780
Entering thread summarizer pause from 0x7f05b8170780
Finished thread summarizer pause from 0x7f05b8170780.

Waiting for dumping threads to resume

=================================================================
    External Debugger Dump:
=================================================================
[New LWP 61090]
[New LWP 61091]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f05b825adff in __GI___wait4 (pid=61095, stat_loc=0x7ffe5a6b3514, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
27  ../sysdeps/unix/sysv/linux/wait4.c: File o directory non esistente.
  Id   Target Id                                       Frame 
* 1    Thread 0x7f05b8170780 (LWP 61089) "mono"        0x00007f05b825adff in __GI___wait4 (pid=61095, stat_loc=0x7ffe5a6b3514, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
  2    Thread 0x7f05b73ff700 (LWP 61090) "SGen worker" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55d9702b0e08) at ../sysdeps/nptl/futex-internal.h:183
  3    Thread 0x7f05b7a47700 (LWP 61091) "Finalizer"   futex_abstimed_wait_cancelable (private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x55d9702a2080) at ../sysdeps/nptl/futex-internal.h:320

Thread 3 (Thread 0x7f05b7a47700 (LWP 61091)):
#0  futex_abstimed_wait_cancelable (private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x55d9702a2080) at ../sysdeps/nptl/futex-internal.h:320
#1  do_futex_wait (sem=sem@entry=0x55d9702a2080, abstime=0x0, clockid=0) at sem_waitcommon.c:112
#2  0x00007f05b83954e8 in __new_sem_wait_slow (sem=0x55d9702a2080, abstime=0x0, clockid=0) at sem_waitcommon.c:184
#3  0x000055d9700b9cc8 in ?? ()
#4  0x000055d970066f3a in ?? ()
#5  0x00007f05b838b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007f05b8297293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f05b73ff700 (LWP 61090)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55d9702b0e08) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55d9702b0e20, cond=0x55d9702b0de0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x55d9702b0de0, mutex=0x55d9702b0e20) at pthread_cond_wait.c:638
#3  0x000055d970113dc6 in ?? ()
#4  0x00007f05b838b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5  0x00007f05b8297293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f05b8170780 (LWP 61089)):
#0  0x00007f05b825adff in __GI___wait4 (pid=61095, stat_loc=0x7ffe5a6b3514, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x000055d96febf0bf in ?? ()
#2  0x000055d96febf250 in ?? ()
#3  0x000055d96fe6c129 in ?? ()
#4  0x000055d96febe467 in ?? ()
#5  <signal handler called>
#6  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#7  0x00007f05b819a859 in __GI_abort () at abort.c:79
#8  0x000055d96fe2f2eb in ?? ()
#9  0x000055d97011c1a5 in ?? ()
#10 0x000055d970139b2e in ?? ()
#11 0x000055d97013a113 in monoeg_assertion_message ()
#12 0x000055d9700b23f9 in ?? ()
#13 0x000055d9700b1220 in ?? ()
#14 0x000055d97000e681 in ?? ()
#15 0x000055d96fef1995 in ?? ()
#16 0x000055d96fec4258 in ?? ()
#17 0x000055d96fec63c6 in ?? ()
#18 0x000055d96fe37e7a in ?? ()
#19 0x000055d96fe6fab6 in ?? ()
#20 0x000055d96fe70634 in ?? ()
#21 0x00000000419af393 in ?? ()
#22 0x000055d970382d45 in ?? ()
#23 0x000055d9703b1050 in ?? ()
#24 0x00007ffe5a6b5650 in ?? ()
#25 0x00007ffe5a6b5488 in ?? ()
#26 0x000055d9703921b0 in ?? ()
#27 0x00007f05b7411118 in ?? ()
#28 0x00007f05b7419828 in ?? ()
#29 0x00007f05b69b9088 in ?? ()
#30 0x000055d9703b1a30 in ?? ()
#31 0x00007ffe5a6b5650 in ?? ()
#32 0x00007ffe5a6b5710 in ?? ()
#33 0x00007f05b74006d0 in ?? ()
#34 0x00007f05b7411118 in ?? ()
#35 0x00007f05b74197c8 in ?? ()
#36 0x0000000000000000 in ?? ()
[Inferior 1 (process 61089) detached]

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7f05b81bb18b):0x7f05b81bb17b  d2 4c 89 ce bf 02 00 00 00 b8 0e 00 00 00 0f 05  .L..............
0x7f05b81bb18b  48 8b 84 24 08 01 00 00 64 48 33 04 25 28 00 00  H..$....dH3.%(..
0x7f05b81bb19b  00 75 26 44 89 c0 48 81 c4 18 01 00 00 c3 0f 1f  .u&D..H.........
0x7f05b81bb1ab  80 00 00 00 00 48 8b 15 b9 4c 1a 00 f7 d8 41 b8  .....H...L....A.

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at ILRepacking.Application:Main <0x00193>
      at <Module>:runtime_invoke_int_object <0x00091>
=================================================================
Annullato (core dump creato)
KirillOsenkov commented 7 months ago

Could you please try the latest version?

Also try with dotnet ILRepack.exe instead of mono ILRepack.exe.

KirillOsenkov commented 7 months ago

mono ~/.nuget/packages/ilrepack/2.0.23/tools/ILRepack.exe