Page 1 of 2

FreeTrainSDL on Linux

PostPosted: Tue Mar 18, 2008 10:15 pm
by jendave
Here is a quick guide to get FreeTrainSDL compiled and running on Linux.

I have been able to get FreeTrainSDL to compile and run on my Linux Debian unstable (sid) setup using Mono 1.2.6 and MonoDevelop 0.19.

  • Install Mono - at least version 1.2.6
  • Install MonoDevelop - at least version 0.14, preferably 0.19
  • Install SVN to check out code from Sourceforge. You want the FreeTrainSDL branch.
  • Install libSDL, libSDLMixer, libSDLImage, libSDLgfx, smpeg. Note that the libSDL must be the libSDL-all package. Debian will install the Alsa package by default. This will cause the FreeTrainSDL to crash upon startup.
  • Open MonoDevelop.
  • Right-click on the FreeTrainSDL project and set it to be the default startup project.
  • Right click on the FreeTrain solution file and select "build" to compile the project
  • Click on the "Run icon from the MonoDevelop toolbar (looks like a pair of gears). This will run FreeTranSDL.

Feel Free to add to this quick doc.

Thanks
Dave

Re: FreeTrainSDL on Linux

PostPosted: Sat Mar 22, 2008 7:23 pm
by freegamer
  Code:
Building Project: FreeTrain.Core (Debug|Any CPU)
Performing main compilation...

ERROR: MonoDevelop could not find the Gtk# 2.0 development package. Compilation of projects depending on Gtk# libraries will fail. You may need to install development packages for gtk-sharp-2.0.

Build failed. /home/charles/Games/freetrain-svn/plugins/system/plugin.xml does not exist

I looked and the dir name is 'System'. Having seen a couple of commits having to address the problem of case sensitivity, I think we need to have a policy on it to reduce the chances of it being a problem in the future. Once it is decided, one of us should go through it and rename everything (except the class files) according to the policy we choose.

I personally believe that everything that is a resource that is not a class file should be in lower case. I think that's simple and totally unambiguous.

Re: FreeTrainSDL on Linux

PostPosted: Sat Mar 22, 2008 9:47 pm
by freegamer
Ok I renamed System->system (committed) and it gets further now but spits out a lot of not-looking-good warnings (or errors?) when building but seems to get all the way through.

Running it, though, comes up with this error:
  Code:
Unhandled Exception: System.Resources.MissingManifestResourceException: Could not find any resource appropriate for the specified culture or its parents. Make sure "FreeTrain.Properties.Resources.resources" was correctly embedded or linked into assembly "FreeTrain".
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x00153] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:372
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x001f3] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:401
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x001f3] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:401
  at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x00027] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:246
  at System.Resources.ResourceManager.GetString (System.String name) [0x00000] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:232
  at FreeTrain.Util.Translation.GetString (System.String code) [0x00000] in /home/charles/Games/freetrain-svn/core/util/Translation.cs:38
  at FreeTrain.FreeTrainSDL.Go () [0x000dd] in /home/charles/Games/freetrain-svn/Program.cs:322
  at FreeTrain.FreeTrainSDL.Main () [0x00006] in /home/charles/Games/freetrain-svn/Program.cs:293

Re: FreeTrainSDL on Linux

PostPosted: Sun Mar 23, 2008 1:41 pm
by freegamer
After updating SVN this morning, trying to open the FreeTrainSDL project produces the following complaint:

monodevelop-error1.png
monodevelop-error1.png (18.18 KiB) Viewed 41774 times


Here's the copy/paste of the text:
  Code:
Error while trying to load the project /home/charles/Games/freetrain-svn/core/FreeTrain.Core.csproj. Exception : Unknown file format: /home/charles/Games/freetrain-svn/core/FreeTrain.Core.csproj

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 12:11 am
by freegamer
I edited the top post to include a link to the branch.

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 3:34 pm
by jendave
Please remove you local copy and check out a fresh copy. I had rearranged some of the projects. Can you update to Mono 1.2.6? I know earlier versions had problems with resources.

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 3:46 pm
by freegamer
Ah ok, back to the previous error, posted again for simplicity:
  Code:
Unhandled Exception: System.Resources.MissingManifestResourceException: Could not find any resource appropriate for the specified culture or its parents. Make sure "FreeTrain.Properties.Resources.resources" was correctly embedded or linked into assembly "FreeTrain".
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x00153] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:372
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x001f3] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:401
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean Createifnotexists, Boolean tryParents) [0x001f3] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:401
  at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x00027] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:246
  at System.Resources.ResourceManager.GetString (System.String name) [0x00000] in /builddir/build/BUILD/mono-1.2.5.1/mcs/class/corlib/System.Resources/ResourceManager.cs:232
  at FreeTrain.Util.Translation.GetString (System.String code) [0x00000] in /home/charles/Games/svn/FreeTrainSDL/core/util/Translation.cs:38
  at FreeTrain.FreeTrainSDL.Go () [0x000dd] in /home/charles/Games/svn/FreeTrainSDL/Program.cs:322
  at FreeTrain.FreeTrainSDL.Main () [0x00006] in /home/charles/Games/svn/FreeTrainSDL/Program.cs:293

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 4:54 pm
by freegamer
jendave wrote:Can you update to Mono 1.2.6? I know earlier versions had problems with resources.

Just had a look and it's not trivial to update to 1.2.6 on Fedora8 (which I'm currently using). However I have an Ubuntu partition running Hardy Heron so I will try when I next get a chance to boot into this.

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 8:19 pm
by jendave
There is a resource bug in Monodevelop 0.13 which I believe is the latest version for Fedora 8. Winform resources in VS2005 projects do not have the correct namespace and cqause problems. This was fixed in MD 0.14.

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 8:26 pm
by jendave
Linux build finally works!!!! I fixed up numerous bugs (casing/Pathing issues, a Windows dependecy, null checking issues) and got FreeTrain to work on Linux. The buttons on the main window all work and I was able to lay track, create some structures, modify terrain, create stations etc. The trains would move along their tracks as well.

I will start looking at the Mac OSX port now.

Re: FreeTrainSDL on Linux

PostPosted: Mon Mar 24, 2008 9:53 pm
by stevenh
*cheers*
Congrats Dave, such quick outcome... will install debian in a virtual machine tonight and see how far I can get :)

... Mac OS X? I didn't even know Mono was ported!

Re: FreeTrainSDL on Linux

PostPosted: Tue Mar 25, 2008 12:29 am
by freegamer
Great work Dave, awesome. I really need to test it. (Sidenote: I can't believe how out of date and hard to upgrade Mono on Fedora is!)

Before we can do a release, what would you guys say needs doing? Obviously a release would get a lot of new exposure for the project and hopefully some contributors.

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 7:51 pm
by freegamer
Ok I have an upgrade path for Mono on Fedora now, although it uses the openSuSE repos:
http://www.fedoraforum.org/forum/showpo ... ostcount=3

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 8:28 pm
by freegamer
Ok, getting further. Crikey MonoDevelop is flakey, still managed to get to the point that it was running (window with logo) although too many plugin loading errors.

I was having issues with missing translations so committed nicer behaviour for that.

Edit -- for some reason it was still running an old version of monodevelop (0.13) but now it's definitely updating so the flakiness was probably that.

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 8:54 pm
by freegamer
At the moment it's complaining about this:
  Code:
[Task:File=/home/charles/Games/svn/FreeTrainSDL/lib/Controls/ColorPickButton.resx, Line=0, Column=0, Type=Error, Priority=Normal, Description=ApplicationName='resgen2', CommandLine='/compile "/home/charles/Games/svn/FreeTrainSDL/lib/Controls/ColorPickButton.resx"', CurrentDirectory='/home/charles/Games/svn/FreeTrainSDL/lib/Controls']

What a delightfully ambiguous error. WTF is the actual problem !?

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 10:06 pm
by jendave
Do you have the mono-devel package installed?

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 10:15 pm
by freegamer
Bingo, thanks jendave. (Actually got the answer at the same time from #mono on irc.gnome.org - still, rubbish error.)

Edit: ok, back to the plugin errors I can't take a screenshot as it crashes when I press 'alt'. Is it me or is Mono really, really unfinished?

Re: FreeTrainSDL on Linux

PostPosted: Wed Mar 26, 2008 10:32 pm
by stevenh
Does it say error loading plugin?
I always get that on Windows when I only build the core and expect the plugins to play happily with the version increment...
The goal is to always rebuild the entire project if you change anything in core, etc... and if you haven't successfully built it all in one hit yet then try an entire rebuild of the solution.
...Not that I've tried *nix yet. :)

Re: FreeTrainSDL on Linux

PostPosted: Thu Mar 27, 2008 8:02 pm
by freegamer
I get this now, basically several (all?) plugins throwing an XmlException, before the game declares too many plugin errors and quits, which all look pretty much like this which is the first one:

XmlException.png
XmlException.png (65.27 KiB) Viewed 41652 times

Re: FreeTrainSDL on Linux

PostPosted: Fri Mar 28, 2008 2:19 am
by freegamer
Ok those plugin errors were caused by empty xml files. Which I'd expect to throw an error. However I wouldn't have expected the xml files to be empty in the first place - how bizarre? I suspect an older version of MonoDevelop (0.13?) nuked them for some unknown reason during compilation - for sure, I have *not* touched them.

Anyway, so, wow it gets somewhere, shows a screen with land / windows momentarily, then crashes:
  Code:
Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Windows.Forms.MdiClient.ActivateChild (System.Windows.Forms.Form form) [0x00045] in /usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:702
  at System.Windows.Forms.MdiClient.set_ActiveMdiChild (System.Windows.Forms.Form value) [0x00000] in /usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:953
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.MdiClient:set_ActiveMdiChild (System.Windows.Forms.Form)
  at System.Windows.Forms.MdiClient+ControlCollection.Add (System.Windows.Forms.Control value) [0x00049] in /usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:81
  at System.Windows.Forms.Form.set_MdiParent (System.Windows.Forms.Form value) [0x00079] in /usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:923
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:set_MdiParent (System.Windows.Forms.Form)
  at FreeTrain.FreeTrainSDL.Go () [0x004b6] in /home/charles/Games/svn/FreeTrainSDL/Program.cs:422
  at FreeTrain.FreeTrainSDL.Main () [0x00006] in /home/charles/Games/svn/FreeTrainSDL/Program.cs:319


Since I suspect this is a Mono bug and not a FreeTrain bug (if it is, it's unclear how we are misusing the Mdi API), I filed a report here:
https://bugzilla.novell.com/show_bug.cgi?id=374663