Getting G-WAN to work with Mono - c#

I have followed the instructions on the G-WAN site FAQ and read through the manual, but I can not get G-WAN to "see" the Mono installation on my Debian 6 (x64) setup.
I have tried with the recommended Mono version (3.0.2) and the latest(3.0.4).
I am using the latest (today's) version of G-WAN.
Have I missed some configuration (e.g. environment variables...) or do I need to run Mono as a daemon?

mono by default installs on "/usr/local".
Compiling mono 3.0.6 using
./configure --prefix=/usr
make
make install
Worked for me. It will install libmono*.so on "/usr/lib"

G-WAN searches libmono*.so under /usr/lib and then links dynamically with it to compile C# scripts.
If you have installed Mono elsewhere then you should either provide links or re-build and install Mono (from source code) in the proper directory (which is simpler to do).
You can verify where Mono is installed by running:
find -L /usr/lib -name 'libmono*.so'
/usr/lib/libmono-2.0.so

Related

Build mono for detecting runtime memory leakcage (in sources) for Linux

I had some problems with mono on linux. My application, which was build with c# on windows doesn't leak, but with mono I have different situation. After searching mono site I found this post, I build and install it (without asan). After I downloaded mono sources, used mono 5.8. And build It with flags for detecting memory leakage and set path :
# Ensure that all required packages are installed.
sudo apt-get install git autoconf libtool automake build-essential gettext cmake python
./autogen.sh --prefix=/usr/local --with-malloc-mempools=yes
make get-monolite-latest
make
make install
After building and installing, I run My application with
mono --profile=malloc:log-malloc ATS_RW_PTD.exe
And get result:
The 'malloc' profiler wasn't found in the main executable nor could it be loaded from 'mono-profiler-malloc'.
I can't understand where I'm wrong and which profile I have to use. Is it step by step instruction for runtime memory leakage detection in mono?

How to install MSBuild on OS X and Linux?

I'm looking to install MSBuild on my Linux laptop so I can build a C# OSS project of mine. How exactly would I go about doing this? I've come across a few guides such as this which suggest installing the MSBuild NuGet package, but it doesn't seem official or actively maintained.
Is there an official package source I can install MSBuild from?
Yes, there is such a package hosted by the CoreFX team as a MyGet feed. To install, run this at a terminal:
#!/bin/sh
packageid="Microsoft.Build.Mono.Debug"
version="14.1.0.0-prerelease" # update as needed
mono path/to/nuget.exe install $packageid -Version \
$version -Source "https://www.myget.org/F/dotnet-buildtools/"
# run MSBuild
mono $packageid.$version/lib/MSBuild.exe Foo.sln
Technically this should be used only for building the .NET Core repos, but I'll take it as an alternative to an unofficial publisher.
Source.
EDIT: Note that this will only work if your version of Mono is 4.0.1 or above.
A pretty easy way to do it now is using the dotnet docker images:
https://hub.docker.com/_/microsoft-dotnet-sdk/
https://github.com/dotnet/dotnet-docker/blob/main/samples/build-in-sdk-container.md

MonoDevelop 5.0 for Linux Distro?

According to the official website, Mono now supports System.Speech (in 5.0) . However, I am unable to reach a linux build of version 5.0
"Packages for MonoDevelop 5.0.0.878 not yet available. The latest available version is MonoDevelop 4.2.1"
Is there any way of achieving this? (tarballs, git?)
Notes
I am using ArchLinux
The best way to use the last monodevelop on Linux is to get it from git (it's very fast and very easy :)
Now I'm using it (5.1) on Ubuntu 14.04.
You can get the source code from here:
git clone git://github.com/mono/monodevelop.git
and then compile it: http://monodevelop.com/developers/building_monodevelop
Remember that you must have installed Mono runtime 3.x.
I am answering this a little earlier but i think it applies right now too because Xamarin have already provided Mono 3.6.0 builds(technical preview) for Debian and derivatives.And with in a few months the best way to get anything latest related to mono will be from Xamarin official builds.They will provide Mono and some important applications including Monodevelop for every Debian and Centos derived Linux distributions.
See this link......
mono builds for many Linux distributions
Having just built Monodevelop the hard way, I would recommend downloading a tarball from http://download.mono-project.com/sources/monodevelop/ as everything is already included and requires no additional downloads except the some apt-get installs.
If you really want to use the git repo here is how to fix the two major issues I had.
1) I'm behind a proxy so I had to edit git module files to not use the git protocol as described in this post https://stackoverflow.com/a/11410074/1516326
2) You have to Import the Mozilla LXR certificates for Mono, so NuGet can update correctly, using:
mozroots --import --sync
For the entire process follow these instructions: http://www.monodevelop.com/developers/building-monodevelop/

Linux: Mono installation and errors

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!
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).
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.
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
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.
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.
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.

How to run .NET 4.5 on XSP using Mono?

I have installed Mono 3 however when I run xsp or xsp4 it shows that I'm using .NET 4.0. I need to have .NET 4.5. Is it possible? Where can I configure it?
I've seen this page but I don't have any of those folders where I downloaded sources.
This is what it shows when I enter website by running xsp4:
Version Information: 3.2.7 (master/1eef047 C nov 28 18:16:30 EET 2013); ASP.NET Version: 4.0.30319.17020
How I installed Mono and XSP
Firstly I downloaded Lubuntu 13.10 32bit and launched it inside VirtualBox. Then did apt-get update and apt-get upgrade. After that rebooted the system.
Make sure all commands are executed as super user.
sudo -s
Got dependencies
apt-get install autoconf automake libtool g++ gettext libglib2.0-dev libpng12-dev libfontconfig1-dev mono-gmcs git
Downloaded sources of Mono and XSP
cd /opt
git clone git://github.com/mono/mono.git
git clone git://github.com/mono/xsp.git
Installed latest stable Mono from github
cd /opt/mono
./autogen.sh --prefix=/usr
make
make install
Installed latest stable XSP from github
cd /opt/xsp
./autogen.sh --prefix=/usr
make
make install
Tested that I have 4.0 running on XSP instead of 4.5
cd /home/pc/web
xsp4 # 4.0
xsp2 # 2.0
xsp # 2.0
My configuration
/usr/bin/xsp4 looks like it should use 4.5. Just like this answer suggested. Also, I don't have xsp4.exe in my /usr/lib/mono/4.0/ only in /usr/lib/mono/4.5/ so I cannot copy anything like suggested in that answer.
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.5/xsp4.exe" "$#"
You say "I don't have any of those folders where I downloaded sources" referring to /opt/mono/bin/xsp4. But you're confusing things, and I know it because you shared how you installed mono.
/opt/mono should not be the place where you clone the mono repository to compile it. You should clone it somewhere else like your home folder. I.e.: /home/username/code/mono.
/opt/mono is where usually people install a custom version of mono. The way they do it is passing this path to the --prefix argument. But you're passing /usr as the prefix argument! So then you're installing it to a different location compared to the SO answer that you point out.
Also, it is not recommended that you do ALL those operations as a superuser. You normally compile code without root privileges, and you only need sudo for the install phase. So don't do "sudo -s" before everything. Just compile, and when you're done, do sudo make install. This will also make you have binaries that are not owned by root.

Categories

Resources