Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install Mono on ev3dev? #8

Open
BeefyAndTheDucks opened this issue Dec 17, 2023 · 7 comments
Open

How to install Mono on ev3dev? #8

BeefyAndTheDucks opened this issue Dec 17, 2023 · 7 comments

Comments

@BeefyAndTheDucks
Copy link

I know this might be a dumb question, but how do you install Mono on a ev3dev?
Thanks in advance :)

@alex-ks
Copy link
Owner

alex-ks commented Dec 20, 2023

The way I had used was simply via apt: https://www.mono-project.com/download/stable/#download-lin-debian, the package mono-complete just to be sure that everything is present.

The problem is that Mono has not been supporting armel architecture (which the EV3 processor is) since 5.16 release, so newer versions even cannot be installed =( But you can try to downgrade the package version via apt. Unfortunately, I do not have EV3 right now to check if this still works

@alex-ks
Copy link
Owner

alex-ks commented Jan 9, 2024

It seems like the default apt repositories in ev3dev has been broken since Debian archived the stretch repos. So some preparations should be done:

sudo sed -i 's|security.debian.org|archive.debian.org/debian-security|g' /etc/apt/sources.list
sudo sed -i 's|httpredir.debian.org|archive.debian.org|g' /etc/apt/sources.list

This will fix the dependencies. After that, you can execute the mono install instructions with small modifications:

sudo apt install dirmngr ca-certificates gnupg apt-transport-https
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/debian stretch/snapshots/5.14.0.177 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

These instructions contain additional apt-transport-https required for using https links to repos and link to mono snapshot 5.14.0.177 instead of the main branch.

@GrimRaven0815
Copy link

How did you manage to install mono with battery power? Just installing the mono-roslyn package takes so long on my system that the battery power runs out. If I start the installation again with a fresh batteries, it continues with package mono-roslyn until the batteries are empty again. The installation is never finished. I've already tried to compile mono myself, but the file „method-to-ir.c“ takes so long to compile that even then the battery power runs out. Whatever I try cannot be completed with fully charged batteries. Do you have a tip for me?

Thanks in advance!

@alex-ks
Copy link
Owner

alex-ks commented Dec 14, 2024

Actually, I couldn't install any 5.* version of mono on device because of just the same problem as yours. Looks like installing the mono-roslyn package requires so many RAM that it goes to the swap and becomes insanely slow. As far as I've tested, any 4.* version can be installed just fine, but you lose some language features with it.

The solution I came to is to create your own system image of ev3dev with preinstalled mono. You need to create custom docker image based on the ev3dev official images and flash it using brickstrap tool. I wrote an instruction with detailed steps.

During the instruction preparation I've found two problems:

  • mcs is not working on device. But it seems like you can compile your source code elsewhere and transfer the binaries via scp and it works just fine
  • apt update returns error for mono repository. It's not a big deal since the installed mono version will not get updates anyway, but looks like it will persist for other hand-added package repositories

I'll try to find a solutions if possible.

@GrimRaven0815
Copy link

Hi! Thanks for the instructions. However, an error occurs while preparing the base image using the command:
sudo docker build -t ev3dev/ev3dev-stretch-ev3-base -f ev3-base.dockerfile .

The error is:

> [4/6] RUN /brickstrap/base/run:
0.123 exec /bin/sh: exec format error
------
ev3-base.dockerfile:6
--------------------
   4 |     COPY layers/debian/ /
   5 |     COPY layers/base/ /
   6 | >>> RUN /brickstrap/base/run
   7 |     COPY layers/ev3/ /
   8 |     RUN /brickstrap/ev3/run
--------------------
ERROR: failed to solve: process "/bin/sh -c /brickstrap/base/run" did not complete successfully: exit code: 255

It seems to be related to the architecture, which of course doesn't match. Tested with Debian 12 and Ubuntu 22.04.1.
I'm starting to think I'll never be able to use mono on the EV3.

@GrimRaven0815
Copy link

I managed to build the base image by running this first:
docker run --rm -it --privileged torizon/binfmt
See https://developer.toradex.com/torizon/application-development/working-with-containers/configure-build-environment-for-torizon-containers/#enable-arm-emulation

But now the generic images fails to build because of package ca-certificates-java. The error is:
E: /etc/ca-certificates/update.d/jks-keystore exited with code 1.

I am still searching for a solution.

@GrimRaven0815
Copy link

I created an image with mono using the ev3dev base image. I prefer using the full image, but for now this is all I need. Thanks again for the instruction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants