Bug 52373 - mkbundle, Got a SIGSEGV while executing native code
Summary: mkbundle, Got a SIGSEGV while executing native code
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 4.2.1 (C6SR0)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-07 23:33 UTC by 89236888785
Modified: 2017-02-08 22:29 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description 89236888785 2017-02-07 23:33:43 UTC
fresh ubuntu-16.10 node. got mono-complete.

# cat ./testapp.cs
using System;

public class HelloWorld
{
    static public void Main()
    {
        Console.WriteLine("Hello World! This is our first Mono program");
    }
}

mcs going ok, and mono testapp.exe going ok too.

# mkbundle -o testapp testapp.exe --static
OS is: Linux
Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.
See http://www.mono-project.com/Licensing for details on licensing.
Sources: 1 Auto-dependencies: False
   embedding: /root/Proj/testapp.exe
Compiling:
as -o temp.o temp.s
cc -o testapp -Wall `pkg-config --cflags mono-2` temp.c  `pkg-config --libs-only-L mono-2` -Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic `pkg-config --libs-only-l mono-2 | sed -e "s/\-lmono-2.0 //"` temp.o
Done
root@ubuntu:~/Proj# ./testapp

Native stacktrace:

        ./testapp(+0x22173a) [0x5605a006173a]
        ./testapp(+0x6279c) [0x56059fea279c]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0x11630) [0x7f92d025c630]
        ./testapp(+0x17f910) [0x56059ffbf910]
        ./testapp(+0x2333d8) [0x5605a00733d8]
        ./testapp(+0x180e0f) [0x56059ffc0e0f]
        ./testapp(+0x1801d8) [0x56059ffc01d8]
        ./testapp(+0x1783b8) [0x56059ffb83b8]
        ./testapp(+0x178c9f) [0x56059ffb8c9f]
        ./testapp(+0x181d3a) [0x56059ffc1d3a]
        ./testapp(+0x181e5e) [0x56059ffc1e5e]
        ./testapp(+0x8bd35) [0x56059fecbd35]
        ./testapp(+0xa763c) [0x56059fee763c]
        ./testapp(+0x63b8e) [0x56059fea3b8e]
        ./testapp(+0x2b2a3) [0x56059fe6b2a3]
        ./testapp(+0x2a1bd) [0x56059fe6a1bd]
        /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7f92cfea43f1]
        ./testapp(+0x29d4a) [0x56059fe69d4a]

Debug info from gdb:


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

mkbundle -o testapp testapp.exe WITHOUT --static result in same effect.

# aptitude show mono-complete
Package: mono-complete
Version: 4.2.1.102+dfsg2-7ubuntu4
State: installed
Automatically installed: no
Priority: optional
Section: universe/cli-mono
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 59.4 k
Depends: mono-runtime (= 4.2.1.102+dfsg2-7ubuntu4), mono-runtime-sgen (= 4.2.1.102+dfsg2-7ubuntu4),
         libmono-2.0-1 (= 4.2.1.102+dfsg2-7ubuntu4), libmono-profiler (= 4.2.1.102+dfsg2-7ubuntu4),
         mono-utils (= 4.2.1.102+dfsg2-7ubuntu4), mono-jay (= 4.2.1.102+dfsg2-7ubuntu4), mono-devel
         (= 4.2.1.102+dfsg2-7ubuntu4), mono-mcs (= 4.2.1.102+dfsg2-7ubuntu4), mono-csharp-shell (=
         4.2.1.102+dfsg2-7ubuntu4), mono-4.0-gac (= 4.2.1.102+dfsg2-7ubuntu4), mono-4.0-service (=
         4.2.1.102+dfsg2-7ubuntu4), monodoc-base (= 4.2.1.102+dfsg2-7ubuntu4), monodoc-manual (=
         4.2.1.102+dfsg2-7ubuntu4), libmono-cil-dev (= 4.2.1.102+dfsg2-7ubuntu4),
         ca-certificates-mono (= 4.2.1.102+dfsg2-7ubuntu4)
--------------------------------------------------------------
What should i do? I need at my job develop apps in linux box, and there need to execute elf files, not throuth mono command.
Comment 1 89236888785 2017-02-08 18:43:39 UTC
Second box, archlinux, package mono-alpha
# mono-test-install
Active Mono: /usr/local/bin/mono
Other Mono executables: /usr/bin/mono
Error: pkg-config Mono installation points to a different install
       than the Mono found:
       Mono on PATH: /usr/local/bin/mono
       Mono from pkg-config: /usr/bin/mono
# /usr/local/bin/mono -V
Mono JIT compiler version 4.9.0 (Nightly 4.9.0.1784/d9360c5 Wed Feb  8 04:14:58 MSK 2017)
]# /usr/bin/mono -V
Mono JIT compiler version 4.8.0 (makepkg/df82e0775c5 Wed Feb  8 23:48:43 MSK 2017)

dunno why it is two installations of mono, anyway, when i use /usr/bin/mkbundle and /usr/local/bin/mkbundle, i have a problem:
# /usr/bin/mkbundle --static -o testapp.elf testapp.exe
ERROR: Couldn't load one or more of the i18n assemblies.

Unhandled Exception:
System.Exception: Exception of type 'System.Exception' was thrown.
  at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <0894434bf2d64b0d866cc513b06aca00>:0
  at MakeBundle.LoadLocalizedAssemblies (System.Collections.Generic.List`1[T] assemblies) [0x000d9] in <0894434bf2d64b0d866cc513b06aca00>:0
  at MakeBundle.Main (System.String[] args) [0x00a7a] in <0894434bf2d64b0d866cc513b06aca00>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Exception of type 'System.Exception' was thrown.
  at MakeBundle.Error (System.String msg, System.Object[] args) [0x00016] in <0894434bf2d64b0d866cc513b06aca00>:0
  at MakeBundle.LoadLocalizedAssemblies (System.Collections.Generic.List`1[T] assemblies) [0x000d9] in <0894434bf2d64b0d866cc513b06aca00>:0
  at MakeBundle.Main (System.String[] args) [0x00a7a] in <0894434bf2d64b0d866cc513b06aca00>:0

The source code same (hello world).

wt*? It`s very bad! How to solve that problem???
Comment 2 89236888785 2017-02-08 20:21:43 UTC
btw, fresh debian jessie have no that problem, just tested. but there old mono version 3.2.8.

Ubuntu 16.04.1 LTS, mono 4.2.1 have same probles as first post. That very bad!

Dear developers, please, fix that problem so we can use mkbundle with fresh mono versions!
Comment 3 89236888785 2017-02-08 22:27:10 UTC
Also, on Ubuntu 16.04.1 LTS i was trying use solution as described here http://www.mono-project.com/docs/getting-started/install/linux/ci-packages/
# apt list --installed | grep mono
mono-snapshot-2017.02.08+16.20.31/sid,now 1:2017.02.08+16.20.31-1 amd64 [установлен]
# mono -V
Mono JIT compiler version 4.9.0 (tarball Wed Feb  8 17:00:39 UTC 2017)

here mkbundle have problems as in post 2.
----
I found workaround (tested on updated archlinux):
take fresh stable release 4.6.2.16 from here https://download.mono-project.com/sources/mono/ , install as described here http://www.mono-project.com/docs/compiling-mono/linux/ in section "Building Mono from a Release Package", but need install mono-tools with pacman.
After that steps my problem was solved completely.

I think that topic can be closed now.
Comment 4 89236888785 2017-02-08 22:29:41 UTC
done