New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems running under Linux mono #14

Open
thatch opened this Issue Mar 17, 2017 · 20 comments

Comments

Projects
None yet
8 participants
@thatch

thatch commented Mar 17, 2017

It's my first time trying to run the tools, and I uncovered an error when running in the obvious way on Linux. This occurs under both older Ubuntu (mono 3.2.8) and recent Arch (mono 4.8.0). The same release works fine under Windows 10. I haven't looked into whether previous GerberTools releases behave any better though.

$ cd GerberTools_2017_2_17/Panelizer
$ mono GerberPanelizer.exe

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: XOR data length expected 2046820352, read 1370
Parameter name: stream
  at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream, Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at System.Drawing.Icon..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type exp_type) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.LoadResourceValues (ResourceCacheItem[] store) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.GetEnumerator () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.ReadResources () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.GetObjectInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.RuntimeResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.GetObject (System.String name, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.GetObject (System.String name) [0x00000] in <filename unknown>:0 
  at GerberCombinerBuilder.GerberPanelizerParent.InitializeComponent () [0x00000] in <filename unknown>:0 
  at GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) GerberCombinerBuilder.GerberPanelizerParent:.ctor ()
  at GerberCombinerBuilder.Program.Main () [0x00000] in <filename unknown>:0 
@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Mar 17, 2017

I read the note at http://blog.thisisnotrocketscience.nl/projects/pcb-panelizer/ that says

  1. command line tools should work, which I did not check.
  2. that I'd need to "replace the openTK dll with the mono version" but unsure what that entails, as I'm not that familiar with Mono.

(The readme says "should work" without restriction though, so I tried the GUI first.)

I took a look at the source and this is related to loading an ico file. I'm not sure which yet.

thatch commented Mar 17, 2017

I read the note at http://blog.thisisnotrocketscience.nl/projects/pcb-panelizer/ that says

  1. command line tools should work, which I did not check.
  2. that I'd need to "replace the openTK dll with the mono version" but unsure what that entails, as I'm not that familiar with Mono.

(The readme says "should work" without restriction though, so I tried the GUI first.)

I took a look at the source and this is related to loading an ico file. I'm not sure which yet.

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Mar 18, 2017

The last line when running strce is an attempt to open GerberPanelizer.resources.dll (ENOENT), which makes me think it's attempting to load a PE resources from itself. It appears that the icons in the release zip are all a format with valid headers, but then the entries all start with "\x89PNG". I don't see code to load this in https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/System.Drawing/Icon.cs (but there's a patch on https://bugzilla.xamarin.com/show_bug.cgi?id=30715 that does).

I'll try swapping out the icon resources and running again; I assume the normal build requires Visual Studio, and there isn't a commandline build script that works on Linux?

thatch commented Mar 18, 2017

The last line when running strce is an attempt to open GerberPanelizer.resources.dll (ENOENT), which makes me think it's attempting to load a PE resources from itself. It appears that the icons in the release zip are all a format with valid headers, but then the entries all start with "\x89PNG". I don't see code to load this in https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/System.Drawing/Icon.cs (but there's a patch on https://bugzilla.xamarin.com/show_bug.cgi?id=30715 that does).

I'll try swapping out the icon resources and running again; I assume the normal build requires Visual Studio, and there isn't a commandline build script that works on Linux?

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Mar 18, 2017

Replacing it with Resource Hacker was insufficient to get it running under mono -- I'm not sure which icon it's loading quite yet (it's either something mmap'd or read over IPC, as there's no read containing 'PNG' nearby). I checked and the command line utilities do work, so perhaps the readme should just be adjusted to be more specific in the meantime?

thatch commented Mar 18, 2017

Replacing it with Resource Hacker was insufficient to get it running under mono -- I'm not sure which icon it's loading quite yet (it's either something mmap'd or read over IPC, as there's no read containing 'PNG' nearby). I checked and the command line utilities do work, so perhaps the readme should just be adjusted to be more specific in the meantime?

@StijnKuipers

This comment has been minimized.

Show comment
Hide comment
@StijnKuipers

StijnKuipers Mar 18, 2017

Member

I'll test it on a linux vm - see if I can fix this somehow. If it really only is the PNG stuff it should be a relatively simple fix. Did you try running mono with that patch? Very odd that png streams are not supported in this particular way.

So far I've only built it on Visual Studio - if somebody wants to make/maintain a buildscript for other systems - be my guest. I will personally not make/maintain one - another support headache.

Member

StijnKuipers commented Mar 18, 2017

I'll test it on a linux vm - see if I can fix this somehow. If it really only is the PNG stuff it should be a relatively simple fix. Did you try running mono with that patch? Very odd that png streams are not supported in this particular way.

So far I've only built it on Visual Studio - if somebody wants to make/maintain a buildscript for other systems - be my guest. I will personally not make/maintain one - another support headache.

@StijnKuipers StijnKuipers added the bug label Mar 18, 2017

@StijnKuipers StijnKuipers self-assigned this Mar 18, 2017

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Apr 6, 2017

With the patch it gets slightly further,

Unhandled Exception:
System.InvalidCastException: Specified cast is not valid.
  at System.Drawing.Icon.SaveBestSingleIcon (System.IO.BinaryWriter writer, System.Int32 width, System.Int32 height) [0x000b0] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.Save (System.IO.Stream outputStream, System.Int32 width, System.Int32 height) [0x00031] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.GetInternalBitmap () [0x00029] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.ToBitmap () [0x0001b] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:ToBitmap ()
  at System.Windows.Forms.XplatUIX11.SetIcon (System.Windows.Forms.Hwnd hwnd, System.Drawing.Icon icon) [0x00021] in <e37081a3704b4473a59cdf5048ad96bc>:0 

I then hacked up GetInternalBitmap to do

if (imageData[0] is PNGImage) {
  bitmap = ((PNGImage)imageData[0]).png;
} else ...

and it gets further. It launches and has a valid icon, but then when using File->New it crashes in OpenTK saying "The specified window isn't an OpenGL window." Since you mentioned replacing this with the "mono version", I just built OpenTK from AUR and copied it in place... now New causes the window to become painted with the null brush. Did you have something more specific in mind for "replacing"?

thatch commented Apr 6, 2017

With the patch it gets slightly further,

Unhandled Exception:
System.InvalidCastException: Specified cast is not valid.
  at System.Drawing.Icon.SaveBestSingleIcon (System.IO.BinaryWriter writer, System.Int32 width, System.Int32 height) [0x000b0] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.Save (System.IO.Stream outputStream, System.Int32 width, System.Int32 height) [0x00031] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.GetInternalBitmap () [0x00029] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at System.Drawing.Icon.ToBitmap () [0x0001b] in <77ff46021c554b57be5b7a306d989e5d>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:ToBitmap ()
  at System.Windows.Forms.XplatUIX11.SetIcon (System.Windows.Forms.Hwnd hwnd, System.Drawing.Icon icon) [0x00021] in <e37081a3704b4473a59cdf5048ad96bc>:0 

I then hacked up GetInternalBitmap to do

if (imageData[0] is PNGImage) {
  bitmap = ((PNGImage)imageData[0]).png;
} else ...

and it gets further. It launches and has a valid icon, but then when using File->New it crashes in OpenTK saying "The specified window isn't an OpenGL window." Since you mentioned replacing this with the "mono version", I just built OpenTK from AUR and copied it in place... now New causes the window to become painted with the null brush. Did you have something more specific in mind for "replacing"?

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Apr 6, 2017

Aha. I think I'm hitting opentk/opentk#393 (I do have an nvidia card, and that user is also on Arch). __GL_THREADED_OPTIMIZATIONS=0 got the File->New to complete and show graph paper, and I can load a board (this is with the Linux version of OpenTK).

The right pane has a working splitter, but no contents, just gray
linux_blank_panel
.

Aside from that, it exports ok (some messages in console, but the gerbers look fine).

thatch commented Apr 6, 2017

Aha. I think I'm hitting opentk/opentk#393 (I do have an nvidia card, and that user is also on Arch). __GL_THREADED_OPTIMIZATIONS=0 got the File->New to complete and show graph paper, and I can load a board (this is with the Linux version of OpenTK).

The right pane has a working splitter, but no contents, just gray
linux_blank_panel
.

Aside from that, it exports ok (some messages in console, but the gerbers look fine).

@dromer

This comment has been minimized.

Show comment
Hide comment
@dromer

dromer Jul 27, 2017

Hmm, also running into this while trying to open this project with mono.

This machine happens to also have an nvidia gpu (and using the associated nvidia driver), but the solution to use __GL_THREADED_OPTIMIZATIONS=0 doesn't seem to work as I get the exact same System.Reflection.TargetInvocationException

Any ideas?

dromer commented Jul 27, 2017

Hmm, also running into this while trying to open this project with mono.

This machine happens to also have an nvidia gpu (and using the associated nvidia driver), but the solution to use __GL_THREADED_OPTIMIZATIONS=0 doesn't seem to work as I get the exact same System.Reflection.TargetInvocationException

Any ideas?

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Sep 20, 2017

@dromer The TargetInvocationException implies you need to remove openTK.dll from the local directory, so it uses the system-installed one. (If you're on Arch, it's in AUR.)

thatch commented Sep 20, 2017

@dromer The TargetInvocationException implies you need to remove openTK.dll from the local directory, so it uses the system-installed one. (If you're on Arch, it's in AUR.)

@dromer

This comment has been minimized.

Show comment
Hide comment
@dromer

dromer Sep 20, 2017

Hi @thatch , I renamed OpenTK.dll and installed libopentk1.1-cil (wich provides OpenTK.dll on ubuntu 16.04) and still get System.Reflection.TargetInvocationException

dromer commented Sep 20, 2017

Hi @thatch , I renamed OpenTK.dll and installed libopentk1.1-cil (wich provides OpenTK.dll on ubuntu 16.04) and still get System.Reflection.TargetInvocationException

@thatch

This comment has been minimized.

Show comment
Hide comment
@thatch

thatch Sep 20, 2017

Ah, I think I was incorrect then. Does your error have "XOR data length expected" as my paste above? If so, that's the PNG icon issue. Ways forward are either:

  1. Recompile with "normal" icon resources (requires Windows, basically)
  2. Patch and recompile Mono. There's a patch that worked well enough, but it doesn't apply to current mono-git anymore, and I need to get it fixed up.

thatch commented Sep 20, 2017

Ah, I think I was incorrect then. Does your error have "XOR data length expected" as my paste above? If so, that's the PNG icon issue. Ways forward are either:

  1. Recompile with "normal" icon resources (requires Windows, basically)
  2. Patch and recompile Mono. There's a patch that worked well enough, but it doesn't apply to current mono-git anymore, and I need to get it fixed up.
@dromer

This comment has been minimized.

Show comment
Hide comment
@dromer

dromer Sep 20, 2017

Yes I did get the 'XOR data length' line as with you.

I didn't try to compile the code myself, but used the GerberTools_2017_2_17.zip binary release.
Honestly I'm also not looking to patch and recompile mono for this.

dromer commented Sep 20, 2017

Yes I did get the 'XOR data length' line as with you.

I didn't try to compile the code myself, but used the GerberTools_2017_2_17.zip binary release.
Honestly I'm also not looking to patch and recompile mono for this.

@phl0

This comment has been minimized.

Show comment
Hide comment
@phl0

phl0 Nov 13, 2017

Is there any update to this? I am also failing the XOR stuff but would like to run the Panelizer on Linux.

phl0 commented Nov 13, 2017

Is there any update to this? I am also failing the XOR stuff but would like to run the Panelizer on Linux.

@davidbitton

This comment has been minimized.

Show comment
Hide comment
@davidbitton

davidbitton Nov 13, 2017

Same here compiling the latest from the repo using Visual Studio Mac.

davidbitton commented Nov 13, 2017

Same here compiling the latest from the repo using Visual Studio Mac.

@runesoeknudsen

This comment has been minimized.

Show comment
Hide comment
@runesoeknudsen

runesoeknudsen Nov 14, 2017

I have looked at bit into the problem and created a pull request that fixes the problem, see #41
Basically I have extracted the icon file from the code and saved it as a separated file. Thanks for all the hints.

To make it easy for others I have here attached a compiled version: Panelizer.zip
This one I have succesfully used to panellized a PCB on Linux with Mono JIT compiler version 5.4.0.201

runesoeknudsen commented Nov 14, 2017

I have looked at bit into the problem and created a pull request that fixes the problem, see #41
Basically I have extracted the icon file from the code and saved it as a separated file. Thanks for all the hints.

To make it easy for others I have here attached a compiled version: Panelizer.zip
This one I have succesfully used to panellized a PCB on Linux with Mono JIT compiler version 5.4.0.201

@phl0

This comment has been minimized.

Show comment
Hide comment
@phl0

phl0 Nov 15, 2017

Confirmed. Launched @runesoeknudsen s compiled version successfully on my Ubuntu 16.04 Box with mono 5.8.0.22

phl0 commented Nov 15, 2017

Confirmed. Launched @runesoeknudsen s compiled version successfully on my Ubuntu 16.04 Box with mono 5.8.0.22

@davidbitton

This comment has been minimized.

Show comment
Hide comment
@davidbitton

davidbitton Nov 15, 2017

@phl0 how are you launching it? i tried w/ mono from a cmd prompt on my Mac and it dumped a bunch of errors.

bittond:Panelizer/ $ mono GerberPanelizer.exe                                                                                                                             [11:32:12]
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) [0x00002] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.get_WorkingArea () [0x00005] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUI.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Screen..cctor () [0x00034] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001e] in <4fdc5ed61a074cafb49fa42deb20d521>:0
  at <unknown> <0xffffffff>
  at System.Windows.Forms.Hwnd.GetNextStackedFormLocation (System.Windows.Forms.CreateParams,System.Windows.Forms.Hwnd) [0x00064] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.CreateWindow (System.Windows.Forms.CreateParams) [0x000c5] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams) [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams) [0x00009] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.CreateHandle () [0x00031] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Form.CreateHandle () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.CreateControl () [0x00039] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.SetVisibleCore (bool) [0x0003a] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Form.SetVisibleCore (bool) [0x00065] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.set_Visible (bool) [0x00009] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.Show () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.Show () [0x00031] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00017] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at (wrapper remoting-invoke-with-check) GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00018] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at GerberCombinerBuilder.Program.Main () [0x0000b] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004c] in <4fdc5ed61a074cafb49fa42deb20d521>:0

Native stacktrace:

        0   mono                                0x0000000103f4a3d1 mono_handle_native_crash + 257
        1   mono                                0x0000000103fb1e86 altstack_handle_and_restore + 70
        2   SkyLight                            0x00007fff664fd424 SLDisplayBounds + 83
        3   ???                                 0x000000010b2d667e 0x0 + 4482492030
        4   ???                                 0x00000001047df396 0x0 + 4370330518
        5   mono                                0x0000000103ea45f4 mono_jit_runtime_invoke + 1316
        6   mono                                0x000000010409c238 do_runtime_invoke + 88
        7   mono                                0x00000001040982a4 mono_runtime_class_init_full + 996
        8   mono                                0x0000000103e9da45 mono_jit_compile_method_inner + 2485
        9   mono                                0x0000000103ea0903 mono_jit_compile_method_with_opt + 1379
        10  mono                                0x0000000103f4c871 common_call_trampoline + 1217
        11  mono                                0x0000000103f4c379 mono_magic_trampoline + 73
        12  ???                                 0x000000010435739e 0x0 + 4365579166
        13  ???                                 0x000000010b2d5d4b 0x0 + 4482489675

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.BtxnYC'
Executing commands in '/tmp/mono-gdb-commands.BtxnYC'.
(lldb) process attach --pid 78666
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/libglib-2.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 78666 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff6c46167a <+10>: jae    0x7fff6c461684            ; <+20>
    0x7fff6c46167c <+12>: movq   %rax, %rdi
    0x7fff6c46167f <+15>: jmp    0x7fff6c458791            ; cerror
    0x7fff6c461684 <+20>: retq
Target 0: (mono) stopped.

Executable module set to "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 78666 stopped
* thread #1: tid = 0x2d30e9a, 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x2d30e9b, 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x2d30e9c, 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0x2d30e9d, 0x00007fff6c457eb2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0x2d30e9e, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0x2d30e9f, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0x2d30eb0, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x0000000103f4a45e mono`mono_handle_native_crash + 398
    frame #2: 0x0000000103fb1e86 mono`altstack_handle_and_restore + 70
    frame #3: 0x00007fff664fd424 SkyLight`SLDisplayBounds + 83
    frame #4: 0x000000010b2d667e
    frame #5: 0x00000001047df396
    frame #6: 0x0000000103ea45f4 mono`mono_jit_runtime_invoke + 1316
    frame #7: 0x000000010409c238 mono`do_runtime_invoke + 88
    frame #8: 0x00000001040982a4 mono`mono_runtime_class_init_full + 996
    frame #9: 0x0000000103e9da45 mono`mono_jit_compile_method_inner + 2485
    frame #10: 0x0000000103ea0903 mono`mono_jit_compile_method_with_opt + 1379
    frame #11: 0x0000000103f4c871 mono`common_call_trampoline + 1217
    frame #12: 0x0000000103f4c379 mono`mono_magic_trampoline + 73
    frame #13: 0x000000010435739e
    frame #14: 0x000000010b2d5d4b
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff6c59c662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010411203f mono`thread_func + 687
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'SGen worker'
    frame #0: 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff6c59c662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x0000000104112022 mono`thread_func + 658
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #4, name = 'Finalizer'
    frame #0: 0x00007fff6c457eb2 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0000000104094165 mono`finalizer_thread + 293
    frame #2: 0x00000001040682f3 mono`start_wrapper + 675
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #5
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b06a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
  thread #6
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b06a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
  thread #7
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b26f libsystem_pthread.dylib`_pthread_wqthread + 1552
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
(lldb) detach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Process 78666 detached
(lldb) quit
[1]    78666 abort      mono GerberPanelizer.exe

mono version:

bittond:Panelizer/ $ mono -V                                                                                                                                              [11:56:55]
Mono JIT compiler version 5.4.1.7 (2017-06/e66d9abbb27 Wed Oct 25 12:10:41 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       altstack
        Notification:  kqueue
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-master/8b1520c8aae)
        GC:            sgen (concurrent by default)

davidbitton commented Nov 15, 2017

@phl0 how are you launching it? i tried w/ mono from a cmd prompt on my Mac and it dumped a bunch of errors.

bittond:Panelizer/ $ mono GerberPanelizer.exe                                                                                                                             [11:32:12]
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) [0x00002] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.get_WorkingArea () [0x00005] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUI.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Screen..cctor () [0x00034] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001e] in <4fdc5ed61a074cafb49fa42deb20d521>:0
  at <unknown> <0xffffffff>
  at System.Windows.Forms.Hwnd.GetNextStackedFormLocation (System.Windows.Forms.CreateParams,System.Windows.Forms.Hwnd) [0x00064] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUICarbon.CreateWindow (System.Windows.Forms.CreateParams) [0x000c5] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams) [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams) [0x00009] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.CreateHandle () [0x00031] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Form.CreateHandle () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.CreateControl () [0x00039] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.SetVisibleCore (bool) [0x0003a] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Form.SetVisibleCore (bool) [0x00065] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.set_Visible (bool) [0x00009] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at System.Windows.Forms.Control.Show () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.Show () [0x00031] in <36fbc38531724d82b10aef6ebafea6e9>:0
  at GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00017] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at (wrapper remoting-invoke-with-check) GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00018] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at GerberCombinerBuilder.Program.Main () [0x0000b] in <d4a1e563f66b4c33be95409fb7549fff>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004c] in <4fdc5ed61a074cafb49fa42deb20d521>:0

Native stacktrace:

        0   mono                                0x0000000103f4a3d1 mono_handle_native_crash + 257
        1   mono                                0x0000000103fb1e86 altstack_handle_and_restore + 70
        2   SkyLight                            0x00007fff664fd424 SLDisplayBounds + 83
        3   ???                                 0x000000010b2d667e 0x0 + 4482492030
        4   ???                                 0x00000001047df396 0x0 + 4370330518
        5   mono                                0x0000000103ea45f4 mono_jit_runtime_invoke + 1316
        6   mono                                0x000000010409c238 do_runtime_invoke + 88
        7   mono                                0x00000001040982a4 mono_runtime_class_init_full + 996
        8   mono                                0x0000000103e9da45 mono_jit_compile_method_inner + 2485
        9   mono                                0x0000000103ea0903 mono_jit_compile_method_with_opt + 1379
        10  mono                                0x0000000103f4c871 common_call_trampoline + 1217
        11  mono                                0x0000000103f4c379 mono_magic_trampoline + 73
        12  ???                                 0x000000010435739e 0x0 + 4365579166
        13  ???                                 0x000000010b2d5d4b 0x0 + 4482489675

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.BtxnYC'
Executing commands in '/tmp/mono-gdb-commands.BtxnYC'.
(lldb) process attach --pid 78666
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/libglib-2.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 78666 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff6c46167a <+10>: jae    0x7fff6c461684            ; <+20>
    0x7fff6c46167c <+12>: movq   %rax, %rdi
    0x7fff6c46167f <+15>: jmp    0x7fff6c458791            ; cerror
    0x7fff6c461684 <+20>: retq
Target 0: (mono) stopped.

Executable module set to "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 78666 stopped
* thread #1: tid = 0x2d30e9a, 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x2d30e9b, 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x2d30e9c, 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0x2d30e9d, 0x00007fff6c457eb2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0x2d30e9e, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0x2d30e9f, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0x2d30eb0, 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff6c46167a libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x0000000103f4a45e mono`mono_handle_native_crash + 398
    frame #2: 0x0000000103fb1e86 mono`altstack_handle_and_restore + 70
    frame #3: 0x00007fff664fd424 SkyLight`SLDisplayBounds + 83
    frame #4: 0x000000010b2d667e
    frame #5: 0x00000001047df396
    frame #6: 0x0000000103ea45f4 mono`mono_jit_runtime_invoke + 1316
    frame #7: 0x000000010409c238 mono`do_runtime_invoke + 88
    frame #8: 0x00000001040982a4 mono`mono_runtime_class_init_full + 996
    frame #9: 0x0000000103e9da45 mono`mono_jit_compile_method_inner + 2485
    frame #10: 0x0000000103ea0903 mono`mono_jit_compile_method_with_opt + 1379
    frame #11: 0x0000000103f4c871 mono`common_call_trampoline + 1217
    frame #12: 0x0000000103f4c379 mono`mono_magic_trampoline + 73
    frame #13: 0x000000010435739e
    frame #14: 0x000000010b2d5d4b
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff6c59c662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010411203f mono`thread_func + 687
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'SGen worker'
    frame #0: 0x00007fff6c460e7e libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff6c59c662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x0000000104112022 mono`thread_func + 658
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #4, name = 'Finalizer'
    frame #0: 0x00007fff6c457eb2 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0000000104094165 mono`finalizer_thread + 293
    frame #2: 0x00000001040682f3 mono`start_wrapper + 675
    frame #3: 0x00007fff6c59b6c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff6c59b56d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff6c59ac5d libsystem_pthread.dylib`thread_start + 13
  thread #5
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b06a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
  thread #6
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b06a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
  thread #7
    frame #0: 0x00007fff6c4616da libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff6c59b26f libsystem_pthread.dylib`_pthread_wqthread + 1552
    frame #2: 0x00007fff6c59ac4d libsystem_pthread.dylib`start_wqthread + 13
(lldb) detach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Process 78666 detached
(lldb) quit
[1]    78666 abort      mono GerberPanelizer.exe

mono version:

bittond:Panelizer/ $ mono -V                                                                                                                                              [11:56:55]
Mono JIT compiler version 5.4.1.7 (2017-06/e66d9abbb27 Wed Oct 25 12:10:41 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       altstack
        Notification:  kqueue
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-master/8b1520c8aae)
        GC:            sgen (concurrent by default)
@runesoeknudsen

This comment has been minimized.

Show comment
Hide comment
@runesoeknudsen

runesoeknudsen Nov 15, 2017

mono GerberPanelizer.exe should work, however it seems that there is a general problem with winForms and mac, see e.g. Homebrew/homebrew-core#14684.

A way around could be using a virtual machine running Linux. Note that it needs to support OpenGL

runesoeknudsen commented Nov 15, 2017

mono GerberPanelizer.exe should work, however it seems that there is a general problem with winForms and mac, see e.g. Homebrew/homebrew-core#14684.

A way around could be using a virtual machine running Linux. Note that it needs to support OpenGL

@davidbitton

This comment has been minimized.

Show comment
Hide comment
@davidbitton

davidbitton Nov 15, 2017

If a VM is required, then I'll just run it in my Win10 VM.

davidbitton commented Nov 15, 2017

If a VM is required, then I'll just run it in my Win10 VM.

@macsimski

This comment has been minimized.

Show comment
Hide comment
@macsimski

macsimski Jan 19, 2018

used runesoeknudsen version under Mono JIT compiler version 5.4.1.7 on Ubuntu 16.04.1 64bit and the generated gerber files contain no mousebites, but the png images have them?? original gerbers generated using kicad

macsimski commented Jan 19, 2018

used runesoeknudsen version under Mono JIT compiler version 5.4.1.7 on Ubuntu 16.04.1 64bit and the generated gerber files contain no mousebites, but the png images have them?? original gerbers generated using kicad

@antonio-fiol

This comment has been minimized.

Show comment
Hide comment
@antonio-fiol

antonio-fiol Apr 28, 2018

Affected by the exception on the description of this bug, I tried @runesoeknudsen 's version on Ubuntu 16.04 with its default version of mono, and it attempts to start (seems like it were going to show a window), but then fails with a bad image format exception. Is it supposed to work with mono 4.2.1.102+dfsg2-7ubuntu4 ?
Currently considering an upgrade to Ubuntu 18.04 soon. This comes with mono 4.6.2.7+dfsg-1ubuntu1 --still behind the version 5.4.0.201 that you tried. Do you think it may help?

antonio-fiol commented Apr 28, 2018

Affected by the exception on the description of this bug, I tried @runesoeknudsen 's version on Ubuntu 16.04 with its default version of mono, and it attempts to start (seems like it were going to show a window), but then fails with a bad image format exception. Is it supposed to work with mono 4.2.1.102+dfsg2-7ubuntu4 ?
Currently considering an upgrade to Ubuntu 18.04 soon. This comes with mono 4.6.2.7+dfsg-1ubuntu1 --still behind the version 5.4.0.201 that you tried. Do you think it may help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment