xenovacivus / PathCAM

PathCAM - Toolpath generation software for CNC robots!
GNU General Public License v3.0
213 stars 62 forks source link

Ubuntu instructions in readme do not work now. #21

Open neocogent opened 5 years ago

neocogent commented 5 years ago

Tried this and failed with xbuild step. 124 errors all seem to be related to missing types, eg.

... CSC: error CS0518: The predefined typeSystem.IntPtr' is not defined or imported ...`

When installing with apt-get I get notice that mono-gmcs is missing or obsolete:

Package mono-gmcs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However, the following packages replace it:
  mono-xbuild mono-mcs mono-devel

mono-devel and mono-mcs both show as installed.

This is on Mint 19 based on Ubuntu 18.04.

I'm not at all familiar with Mono but have good skills in Linux. Is there some way to get this working now?

xenovacivus commented 5 years ago

I tried on a clean Ubuntu 18.10 install and got the same error - fortunately the fix is pretty simple. I guess mono has the .NET framework version 4.5, but not 4.0. To override the default framework version (normally specified in the .sln file), use this for xbuild:

xbuild /p:TargetFrameworkVersion="v4.5"

Give that a shot; it might require a different framework version on your Mint build, but it's probably v4.5 as well.

neocogent commented 5 years ago

Thanks for the info. I tried it and it did build ok. It gave 40 warnings but no errors.

However, when I try to run it fails with an error related to version. Maybe there is a new command that tells it to use v4.5?

Here's the dump when running command,

mono GUI/bin/Debug/PathCAM.exe
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
X11 Error encountered: 
  Error: BadMatch (invalid parameter attributes)
  Request:     154 (5)
  Resource ID: 0x9600020
  Serial:      243
  Hwnd:        Hwnd, Mapped:False ClientWindow:0x9600020, WholeWindow:0x960001F, Zombie=False, Parent:[<null>]
  Control:     GUI.Drawing3D  at System.Environment.get_StackTrace () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Windows.Forms.XplatUIX11.HandleError (System.IntPtr display, System.Windows.Forms.XErrorEvent& error_event) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at OpenTK.Platform.X11.Glx.MakeCurrent (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Platform.X11.Glx.MakeCurrent (System.IntPtr display, System.IntPtr drawable, OpenTK.ContextHandle context) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00000] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at OpenTK.GLControl.OnHandleCreated (System.EventArgs e) [0x00000] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at System.Windows.Forms.Control.WmCreate (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.XplatUIX11.SendMessage (System.IntPtr hwnd, System.Windows.Forms.Msg message, System.IntPtr wParam, System.IntPtr lParam) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.XplatUIX11.CreateWindow (System.Windows.Forms.CreateParams cp) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams cp) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams cp) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control.CreateHandle () [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control.CreateControl () [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at OpenTK.GLControl.ValidateState () [0x00000] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00000] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at GUI.Drawing3D.set_ClearColor (System.Drawing.Color value) [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM.InitializeComponent () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM..ctor () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.Program.Main () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 

OpenTK.Graphics.GraphicsContextException: Failed to make context current.
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x0010e] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00017] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at OpenTK.GLControl.OnHandleCreated (System.EventArgs e) [0x0007a] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at System.Windows.Forms.Control.WmCreate (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001d7] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x0003c] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m) [0x00036] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
X11 Error encountered: 
  Error: BadMatch (invalid parameter attributes)
  Request:     154 (5)
  Resource ID: 0x9600020
  Serial:      261
  Hwnd:        Hwnd, Mapped:True ClientWindow:0x9600020, WholeWindow:0x960001F, Zombie=False, Parent:[<null>]
  Control:     GUI.Drawing3D  at System.Environment.get_StackTrace () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Windows.Forms.XplatUIX11.HandleError (System.IntPtr display, System.Windows.Forms.XErrorEvent& error_event) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0 
  at OpenTK.Platform.X11.Glx.MakeCurrent (System.IntPtr , System.IntPtr , System.IntPtr ) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Platform.X11.Glx.MakeCurrent (System.IntPtr display, System.IntPtr drawable, OpenTK.ContextHandle context) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00000] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at GUI.Drawing3D.set_ClearColor (System.Drawing.Color value) [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM.InitializeComponent () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM..ctor () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.Program.Main () [0x00000] in <7bb30ae022d9485bba76b05e54d6dd08>:0 

Unhandled Exception:
OpenTK.Graphics.GraphicsContextException: Failed to make context current.
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x0010e] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00017] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at GUI.Drawing3D.set_ClearColor (System.Drawing.Color value) [0x00014] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at (wrapper remoting-invoke-with-check) GUI.Drawing3D:set_ClearColor (System.Drawing.Color)
  at GUI.PathCAM.InitializeComponent () [0x0061c] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM..ctor () [0x00047] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at (wrapper remoting-invoke-with-check) GUI.PathCAM:.ctor ()
  at GUI.Program.Main () [0x0000c] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: OpenTK.Graphics.GraphicsContextException: Failed to make context current.
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x0010e] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo window) [0x00000] in <5c487d0493a3443b8b6e3ad2f7883ea9>:0 
  at OpenTK.GLControl.MakeCurrent () [0x00017] in <d945ecfa2f964ea296cf28f4a03910c1>:0 
  at GUI.Drawing3D.set_ClearColor (System.Drawing.Color value) [0x00014] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at (wrapper remoting-invoke-with-check) GUI.Drawing3D:set_ClearColor (System.Drawing.Color)
  at GUI.PathCAM.InitializeComponent () [0x0061c] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at GUI.PathCAM..ctor () [0x00047] in <7bb30ae022d9485bba76b05e54d6dd08>:0 
  at (wrapper remoting-invoke-with-check) GUI.PathCAM:.ctor ()
  at GUI.Program.Main () [0x0000c] in <7bb30ae022d9485bba76b05e54d6dd08>:0
xenovacivus commented 5 years ago

I tried Mint 19.1 Cinnamon, and it builds (with the same 40 warnings, 0 errors), and seems to run OK. It launches with the same "The runtime version supported by this application is unavailable. Using default runtime: v4.0.30319".

It could be related to the window manager, maybe the xfce or mate version don't work? Also it looks like an OpenTK related issue (OpenTK handles the OpenGL abstraction), similar to this one: https://github.com/opentk/opentk/issues/108

The issue could be specific to your hardware configuration (and I'm testing in a virtual machine, so I might not be able to replicate). In which case, changing the graphics selection might help. In GUI/Drawing32.cs line 28, change this:

public Drawing3D() to public Drawing3D() : base(new OpenTK.Graphics.GraphicsMode(OpenTK.DisplayDevice.Default.BitsPerPixel, 24))

Then rebuild with xbuild /p:TargetFrameworkVersion="v4.5" and try the .exe again. If it doesn't work, try forcing the first parameter of GraphicsMode to 24 or 32. public Drawing3D() : base(new OpenTK.Graphics.GraphicsMode(24, 24)) public Drawing3D() : base(new OpenTK.Graphics.GraphicsMode(32, 24))

If any of those do work, you might also try OpenTK.Graphics.GraphicsMode(32, 24, 0, 8) which enables 8x anti-aliasing (supported by most modern graphics cards), and will make the UI look a bit better.

neocogent commented 5 years ago

Thank you again for your efforts. I made that change (presume meant Drawing3D.cs not Drawing32.cs) and after build it runs ok. I have a screen with red and green arrows. Yay! I have not tried anything further yet.

Incidentally I am on Cinnamon as well but my laptop has Nvidia Geforce 710M GPU built in. Maybe that makes a difference. I added a menu item and can start from there now.

All good I think. Will try to figure out how to use now. Just near end of Root 3 CNC build.

Thanks again.

NickStallman commented 3 years ago

I hit this issue as well, Ubuntu 20.04 with nVidia graphics and the tweak to public Drawing3D() did the trick as well.