Linux: Mono installation and errors
Asked Answered
E

6

2

Over the past weeks I struggled to get a working Mono installation without success.

I have tried it on Debian6_x64, Debian7_x64 and Ubuntu_12.04_x64. I have installed it using the default mono-complete using apt-get, tried compiling it from GitHub and from alternative repositories. Either with Mono 2.x or 3.x, I followed several tutorials and nothing seems to work.

Unfortunately I don't have the error logs of past installs but at this moment my current situation is:

Ubuntu 12.04 x64


Mono JIT compiler version 3.4.0 (master/250756b Sun Mar  2 15:02:07 EST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

I'm trying to run a c# program I compiled under windows and the error I get currently is:

user@host:/home/pck# mono Program.exe
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/usr/local/lib/mono/4.5/mscorlib.dll' directory.

I've been googling and nothing seems to work. I'd greatly appreciate any advice that could help.

Thanks!

Eucken answered 9/3, 2014 at 17:57 Comment(1)
similar question. Is your application actually targetting the .NET Framework 4.5?Yb
B
2

The best thing to do nowadays is install Ubuntu Trusty 14.04 (LTS), which includes mono 3.2.8 in its default repositories (easy to install through apt-get).

Bloodstock answered 10/3, 2014 at 14:11 Comment(2)
Asking the user to change their OS to get a program to work can't be an acceptable solution. How many other things about their system might break? 12.04 is LTS meaning people who don't like upgrading are expecting to use it from 2014 through 2017.Flocky
Ubuntu 14.04 is also LTSBloodstock
T
1

It's not automatically granted that a C# application developed under Windows will work under Linux, using Mono libraries. This depends on:

  • The libraries used to develop the application under Windows. As far as I know, for example, the libraries used in WPF have no compatibility in Mono. Have a look at this page to check the compatibility of your application.
  • The version of Mono installed. Each version introduces fixes, enhancements and support for new libraries. This means that your program will not work without any problem and you could encounter some errors.

About your issue, it seems that your application expects to find the libraries related to .NET Framework 4.5, but they're not installed. Install the correct version that supports them. Make sure your application doesn't use specific features of Windows platform. In that case, you will have to remove them.

Tacmahack answered 9/3, 2014 at 18:5 Comment(0)
L
1

There's a missing file in the mono 3.4 tarball that causes make install to fail right after it installed the 2.0 binaries. The other versions never get insalled, which is why you are missing 4.5

cd to the unpacked tarball and create the file yourself:

cd */path/to/unpacked*
echo -e '<Project xmlns=<a class="moz-txt-link-rfc2396E" href="http://schemas.microsoft.com/developer/msbuild/2003">"http://schemas.microsoft.com/developer/msbuild/2003">\n    <Import Project="..\Microsoft.Portable.Core.props" />\n    <Import Project="..\Microsoft.Portable.Core.targets" />\n</Project>' > mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets

and then continue as usual (not sure if you have to configure and make again)

./configure --prefix=/opt/mono-3.4
make
make install
Lyda answered 28/5, 2014 at 6:50 Comment(5)
You have some weirdness going on in your echo string (<a class="moz-txt-link-rfc2396E")Yb
@Yb Thanks for checking, but no weirdness. That's just the file content ;)Lyda
nope... definitely weirdness, that's not even valid XML! See here for what the actual content should beYb
I thought the markup looked weird, which is why I was very careful with pasting it here. As it turns out, the website (codeproject) that I copied it from, has it wrong. Thanks for double checking! Not sure if I should edit my answer because I can't test with the content from github atmLyda
+1 @Lyda - This helped me a lot! Don't know why they haven't fixed the tarball yet.Stolen
H
0

What have you done to implement portable code? Are you sure you have no platform-dependencies? Implement a one-liner:

System.Console.WriteLine("OK!");

Remove all unnecessary dependencies and use framework 2.0 (most stable).

If that works, the problem is not the Mono installation on Linux but something in your code.

Hames answered 9/3, 2014 at 18:12 Comment(0)
Z
0

The problem is your mono files are installed in /usr/lib/mono but it is looking for them in /usr/local/lib/mono which doesn't exist.

Copying the whole directory /usr/lib/mono to /usr/local/lib got it working for me.

Zee answered 6/10, 2014 at 11:22 Comment(1)
Or.... make a symlink.. that way if an update process or an app needs either one of the access points both get updated.Naseby
F
0

This set of instructions (not the Ubuntu ones) worked for me in Ubuntu 12.04, I think.

I also cloned from github and followed their ./autogen.sh; make; make install; make check instructions just in case.

Flocky answered 10/6, 2015 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.