Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
Last active July 8, 2024 08:20
Show Gist options
  • Save JohnnyonFlame/aa75538e7f91669ed22deb6f2c68e9b5 to your computer and use it in GitHub Desktop.
Save JohnnyonFlame/aa75538e7f91669ed22deb6f2c68e9b5 to your computer and use it in GitHub Desktop.
Building Mono 6.0.12.205 for ArmHF (EverSD, RG35XX)

First create an artful lxc container, it's old enough we can use it to quickly cross-build mono for the older glibc available on Evercades.

sudo lxc launch ubuntu:a/armhf armhf-artful
sudo lxc exec armhf-artful bash

Now let's fix artful's repo situation, this release is outside of the usual repositories due to being too old. We'll then install the packages.

sed -i 's$http://ports.ubuntu.com/ubuntu-ports$http://old-releases.ubuntu.com/ubuntu$' /etc/apt/sources.list
apt update && apt-get install git autoconf libtool automake build-essential gettext cmake python3 curl

Now let's fetch, build and package mono.

wget https://download.mono-project.com/sources/mono/preview/mono-6.12.0.205.tar.xz
tar xf mono-6.12.0.205.tar.xz
cd mono-6.12.0.205
./autogen.sh --with-ikvm-native=no --with-csc=mcs --disable-llvm --disable-dependency-tracking --with-mcs-build --prefix=$(pwd)/built
make -j$(( $(nproc) + 1 )) install 

Notable built fragments:

  • bin/mono-sgen, lib/libmono-native.so and lib/libMonoPosixHelper.so: Basic building blocks to run applications.
  • DLLs in lib/mono: Can be used to override incompatible versions, mscorlib.dll and mscorlib.dll.so go together.
    • You can easily take a bunch of DLLs automatically with the following hacky script:
#!/bin/bash

gac="mono-6.12.0.205/built/lib/mono/4.5"
FILES=(
"Mono.Posix.dll"
"Mono.Security.dll"
"System.Configuration.dll"
"System.Core.dll"
"System.Data.dll"
"System.Drawing.dll"
"System.Runtime.Serialization.dll"
"System.Security.dll"
"System.Xml.Linq.dll"
"System.Xml.dll"
"System.dll"
"mscorlib.dll"
)

mkdir -p dlls-copy/
for i in "${FILES[@]}"; do
    LINK=$(
        find "$gac" -name "$i" | while read dlllink
        do
            echo $(realpath "$dlllink")
            break
        done
    )

    if [ "x$LINK" == "x" ]; then
        echo "Skipping $LINK"
        continue
    fi

    FILE=$(readlink -f "$LINK")
    echo "Copying $FILE"
    cp $FILE dlls-copy/
done

An example of application being deployed successfully can be seen here: https://github.com/JohnnyonFlame/FNAPatches/releases/tag/shipwreck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment