Godot + Mono / C# in Ubuntu Bionic

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bak

I’d like to install Godot with C# on my current Ubuntu “bionic” (18.04).

I’ve been following the instructions in Add instructions for how to install 5.4.X of Mono to get the suggested Mono 5.4.

But Index of /repo/ubuntu/dists/bionic/snapshots only contains Mono version from 10.x upwards.

Is there any way to get Godot + C# to work on Ubuntu bionic?

:bust_in_silhouette: Reply From: Gerardo Gonzalez

Here are the official packages for Ubuntu please check out them:

http://www.mono-project.com/download/stable/

As the OP said, their offcial repo doesn’t have 5.4.x series for ubuntu 18.04.

Kaiyin Zhong | 2018-05-21 16:26

:bust_in_silhouette: Reply From: nonbeing

Here’s how to get Godot with C# to work on Ubuntu 18.04 (Bionic).

First, we have to get the right version of Mono.

As we can see from the Godot downloads page:
Godot Downloads Page
Godot will only work with Mono SDK 5.12.0 only (as of this writing). We can’t install the current/latest version of Mono right away, because Godot won’t work with that. We have to get the old 5.12.0 snapshot of Mono for Ubuntu.

To do this, the Standard Ubuntu Installation Instructions for Mono have to be tweaked to this:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu bionic/snapshots/5.12.0 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

Note the bionic/snapshots/5.12.0 part in that line - that’s how we will force the 5.12.0 snapshot of Mono to install.

Run the above commands in a terminal.

You will probably see a warning like this:

Reading package lists... Done                       
W: Conflicting distribution: https://download.mono-project.com/repo/ubuntu bionic/snapshots/5.12.0 InRelease (expected bionic/snapshots/5.12.0 but got bionic)

Ignore that, it’s just a harmless warning and not an error.

Confirm that your /etc/apt/sources.list.d/mono-official-stable.list file looks exactly like this:

deb https://download.mono-project.com/repo/ubuntu bionic/snapshots/5.12.0 main

You are now ready to install Mono with apt like this:

 sudo apt install -y mono-devel

Once the install has completed, confirm the version of Mono by running mono --version . You should see something similar to:

Mono JIT compiler version 5.12.0.301 (tarball Wed Jul 25 15:43:48 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)

Now download the Mono version of Godot from the Godot Downloads page, and run the executable (Godot_v3.0.6-stable_mono_x11.64 in my case).

You should mono in the version, somewhere in the top right corner of the Godot editor:

enter image description here

Congrats. You have successfully installed Godot with Mono on Ubuntu.

I’m currently on Ubuntu 18.10. I have followed all the instructions here, and am unable to install mono 5.12.0 on my machine.

/etc/apt/sources.list.d/mono-official-stable.list says:

deb https://download.mono-project.com/repo/ubuntu bionic/snapshots/5.12.0 main

When I attempt to install mono-devel, I get:

sudo apt install mono-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mono-devel : Depends: mono-runtime (>= 3.0~) but it is not going to be installed
              Depends: libc6 (>= 2.27) but 2.26-0ubuntu2.1 is to be installed or
                       libc6.1 (>= 2.27) but it is not installable or
                       libc0.1 (>= 2.27) but it is not installable
              Depends: libglib2.0-0 (>= 2.56.1) but 2.54.1-1ubuntu1 is to be installed
              Depends: libmono-cecil-private-cil (>= 5.12.0.301) but it is not going to be installed
              Depends: libmono-cecil-private-cil (< 5.12.0.302) but it is not going to be installed

followed by a whole lot more equivalent stuff. I have tried turning off my other repositories, and still get the same result.

It looks like the problem is that everything mono is trying to do is depending on libc6 >= 2.27, and ubuntu has libc6 2.26, but I’m not sure if that’s the root of the problem or not.

maquis | 2019-03-12 04:24