Author Topic: Building in OSX with wxCocoa (2.9.4)  (Read 10260 times)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Building in OSX with wxCocoa (2.9.4)
« on: December 26, 2012, 11:37:59 am »
I decided to give wxWidgets and Code::Blocks another try in OSX. I built wxWidgets 2.9.4 rather easily, but Code::Blocks needed some minor adjustments which I want share in here.

The files configmanager.cpp and app.cpp rely on the directory structure of wxWidgets 2.8. The first change that is needed, when using wxWidgets 2.9, is to replace

Code
#include "wx/mac/corefoundation/cfstring.h"

with

Code
#include "wx/osx/core/cfstring.h"

The next change is to replace

Code
wxMacCFStringHolder

with

Code
wxCFStringRef

Once Code::Blocks has been built and installed, running it causes quite a couple of assertions:

  • failed in DoOffset(): invalid wxRegion
  • failed in DoCombine(): invalid wxRegion
  • failed in Enable(): attempt to enable an item which doesn't exist

Although Code::Blocks runs, it gets no menu. No plugins are loaded either. They are all installed in /usr/local/lib/codeblocks/plugins, but, it seems, they are not searched in there. Once I force it to load them, it fails. It seems to be caused by the suggested configure flag for wxWidgets of disabling shared (which I should have ignored).

Well, at least it seems to be getting somewhere.

BTW, the build is in 64 bits under Mountain Lion.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #1 on: December 26, 2012, 11:50:31 am »
I decided to give wxWidgets and Code::Blocks another try in OSX. I built wxWidgets 2.9.4 rather easily
Why don't you try with wx2.8.12 first?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #2 on: December 26, 2012, 02:32:15 pm »
I decided to give wxWidgets and Code::Blocks another try in OSX. I built wxWidgets 2.9.4 rather easily
Why don't you try with wx2.8.12 first?

I tried with 2.8 last time, and I did not get far. I also tried with an older version of 2.9, and it was also a disaster. It went rather nicely this time, except for the assertions. The next step would be configuring wxWidgets in shared mode, then see how far it gets.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #3 on: December 26, 2012, 03:27:44 pm »
I tried with 2.8 last time, and I did not get far.
Ok - my problem (when I tried last time) was that the built-in wx was version 2.8.8 which is too old. wx 2.8.12 self-compiled just fine, after a long fight to find the right flags. I didn't know how to un-install the old version so I simply deleted it and then the new (and only the new) was working just fine.

Developing on Mac is really hell for me. Even the simplest things didn't work. For example: I copied C::B sources from a CD to the HDD and then tried to compile. It refused to do so because all directories were write-protected. I am maybe too dumb, but I didn't even find an option in the UI (Finder) to recursively set the write flag for folders and files. So I did it "by hand" in the console... annoyances, annoyances, annoyances - I could tell at least 10 more stories of that kind. If you don't follow the strict Mac way and only use whats available its really frustrating. So I finally gave up on such an unfriendly environment.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #4 on: December 26, 2012, 08:13:41 pm »
I tried again with --enable-shared, and now it manages to load the plugins without crashing (even though I still have to copy them to another directory). Assertions remain, menu bar is still missing (it still says it's the Terminal window from which I am launching it), and the keyboard actions go to the Terminal (even with a system dialog in focus).

Well, at least it's something, isn't it?

Offline Smirftsch

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #5 on: January 23, 2013, 08:23:05 pm »
didn't notice this topic before, I'm pretty much at the same point, for pretty much the same reasons ;)

how do you start it up? I can't seem to get past the first assert, it won't let me click it away...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #6 on: January 24, 2013, 05:22:53 pm »
how do you start it up? I can't seem to get past the first assert, it won't let me click it away...

I just run it from the Terminal. I can click things just fine, but the keyboard seems to go to the Terminal. I didn't do anything special, that's just what I got.

Offline Smirftsch

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #7 on: January 26, 2013, 02:45:30 pm »
Went back to 2.8.12 to give it another try and this time I managed to make it compile without bigger trouble, after cleaning up any other include and lib stuff from the original OSX installation. I think some old stuff was still somewhere it tried to use (OSX 10.5).

Strange enough, after some testing it appears that it works if I put everything in some .app - then the window acts fine - the keyboard and the mouse selection are both working flawlessly, I am able to select everything.

With the plugins I am not entirely lucky so far, it seems to crash (at least) on Code Completion plugin, which is one of the plugins I would really miss.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #8 on: January 26, 2013, 10:18:55 pm »
Strange enough, after some testing it appears that it works if I put everything in some .app - then the window acts fine - the keyboard and the mouse selection are both working flawlessly, I am able to select everything.

If you put which version in an .app? The one compiled with wxWidgets 2.9.x, or the one with 2.8.12?

Offline Smirftsch

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Building in OSX with wxCocoa (2.9.4)
« Reply #9 on: January 27, 2013, 06:51:48 pm »
actually...both :)