Forums

Bugfix for MonoDevelop addin on Mac

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Bugfix for MonoDevelop addin on Mac

Postby nerdzero » Sun Dec 02, 2012 6:58 pm

The bug preventing installation of the MonoDevelop addin on Mac has been fixed. Thanks for the patch, Charles.

There may still be some issues with actually using the addin once installed so any testing that can be done would be appreciated as I don't have a Mac to test on. Thanks, everyone.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Bugfix for MonoDevelop addin on Mac

Postby Ben Apuna » Sun Dec 09, 2012 1:42 am

Hi new Cobra user here :)

I tried downloading and installing the MonoDevelop addin from https://github.com/ramon-rocha/MonoDevelop.CobraBinding on my Mac running OSX 10.7.5 (Lion) and got some errors:

Code: Select all
Benedicts-Mac-mini:MonoDevelop.CobraBinding-master benedictapuna$ cobra install.cobra
install.cobra(201): error: Cannot find a definition for "isRunningOnMac" in "CobraCore".
install.cobra(271): error: Cannot find a definition for "isRunningOnMac" in "CobraCore".
Compilation failed - 2 errors, 0 warnings
Not running due to errors above.


I've got Cobra 0.9.0 installed and running properly alongside... (double checks mono --version) Mono 2.10.9 Hmm... strange as I had installed Mono 3.0.5 last night... perhaps something has gone wrong here.

Anyway, I looked into my copy of CobraCore.cobra which only seems to have isRunningOnMono and isRunningOnUnix. So dying to see what I can do with MonoDevelop + Cobra and knowing for sure I'm on a Mac I removed the if test cases for Windows and Linux in install.cobra...

It ran, only it had another error:

Code: Select all
Benedicts-Mac-mini:MonoDevelop.CobraBinding-master benedictapuna$ cobra install.cobra

===============================================================================
This will compile and install the Cobra Language Binding addin for MonoDevelop.

The compiled assemblies will be copied to:
/Users/benedictapuna/Library/Application Support/MonoDevelop-3.0/LocalInstall/Addins/CobraBinding/
===============================================================================

Do you wish to continue? [Y/N]
y
Running xbuild...
Running /usr/local/bin/cobra...
Failed!
std out:
Compilation failed - 1 error, 0 warnings

std err:
TypeSystem/Parser.cobra(70): error: Cannot find a definition for "colNum" in "parseErr" whose type is "ParserException".


The addin was not installed due to compilation errors.


Not willing to give up I looked into Parser.cobra and attempted to see if I could figure out what was going wrong. After breaking it some more I discovered that the parameters being sent to ICSharpCode.NRefactory.TypeSystem.Error seem to be correct (I don't know C#...) if it's from this: https://github.com/icsharpcode/NRefactory/blob/master/ICSharpCode.NRefactory/TypeSystem/Error.cs

After much more looking through various files and being at a loss on what to do (I'm a novice programmer at best...), I ended up just changing line 70 of Parser.cobra from:

Code: Select all
parsedDoc.add(Error(ErrorType.Error, parseErr.message, parseErr.lineNum, parseErr.colNum - 1))


to:

Code: Select all
parsedDoc.add(Error(ErrorType.Error, parseErr.message, parseErr.lineNum, 0/# parseErr.colNum - 1#/))


It finally installed the addin! \o/

All messy hacks lol, but it appears to work :)

Btw. thanks for the addin!
Ben Apuna
 
Posts: 6

Re: Bugfix for MonoDevelop addin on Mac

Postby Charles » Sun Dec 09, 2012 9:19 am

Thanks for your interest in Cobra and the MonoDevelop add-in. If you take a closer look at README.md it says:

* .NET Framework 4 or Mono 2.10
* MonoDevelop 3.0
* Cobra 0.9.2

You can view the read-me on line at https://github.com/ramon-rocha/MonoDevelop.CobraBinding (scroll down).
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Bugfix for MonoDevelop addin on Mac

Postby Ben Apuna » Sun Dec 09, 2012 11:04 am

Ah... Cobra 0.9.2 that's probably it. Silly me :oops: I didn't notice a new version was out, my fault for not reading the readme too.

Thanks for the heads up Charles. I'll give it a try later on today :)
Ben Apuna
 
Posts: 6

Re: Bugfix for MonoDevelop addin on Mac

Postby Charles » Sun Dec 09, 2012 2:41 pm

No problem. Less obvious is that if you want to help test the autocompletion, you can find it in a sub-branch:

https://github.com/ramon-rocha/MonoDeve ... completion

...which will be promoted after it's fully stable which will happen after more development and testing.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Bugfix for MonoDevelop addin on Mac

Postby nerdzero » Sun Dec 09, 2012 7:04 pm

Awesome that you were able to workaround those issues on your own by the way :) With the newer version of Cobra, the column number is available from parser errors and makes the red squiggly line show up under the correct word in MonoDevelop when a syntax error is made.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Bugfix for MonoDevelop addin on Mac

Postby Ben Apuna » Sun Dec 09, 2012 11:08 pm

Yup after installing Cobra 0.9.2 the addin installation went flawlessly. I haven't tested it out much yet.

The Console Project template seems to work just fine.

The GTK# 2.0 Project template runs fine when run from within MonoDevelop using: Run -> Run With -> Mono 3.0.2

However using Run -> Run With Mono 2.10.9 (/Library/Frameworks/Mono.framework/Versions/2.10.9) brings up some errors:

Application Output:
Code: Select all
objc[1376]: Class GdkQuartzView is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgdk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgdk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.
objc[1376]: Class GdkQuartzWindow is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgdk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgdk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.
objc[1376]: Class GtkQuartzStatusIcon is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgtk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.
objc[1376]: Class GtkClipboardOwner is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgtk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.
objc[1376]: Class GtkDragSourceOwner is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgtk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.
objc[1376]: Class ResultReceiver is implemented in both /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtk-quartz-2.0.0.dylib and /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/libgtk-quartz-2.0.0.dylib. One of the two will be used. Which one is undefined.

(process:1376): GLib-GObject-CRITICAL **: gtype.c:2715: You forgot to call g_type_init()

(process:1376): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(process:1376): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed

(process:1376): GLib-GObject-CRITICAL **: gtype.c:2770: You forgot to call g_type_init()

(process:1376): GLib-GObject-CRITICAL **: gtype.c:2715: You forgot to call g_type_init()

(process:1376): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(process:1376): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed

(process:1376): GLib-GObject-CRITICAL **: gtype.c:2770: You forgot to call g_type_init()


I guess I need to specify which one to use, stick with Mono 3, or downgrade back to Mono 2 (most likely choice for now). MonoDevelop new to me too. Up to now I've just been using Vim and the command line to compile my .cobra projects (though perhaps "projects" is a bit to grandiose a term for what I've been doing lol!).

@Charles:

Nice! auto completion. I'll check it out.

@nerdzero:

Thanks! Sounds good.
Ben Apuna
 
Posts: 6

Re: Bugfix for MonoDevelop addin on Mac

Postby Charles » Mon Dec 10, 2012 10:07 am

@Ben, I'm curious why your choice would be to downgrade Mono. Is there something wrong with 3 I don't know about?

Btw the completion code is implemented by Ramon. I was just pointing out its location.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Bugfix for MonoDevelop addin on Mac

Postby Ben Apuna » Tue Dec 11, 2012 4:34 am

@Charles:

About downgrading Mono back to 2:

No nothing's wrong with Mono 3 as far as I can tell. I suppose some context on what I'm doing would help clear things up.

A month ago I started using Mono 2 while learning Cobra and the .net version of SFML2 http://www.sfml-dev.org without any major problems. Then a week ago I thought I should also check out MonoGame's new 3.0 Develop3d branch to see what the XNA framework could offer me. https://github.com/mono/MonoGame

So far MonoGame has caused me a lot of headaches, well more like getting a MonoGame window up and running with MonoMac. A few days ago I got the idea to upgrade to Mono 3 and build MonoGame with it to see if any of the issues I've been having would magically clear up, sadly they didn't.

I'm pretty sure spending time with the MonoMac and Apple developer documentation and just persevering through it all will yield results, but it's getting frustrating. When I mentioned downgrading back to Mono 2 I was also thinking of going back to MonoGame 2.5 which is considered the stable branch (which I'm hoping should just work out of the box). Since MonoGame 2.5 is almost six months old I figured it would probably work better with Mono 2 rather than 3.

I did see the XNA Cobra How To example unfortunately it's based on an older version of XNA and also for Windows only. Ultimately I'd like to be making some cross platform Linux, Mac, and Windows games so just using Microsoft's version of XNA won't work for me.

I haven't really decided what to do about Mono yet or even to try and continue on with MonoGame or just go back to SFML2 which was working out quite well actually.

Back on topic of the addin:

I was hoping the Cobra MonoDevelop addin would iron out some of the MonoMac and Mac development issues I've been having. So far, it didn't quite work out the way I had hoped, but it definitely does open up other ideas, possibilites, and enhancements to my current workflow. Code completion for one will really help me learn Cobra's API faster and debugging with breakpoints looks very useful too. The GTK# template example also gives me the idea to try and get MonoGame running in a GTK# window rather than a MonoMac window, or perhaps an OpenTK window, or maybe even a SFML2 window.

I'd offer to contribute to a MonoMac and/or MonoGame on Mac Cobra MonoDevelop template if I knew what I was doing :) but so far I don't :(

I'm also planning to share what I've learned about SFML2 and Cobra, especially if I continue on with it, though definitely in another thread.

Thanks for all your help so far, and also to Ramon for this great MonoDevelop addin it's very much appreciated :)
Ben Apuna
 
Posts: 6

Re: Bugfix for MonoDevelop addin on Mac

Postby Charles » Tue Dec 11, 2012 11:15 am

Thanks for the update. I look forward to anything you learn about SFML2 and/or MonoGame.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Next

Return to Discussion

Who is online

Users browsing this forum: No registered users and 146 guests

cron