Ubuntu 18.04 に mono + llvm をインストールしてみる


Ubuntu 18.04 に mono + llvm をインストールしてみる

目的

Ubuntu 18.04 Ubuntu 18.04 に mono + llvm を本家のリポジトリからインストールしてみる

コンパイル用のパッケージを追加する


$ sudo apt install gcc

提案パッケージ: を追加


$ sudo apt install gcc-7-locales gcc-multilib make autoconf automake libtool flex bison gcc-doc gcc-7-multilib gcc-7-doc libgcc1-dbg libgomp1-dbg
  libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc

MONOをインストールする


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

$ mono -V
Mono JIT compiler version 6.8.0.123 (tarball Tue May 12 15:11:57 UTC 2020)
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:          yes(610)
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

テストコード

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Console.WriteLine ("Hello World!");
    }
}

$ csc hello.cs
$ mono hello.exe
Hello World!

参考にしたのは以下のサイト

How to build WebAssembly C# Apps with the Mono AOT and Windows Subsystem for Linux
How to Install Mono on Ubuntu 18.04