roice3 / MagicTile

Non-euclidean Rubik's Cube Analogues
http://www.gravitation3d.com/magictile
MIT License
87 stars 12 forks source link

Build for Linux #26

Open roice3 opened 6 years ago

roice3 commented 6 years ago

The mac version should work, but I wanted to open this issue until I get confirmation from someone. We can track any problems that arise here.

Update: Instructions for running are at http://roice3.org/magictile/downloads/mac.htm

ChristopherKing42 commented 6 years ago

Are there instructions for running on Linux?

chrisbroome commented 6 years ago

I just installed mono using instructions provided here: https://www.mono-project.com/download/stable/#download-lin

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-get update

That went well. From the project root, I ran

xbuild

And it failed with some missing dependencies, so I installed nuget:

sudo apt install nuget

Then I ran

nuget restore

And it downloaded the missing dependencies just fine.

I then issued one final

xbuild

And it happily compiled everything without errors (there were a few warnings, though).

But when I tried running the resulting executable I got this:

$ ./MagicTile/bin/Debug/MagicTile.exe
bash: ./MagicTile/bin/Debug/MagicTile.exe: Permission denied

OK, no big deal. It looks like the executable doesn't have x permission, so I did a simple

chmod +x ./MagicTile/bin/Debug/MagicTile.exe

and it actually ran, albeit with an exception:

$ ./MagicTile/bin/Debug/MagicTile.exe
MainForm initialized.
Menus built.
Failed to load settings.
Could not find file "~/.config/MagicTile v2/settings.xml"
ExceptionHandler caught: Object reference not set to an instance of an object

Ok, so I looked in the ~/.config/MagicTile v2/ folder and indeed there was no settings.xml file.

I eventually tracked down what was causing the Exception to be thrown and the following diff fixes the issue:

diff --git a/MagicTile/MainForm.cs b/MagicTile/MainForm.cs
index 5401b93..e1f0f43 100644
--- a/MagicTile/MainForm.cs
+++ b/MagicTile/MainForm.cs
@@ -354,0 +355 @@ private static void SetLabelColumnWidth( PropertyGrid grid )
+      if (gridViewFieldInfo == null) return;

I'll open a PR for that.

chrisbroome commented 6 years ago

PR https://github.com/roice3/MagicTile/pull/28 opened. Fixed the build issues for me at least.

roice3 commented 6 years ago

Thank you for the contribution @chrisbroome! Sorry to you and @ChristopherKing42... I should have pointed to this page when opening this issue.

http://roice3.org/magictile/downloads/mac.htm

That has a build I made with monodevelop that avoids the exception in SetLabelColumnWidth. I hadn't checked that into the main branch though, so I'll go grab your PR.

roice3 commented 6 years ago

Btw, if either of you are able to verify the pre-built version I have posted works on Linux, I'd appreciate it and will close this issue. I got feedback yesterday that it worked but wasn't loading the puzzles. Hopefully that is fixed now.

chrisbroome commented 6 years ago

The prebuilt version worked just fine for me! I downloaded it, extracted the contents to a folder and ran it with the folowing command:

mono ./MagicTile.exe

Note that on Linux, file systems are usually case sensitive, so the case of the executable name matters. Also, for *nix based platforms like OSX and Linux, you might want to consider distributing prebuilt versions in .tar.gz format so that you can make the .exe files executable in the archive. This would allow the end user to extract the files and just run the exe with ./MagicTile.exe instead of having to use mono ./MagicTile.exe.

Thanks again for your work, and especially for getting MagicTile to work cross-platform! :smile:

ChristopherKing42 commented 6 years ago

I just used wine MagicTile.exe, and it just worked out of the box. It would be nice to include linux instructions (such as where to get wine/mono on Linux) on the website, but still great work.

ChristopherKing42 commented 6 years ago

Also, this means that MagicTile can now be run on Chromebooks using xiwi.

roice3 commented 6 years ago

Thanks guys! I'll look at providing a .tar.gz and Linux-specific links this weekend. I don't understand why a tar would allow running without calling via Mono, but I'm still happy to compress that way. I'll wait to close this issue until I've finished these tasks.

cpeosphoros commented 6 years ago

Works on Mint Sylvia 18.3

mono --arch=32 MagicTile.exe

gives:

Unknown command line option: '--arch=32'

But just

mono MagicTile.exe

works as a charm. Notice the file name is case sensitive.

Sonicpineapple commented 6 years ago

Linux version works fine, except for elliptical puzzles. Unless in the hemisphere disks model, only single coloured rectangles or triangles are shown per face, and the fisheye model shows nothing. The hemisphere disks model still glitches out, and sometimes covers with the opposite colour.

Some faces completely disappear for an instant occasionally on other 2d puzzles, but that's not a functional problem.

Apologies if this should be in a separate issue.