0

I have install a new ubuntu server 18.04 and I have also run a update and a upgrade. I did follow this guide to install the latest mono https://www.mono-project.com/download/stable/#download-lin and I also did pick mono-complete to make sure I got Everything.

but when I try to compile the basic "Hello World" I get error.

Stacktrace:

/proc/self/maps:
40f6c000-40f7c000 rwxp 00000000 00:00 0
4198b000-419ab000 rwxp 00000000 00:00 0
5599439d0000-559943e19000 r-xp 00000000 fd:00 28394                      /usr/bin/mono-sgen
559944018000-55994401f000 r--p 00448000 fd:00 28394                      /usr/bin/mono-sgen
55994401f000-559944024000 rw-p 0044f000 fd:00 28394                      /usr/bin/mono-sgen
559944024000-5599440b5000 rw-p 00000000 00:00 0
559944da8000-5599450dd000 rw-p 00000000 00:00 0                          [heap]
7f335360c000-7f3353dc2000 r-xp 00000000 fd:00 28889                      /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so
7f3353dc2000-7f3353fc2000 ---p 007b6000 fd:00 28889                      /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so
7f3353fc2000-7f3353fc3000 r--p 007b6000 fd:00 28889                      /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so
7f3353fc3000-7f3353fc4000 rw-p 007b7000 fd:00 28889                      /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so
7f3353fc4000-7f3354000000 rw-p 00000000 00:00 0
7f3354000000-7f3354021000 rw-p 00000000 00:00 0
7f3354021000-7f3358000000 ---p 00000000 00:00 0
7f33584f1000-7f33584f3000 r--p 00000000 fd:00 80822                      /usr/lib/mono/4.5/Facades/System.Globalization.dll
7f33584f3000-7f33584f5000 r--p 00000000 fd:00 80907                      /usr/lib/mono/4.5/Facades/System.Text.Encoding.dll
7f33584f5000-7f33584f7000 r--p 00000000 fd:00 80891                      /usr/lib/mono/4.5/Facades/System.Security.Cryptography.Primitives.dll
7f33584f7000-7f33584f9000 r--p 00000000 fd:00 80865                      /usr/lib/mono/4.5/Facades/System.Resources.ResourceManager.dll
7f33584f9000-7f3358571000 rw-p 00000000 00:00 0
7f3358571000-7f33589e8000 r--p 00000000 fd:00 78322                      /usr/lib/mono/4.5/Microsoft.CodeAnalysis.CSharp.dll
7f33589e8000-7f3358a06000 r--p 00000000 fd:00 28769                      /usr/lib/mono/gac/System.Numerics/4.0.0.0__b77a5c561934e089/System.Numerics.dll
7f3358a06000-7f3358d0e000 r--p 00000000 fd:00 28780                      /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
7f3358d0e000-7f3358d30000 r--p 00000000 fd:00 77532                      /usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
7f3358d30000-7f3358dbc000 r-xp 00000000 fd:00 28892                      /usr/lib/mono/aot-cache/amd64/System.Collections.Immutable.dll.so
7f3358dbc000-7f3358fbb000 ---p 0008c000 fd:00 28892                      /usr/lib/mono/aot-cache/amd64/System.Collections.Immutable.dll.so
Memory around native instruction pointer (0x7f3353b4d00e):
0x7f3353b4cffe  48 85 c9 0f 84 09 04 00 00 0f b6 89 88 00 00 00  H...............
0x7f3353b4d00e  66 0f 38 32 40 06 66 0f 38 00 05 c3 4b 27 00 44  [email protected]'.D
0x7f3353b4d01e  0f b6 40 05 49 c1 e0 28 0f b6 70 04 48 c1 e6 20  [email protected]..(..p.H..
0x7f3353b4d02e  0f b6 78 03 48 c1 e7 18 0f b6 58 02 48 c1 e3 10  ..x.H.....X.H...

Native stacktrace:

        /usr/bin/mono(+0x129f8d) [0x559943af9f8d]
        /usr/bin/mono(+0x12a295) [0x559943afa295]
        /usr/bin/mono(+0xbfd2f) [0x559943a8fd2f]
        /usr/bin/mono(+0x414e8) [0x559943a114e8]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890) [0x7f3360e94890]
        /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so(+0x54100e) [0x7f3353b4d00e]
Pkilling 0x7f335a28f700 from 0x7f3361a63780
Entering thread summarizer pause from 0x7f3361a63780
Finished thread summarizer pause from 0x7f3361a63780.

Waiting for dumping threads to resume


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.
=================================================================

I did run same thing yesterday but then I did use Another computer and did use Xubuntu so does it need a graphic interface??

/UPDATE When I did try with the nightly version of Mono I get no error for "Hello World" script.

Cazz
  • 145
  • 2
  • 9
  • Did you bring any binary from your Xubuntu to the server? The crash happens upon executing a unsupported instruction, as if you tried to run a binary that was initially built on another computer. – Hi-Angel Jan 02 '19 at 17:19
  • Thanks for the replay but no. I did not move any files from Xubuntu, – Cazz Jan 02 '19 at 19:31
  • Call me naive but it looks like you are using a x86-64-linux-gnu lib, and later on using an amd64 binary. I'm not 100% sure Intel binaries and AMD64 binaries contain the same instructions. Care to share `uname -a` – Chris Sullivan Jan 02 '19 at 19:39
  • @ChrisSullivan AMD64 and x86-64 [are kind of synonymous](https://en.wikipedia.org/wiki/X86-64). So, though the crash happens on SIGILL, but it's not that. – Hi-Angel Jan 02 '19 at 19:53
  • here it is "Linux weathersrv 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux" – Cazz Jan 02 '19 at 20:01
  • @Cazz where did you get the `Microsoft.CodeAnalysis.CSharp.dll.so` from? It's not from repository, is it? I can't quite figure where is the bottom and the top of the stacktrace, but I guess it would make sense if that lib have been executed last, and thus have had the "illegal instruction". So here's you culprit. You'd need to rebuild it from source. – Hi-Angel Jan 02 '19 at 20:03
  • I guess it make a dump but where, is a alot of code that show in the terminal – Cazz Jan 02 '19 at 20:08
  • @Cazz Check your needed libs like so `objdump -p /usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so | grep NEEDED`, I'm guessing you are missing a needed lib. – Chris Sullivan Jan 02 '19 at 20:09
  • ok then it show nothing. Is just a basic "Hello World" – Cazz Jan 02 '19 at 20:17
  • why use Mono in 2019 when the official .NET Core has been available for Linux since 2016 – phuclv Sep 29 '21 at 03:41

1 Answers1

0

It looks like your memory was corrupted on this line:

Memory around native instruction pointer (0x7f3353b4d00e):

And the Native Stack Trace shows that referencing the same memory address on this line:

/usr/lib/mono/aot-cache/amd64/Microsoft.CodeAnalysis.CSharp.dll.so(+0x54100e) [0x7f3353b4d00e]

Meaning that it may be an issue with that lib. I looked into the directory and the lib in question is actually named /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so.

Doing objdump -p /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so | grep NEEDED didn't list any dependencies that I could see so I'm doubtful your installation did not fully complete.

So, testing a simple program in terminal can rule out any issues with regards to the mono installation.


Please try the following:

using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

Create the above file and call it hello.cs Then in terminal do this:

mcs -out:hello.exe hello.cs

Then run:

mono hello.exe

If your output is then:

Hello World!
Press any key to exit.

You know that it is not a problem with the mono dependencies or installation but one regarding other binaries on your machine. Probably the libthread.so So to ensure you have those local libraries ...


Since you have mentioned you are using an Ubuntu Server version (a stripped down version) you might need to pull in any gcc/g++ binaries.

sudo apt install build-essential
Chris Sullivan
  • 151
  • 1
  • 3
  • Same error. I try now with install Xubuntu to see if that is somthing with the Ubuntu Server installation. – Cazz Jan 02 '19 at 20:36
  • Try the last solution there by installing (build-essentials) https://packages.ubuntu.com/xenial/build-essential, I think Ubuntu Server is a stripped down version of the every day Ubuntu LTS. – Chris Sullivan Jan 02 '19 at 20:45
  • It Always have it – Cazz Jan 02 '19 at 21:03
  • `docker run -it ubuntu:bionic gcc -v` gives me the output `executable file not found in $PATH"` – Chris Sullivan Jan 02 '19 at 21:16
  • Now I'm not sure what is going on here. I run it now on Xubuntu in Vmware and it still does not workning – Cazz Jan 02 '19 at 21:27
  • Cazz, can you update your question with your source code? Also don't use the `csc` command in their tutorial, use the `mcs` command. – Chris Sullivan Jan 02 '19 at 21:29
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/87772/discussion-between-chris-sullivan-and-cazz). – Chris Sullivan Jan 02 '19 at 21:33
  • 1
    I Think I got it to work when I use the Nightly version?? – Cazz Jan 02 '19 at 23:53