CheatCat's picture

OpenTK in mono??

How do I compile OpenTK in mono, for mono? I tried but get segfault, the tutorial I found is very old...

Also, the SVN don't give any project folder, are I supposed to bundle it by myself?

...And Bulid.exe don't give mono files anymore... :(


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Which version of Mono are you using? You need at least Mono 2.0 but the newer the better. If you are using MonoDevelop, make sure you have version 2.0 (or newer).

Perform a checkout from https://opentk.svn.sourceforge.net/opentk/branches/1.0 and compile with "mono Build.exe lib". Alternatively, you can use "mono Build.exe vs" and compile the resulting OpenTK.sln through MonoDevelop.

CheatCat's picture

I have mono 2.6.4. I tried on the both way but still get segfault.. I guess I have messed up something.

the Fiddler's picture

Can you please post the exact output of the segfault?

CheatCat's picture

The debug info? Here is what I get when I tried to run the Display Lists example:

Loaded assembly: /home/katt/Program/OpenTK/Binaries/OpenTK/Debug/Examples.exe
Loaded assembly: /usr/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll [External]
Loaded assembly: /usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll [External]
Loaded assembly: /usr/lib/mono/gac/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll [External]
Loaded assembly: /usr/lib/mono/gac/Mono.Posix/2.0.0.0__0738eb9f132ed756/Mono.Posix.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll [External]
KDE colorscheme read failure, using built-in colorscheme
Loaded assembly: /home/katt/Program/OpenTK/Binaries/OpenTK/Debug/OpenTK.dll [External]
Loaded assembly: /home/katt/Program/OpenTK/Binaries/OpenTK/Debug/OpenTK.GLControl.dll [External]
Launching sample: "Display Lists"
 
Thread started: 
Size: 2304
System:
    Linux
 
 
 
 
Initializing threaded X11: 1.
Display connection: 169123888, Screen count: 1
Detected configuration: Linux / Mono
Initializing threaded X: success.
Creating default GraphicsMode (24, 16, 0, 0, 0, 2, False).
Creating X11GLNative window.
    Display: -1239533320, Screen 0, Root window: 429
    Registering atoms.
    Bits per pixel: 24
    Depth: 16
    Display: 169123888, Screen: 0, RootWindow: 429
    Getting FB config.
    Bits per pixel: 24
    Depth: 16
    Falling back to glXChooseVisual.
    Opening render window... Initalizing X11 input driver.
        First keycode: 8, last 255
        6 keysyms per keycode.
    X11GLNative window created successfully (id: 67108866).
Creating GraphicsContext.
    GraphicsMode: Index: 39, Color: 24 (8880), Depth: 24, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
    IWindowInfo: X11.WindowInfo: Display -1239533320, Screen 0, Handle 67108866, Parent: (null)
    GraphicsContextFlags: Default
    Requested version: 1.0
    Creating X11GLContext context: direct, not shared... 
    Creating temporary context to load GLX extensions.
    Loading extensions for OpenTK.Platform.X11.Glx... Stacktrace:
 
 
Native stacktrace:
 
	/usr/bin/mono() [0x80d8800]
	/usr/bin/mono() [0x81108ab]
	[0xb77f940c]
 
Debug info from gdb:
 
Mono support loaded.
[Thread debugging using libthread_db enabled]
[New Thread 0xb3d77b70 (LWP 6716)]
[New Thread 0xb60ffb70 (LWP 6711)]
[New Thread 0xb635cb70 (LWP 6710)]
[New Thread 0xb77e0b70 (LWP 6709)]
[New Thread 0xb7385b70 (LWP 6707)]
0xb77f9424 in __kernel_vsyscall ()
  6 Thread 0xb7385b70 (LWP 6707)  0xb77f9424 in __kernel_vsyscall ()
  5 Thread 0xb77e0b70 (LWP 6709)  0xb77f9424 in __kernel_vsyscall ()
  4 Thread 0xb635cb70 (LWP 6710)  0xb77f9424 in __kernel_vsyscall ()
  3 Thread 0xb60ffb70 (LWP 6711)  0xb77f9424 in __kernel_vsyscall ()
  2 Thread 0xb3d77b70 (LWP 6716)  0xb77f9424 in __kernel_vsyscall ()
* 1 Thread 0xb75376f0 (LWP 6705)  0xb77f9424 in __kernel_vsyscall ()
 
Thread 6 (Thread 0xb7385b70 (LWP 6707)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76e7045 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x081fc26a in ?? ()
#3  0x082017c9 in ?? ()
#4  0x081faad2 in ?? ()
#5  0xb76e2adc in start_thread () from /lib/libpthread.so.0
#6  0xb763ac1e in clone () from /lib/libc.so.6
 
Thread 5 (Thread 0xb77e0b70 (LWP 6709)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76ea816 in nanosleep () from /lib/libpthread.so.0
#2  0x081edac8 in ?? ()
#3  0xb76e2adc in start_thread () from /lib/libpthread.so.0
#4  0xb763ac1e in clone () from /lib/libc.so.6
 
Thread 4 (Thread 0xb635cb70 (LWP 6710)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76e92b5 in sem_wait@@GLIBC_2.1 () from /lib/libpthread.so.0
#2  0x081f27c8 in mono_sem_wait ()
#3  0x081a3958 in ?? ()
#4  0x0812f284 in ?? ()
#5  0x081d72ea in ?? ()
#6  0x081fb905 in ?? ()
#7  0xb76e2adc in start_thread () from /lib/libpthread.so.0
#8  0xb763ac1e in clone () from /lib/libc.so.6
 
Thread 3 (Thread 0xb60ffb70 (LWP 6711)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76e9ffb in read () from /lib/libpthread.so.0
#2  0x080d89bd in ?? ()
#3  0x081108ab in ?? ()
#4  <signal handler called>
#5  0x080f3b1b in ?? ()
#6  0x080f5029 in ?? ()
#7  0x081d72ea in ?? ()
#8  0x081fb905 in ?? ()
#9  0xb76e2adc in start_thread () from /lib/libpthread.so.0
#10 0xb763ac1e in clone () from /lib/libc.so.6
 
Thread 2 (Thread 0xb3d77b70 (LWP 6716)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76e7045 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x080eec82 in ?? ()
#3  0x080ef82b in ?? ()
#4  0x080ef8c5 in ?? ()
#5  0x080efb51 in ?? ()
#6  0x0814913a in ?? ()
#7  0x080624cf in ?? ()
#8  0x0806281e in ?? ()
#9  0x081895f2 in ?? ()
#10 0xb256d48d in ?? ()
#11 0xb256d41f in ?? ()
#12 0xb256d11c in ?? ()
#13 0xb256cf13 in ?? ()
#14 0xb256c926 in ?? ()
#15 0xb256a085 in ?? ()
#16 0xb2569747 in ?? ()
#17 0xb41b1ac2 in ?? ()
#18 0xb41a436a in ?? ()
#19 0xb41a3f03 in ?? ()
#20 0xb41a3e62 in ?? ()
#21 0xb3d80395 in ?? ()
#22 0xb3d8030c in ?? ()
#23 0xb3d801b4 in ?? ()
#24 0xb6726948 in ?? ()
#25 0x08062901 in ?? ()
#26 0x0814fd5e in mono_runtime_invoke ()
#27 0x08153505 in mono_runtime_invoke_array ()
#28 0x08197486 in ?? ()
#29 0xb3d8011d in ?? ()
#30 0xb3d7fd25 in ?? ()
#31 0xb4986545 in ?? ()
#32 0xb3d7f99f in ?? ()
#33 0xb622a2ef in ?? ()
#34 0x08062901 in ?? ()
#35 0x0814fd5e in mono_runtime_invoke ()
#36 0x08150034 in mono_runtime_delegate_invoke ()
#37 0x0812f39b in ?? ()
#38 0x081d72ea in ?? ()
#39 0x081fb905 in ?? ()
#40 0xb76e2adc in start_thread () from /lib/libpthread.so.0
#41 0xb763ac1e in clone () from /lib/libc.so.6
 
Thread 1 (Thread 0xb75376f0 (LWP 6705)):
#0  0xb77f9424 in __kernel_vsyscall ()
#1  0xb76e7045 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x081ea92c in ?? ()
#3  0x081ea9a4 in ?? ()
#4  0x081d7b97 in ?? ()
#5  0x0812ee3f in ?? ()
#6  0xb3d7f916 in ?? ()
#7  0xb3d7f861 in ?? ()
#8  0xb3d7c694 in ?? ()
#9  0xb3d7b5d5 in ?? ()
#10 0xb3d7b3ed in ?? ()
#11 0xb3d7b359 in ?? ()
#12 0xb3d9820d in ?? ()
#13 0xb41c18f1 in ?? ()
#14 0xb41c14d5 in ?? ()
#15 0xb4a97633 in ?? ()
#16 0xb4912730 in ?? ()
#17 0xb4a97291 in ?? ()
#18 0xb4a97249 in ?? ()
#19 0xb4a95c7c in ?? ()
#20 0xb41f1226 in ?? ()
#21 0xb41f11ca in ?? ()
#22 0xb490854c in ?? ()
#23 0xb49074bf in ?? ()
#24 0xb4970e96 in ?? ()
#25 0xb67266f0 in ?? ()
#26 0xb6726948 in ?? ()
#27 0x08062901 in ?? ()
#28 0x0814fd5e in mono_runtime_invoke ()
#29 0x081527a0 in mono_runtime_exec_main ()
#30 0x08152aad in mono_runtime_run_main ()
#31 0x080b5bde in mono_main ()
#32 0x08059195 in ?? ()
#33 0xb7582b96 in __libc_start_main () from /lib/libc.so.6
#34 0x080590d1 in ?? ()
 
=================================================================
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.
=================================================================
 
Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.
  at Mono.Debugger.Soft.Connection.SendReceive (CommandSet command_set, Int32 command, Mono.Debugger.Soft.PacketWriter packet) [0x00000] in <filename unknown>:0 
  at Mono.Debugger.Soft.Connection.Type_GetInfo (Int64 id) [0x00000] in <filename unknown>:0 
  at Mono.Debugger.Soft.TypeMirror.GetInfo () [0x00000] in <filename unknown>:0 
  at Mono.Debugger.Soft.TypeMirror.get_FullName () [0x00000] in <filename unknown>:0 
  at MonoDevelop.Debugger.Soft.SoftDebuggerSession.HandleEvent (Mono.Debugger.Soft.Event e, Boolean dequeuing) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Debugger.Soft.SoftDebuggerSession.HandleEvent (Mono.Debugger.Soft.Event e) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Debugger.Soft.SoftDebuggerSession.EventHandler () [0x00000] in <filename unknown>:0
the Fiddler's picture

Thanks. The debugger in Mono 2.6.4 suffered from a bug that caused segfaults. What happens if you run the application on its own (not through MonoDevelop)?

Listing your distribution and video card/drivers might also be useful.

CheatCat's picture

The programs run well just open them with mono. :) Must be monodevelop then.

Distro: Arch Linux, gfx card: Nvidia Geforce GO 7600.

Hmm, it seems to work in monodevelop also after I updated it.