Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: dkulp on January 30, 2016, 01:27:17 am

Title: Release 16.01 for Mac
Post by: dkulp on January 30, 2016, 01:27:17 am

I stuck an experimental OSX build up at:

http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz

This is using a custom build of wxWidgets 3.0.x  which is the latest code from git + a bunch of fixes that I submitted back to them in a pull request.   It also contains some fixes to Code::Blocks to get it working on MAC, particularly finding plugins with the ".app" as well as some fixes for Retina displays.   Not all those fixes are submitted back yet.

Very minimal testing has been done as I pretty much just use it for wxSmith.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on January 30, 2016, 02:39:33 am

I stuck an experimental OSX build up at:

http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz

I had a try of your tarball on Mac OS Yosemite. However, there's no lucky for me since your build requires Mac OS X 10.11 or later. Can you change your build SDK to OS X 10.10 or lower.
Title: Re: Release 16.01 for Mac
Post by: dkulp on January 30, 2016, 05:58:16 am

I stuck an experimental OSX build up at:

http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz

I had a try of your tarball on Mac OS Yosemite. However, there's no lucky for me since your build requires Mac OS X 10.11 or later. Can you change your build SDK to OS X 10.10 or lower.

Can you give it another try?   I added the -mmacosx-version-min=10.7 flag to all the compiles/links which hopefully fixes that.   However, there are still a couple of plugins that won't load as I need to figure out how to pass some more link flags to them so they have enough space in the header to adjust the paths to the libs.   Something for tomorrow.  However, if you can at least see if CodeBlocks starts up, that would be a great start.
Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on January 30, 2016, 06:38:36 am
Can you give it another try?   I added the -mmacosx-version-min=10.7 flag to all the compiles/links which hopefully fixes that.   However, there are still a couple of plugins that won't load as I need to figure out how to pass some more link flags to them so they have enough space in the header to adjust the paths to the libs.   Something for tomorrow.  However, if you can at least see if CodeBlocks starts up, that would be a great start.
That's great stuff!

BTW: If you have built a working C::B, you could use C::B to build C::B and then the script mac_pack in the "src" folder. this way, all plugins should be fine (at least they were last time) and it makes a proper app package.

Any patches towards making this work are most welcome. We are hardly seeking Mac devs.
Title: Re: Release 16.01 for Mac
Post by: dkulp on January 30, 2016, 01:20:32 pm
Can you give it another try?   I added the -mmacosx-version-min=10.7 flag to all the compiles/links which hopefully fixes that.   However, there are still a couple of plugins that won't load as I need to figure out how to pass some more link flags to them so they have enough space in the header to adjust the paths to the libs.   Something for tomorrow.  However, if you can at least see if CodeBlocks starts up, that would be a great start.
That's great stuff!

BTW: If you have built a working C::B, you could use C::B to build C::B and then the script mac_pack in the "src" folder. this way, all plugins should be fine (at least they were last time) and it makes a proper app package.

Any patches towards making this work are most welcome. We are hardly seeking Mac devs.

I've had very little luck getting it to build from within CB.   Lots of flags need changing since I'm using clang and not gcc.   I just discovered the field that you edit compiler flags in CB is changing all the -- to a single long hyphen which then breaks everything so I have to edit everything in the raw XML.

The mac_pack is only semi-usable.   I'm not using a monolithic wxwidgets so those parts are problematic.  Also, when building from the command line, all the plugins get a .so extension, not .dylib.   Apparently building from CB makes .dylibs which is interesting.  In anycase, I have a similar mac_pack script that I'm using to try and assemble it.   The problem right now is that a few of the plugins don't have enough "space" in their header to allow for modifications.   You get an error:

Code
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: changing install names or rpaths can't be redone for: /Users/dkulp/tmp/CodeBlocks.app/Contents/Resources/share/codeblocks/plugins/libautosave.so (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)

so that's next to try and figure out.   Most of the plugins work fine, just a few have this issue.
Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on January 30, 2016, 02:03:19 pm
so that's next to try and figure out. Most of the plugins work fine, just a few have this issue.
Darn... I never understood why its so damn hard for an App package to get it right in the first place.

And the dylib issue: In the C::B project, we use the "auto-postfix" feature, this work nice, usually.

I'm afraid I can't help much here. I used to install XCode, then GCC and then build it using GCC before I abandoned Mac. I've never used clang on the Mac, but I am aware that this should be the default now.

Whatever you get - please keep in mind what you changed so we can feed it into the repo. If unsure, you could also dump an archive of the while C::B sources / binaries after it built correctly.

Oh - and are you using wx30 then? Make sure you do the wxSmith stuff correctly in that case. Because not all is wx30 compatible. Some libs are in the wx source tree now and don't need to be compiled for the C::B wx30 version. Thats also why I said use C::B to compile C::B becasue the wx30 project files are correct.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on January 31, 2016, 12:39:16 am
I've had very little luck getting it to build from within CB.   Lots of flags need changing since I'm using clang and not gcc.   I just discovered the field that you edit compiler flags in CB is changing all the -- to a single long hyphen which then breaks everything so I have to edit everything in the raw XML.

The mac_pack is only semi-usable.   I'm not using a monolithic wxwidgets so those parts are problematic.  Also, when building from the command line, all the plugins get a .so extension, not .dylib.   Apparently building from CB makes .dylibs which is interesting.  In anycase, I have a similar mac_pack script that I'm using to try and assemble it.
A few months ago, I have done some work about CB compiled by clang and got a cbp or workspaces file to bootstrap C::B. Some modifications of mac_pack were also done. If it was useful to you, I can sent it to you by email. But your patches of C::B  on Mac OS are more interesting for me.
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on January 31, 2016, 02:10:51 am
Why don't just directly post the changes as a patch in this topic?
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on January 31, 2016, 03:21:47 am
Why don't just directly post the changes as a patch in this topic?
Ok. I'm afraid that my patch is not full of testing. Please use it in your own risk. Some dependencies on GTK+ should be removed.
Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on January 31, 2016, 10:27:25 am
Ok. I'm afraid that my patch is not full of testing. Please use it in your own risk. Some dependencies on GTK+ should be removed.
Good starting point do far... 3 questions:
* Did you try to do a re-build with these project files under Mac? does it work?
* Do you have a workspace file that covers all project files?
* Why did you change update30 script, esp. removing the optional tools? This should actually work...
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on January 31, 2016, 12:26:59 pm
* Did you try to do a re-build with these project files under Mac? does it work?
Yes, it works on Mac OS Yosemite. But bugs should be fixed. Dan Kulp's pacthes are necessarily needed.

* Do you have a workspace file that covers all project files?
I have a workspace file named by CodeBlocks_wx30-mac.workspace, it also works well.

* Why did you change update30 script, esp. removing the optional tools? This should actually work...
Because the same scripts have been added to the corresponding cbp files, e.g. lib_finder_wx30-mac.cbp, etc.

I have made some modifications on my patch today. Please see this attachment.

Final modification of my patch is attached. It's time to Dan Kulp's patches to fix long-time standing bugs on Mac OS.
Title: Re: Release 16.01 for Mac
Post by: dkulp on February 01, 2016, 03:46:55 pm

It's a shame that CB isn't on GitHub and we could just submit pull pull requests...

I've attached my changes to the src tree.   They pretty much fall into three categories:

1) Retina support - wxsdrawingwindow.cpp needs a bunch of changes to work properly on Retina screens.   That said, this ALSO requires a bunch of patches to wxWidgets which have been submitted there.   My fork of wxWidgets has the needed fixes:

https://github.com/dkulp/wxWidgets/tree/WX_3_0_BRANCH

2) Plugin loading - when building from command line and running "make install", plugins are in a different place and named differently than when built form within CB and/or packaged in an app.   The patch tries to account for the various options.

3) Minor startup performance thing - for some reason (not sure why), a bunch of the png files are being copied during make install which is causing wxImage to not be valid which takes a second per image to generate a stack trace.  Ideally, I'd fix the image copying, but for now, if the image is no OK, use a null bitmap.

Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on February 01, 2016, 07:45:59 pm
It's a shame that CB isn't on GitHub and we could just submit pull pull requests...
C::B is on GitHub, e.g. here:
https://github.com/obfuscated/codeblocks_sf

This is regularly sync'd with the "golden" SVN repo. So you can provide pull requests if you explain and talk to obfuscated the developer behind this GIT repo clone.

I'll do my best to collect all Mac related stuff, nag me if you miss anything. For now, I am collecting until you tell that's really it an it works. For the moment I see version coming everyday, so I won't commit until its kind of final.

One thing please notice: Try to avoid to change code or scripts that may affect other platforms, especially Linux. Or, if you have to, please state explicitly what function needs to be tested on other platforms. You can freely add new scripts (like update30_mac), of course.

Also, please state for what build the patch is for. Keep in mind that on the Mac you'll have two options: Building with autotools or with C::B itself. Its easier to understand your changes if you mention the target build system.
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on February 01, 2016, 09:25:40 pm
The current workflow doesn't support the typical pull-request workflow, because of svn<->git/git svn limitations.
In order for some branch to be committed in svn it needs to be rebase-able on the master branch. If you fulfil this requirement, I can commit such branches.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 03, 2016, 08:02:56 am

It's a shame that CB isn't on GitHub and we could just submit pull pull requests...

I've attached my changes to the src tree.   They pretty much fall into three categories:

1) Retina support - wxsdrawingwindow.cpp needs a bunch of changes to work properly on Retina screens.   That said, this ALSO requires a bunch of patches to wxWidgets which have been submitted there.   My fork of wxWidgets has the needed fixes:

https://github.com/dkulp/wxWidgets/tree/WX_3_0_BRANCH

2) Plugin loading - when building from command line and running "make install", plugins are in a different place and named differently than when built form within CB and/or packaged in an app.   The patch tries to account for the various options.

3) Minor startup performance thing - for some reason (not sure why), a bunch of the png files are being copied during make install which is causing wxImage to not be valid which takes a second per image to generate a stack trace.  Ideally, I'd fix the image copying, but for now, if the image is no OK, use a null bitmap.

Hi, Dan! I have made another try to build CB on Mac OS by merging your patches into CB source tree. My steps are as follows:
Code: bash
$ git clone https://github.com/wxWidgets/wxWidgets.git -b WX_3_0_BRANCH --depth=1
$ cd wxWidgets
$ mkdir cocoabuild && cd cocoabuild
$ ../configure --enable-monolithic --with-macosx-version-min=10.7 --enable-debug=no --with-cocoa CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" CPPFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" CXX=clang++ CXXCPP="clang++ -E" CC=clang CPP="clang -E" --enable-shared --enable-unicode --enable-threads --without-subdirs
$ make
then do some patches and bootstrap CB by CB. The binary file is located at
https://fedorapeople.org/~easior/CodeBlocks-Mac-16.01-r1.tar.bz2.
I found that some bugs are fixed, e.g. changing font size in CB Editor does not make CB crash. However, my binary file is full of bugs. For examples:
* mouse scrolling in CB Editor with some source codes will make CB crashed;
* Compiler plugin does not work well because the build target of project to build is not displayed on compiler toolbar.

The attachment is the patch which have been merged together.
Title: Re: Release 16.01 for Mac
Post by: dkulp on February 03, 2016, 08:29:06 pm

Hi, Dan! I have made another try to build CB on Mac OS by merging your patches into CB source tree. My steps are as follows:
Code: bash
$ git clone https://github.com/wxWidgets/wxWidgets.git -b WX_3_0_BRANCH --depth=1
$ cd wxWidgets
$ mkdir cocoabuild && cd cocoabuild
$ ../configure --enable-monolithic --with-macosx-version-min=10.7 --enable-debug=no --with-cocoa CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" CPPFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" CXX=clang++ CXXCPP="clang++ -E" CC=clang CPP="clang -E" --enable-shared --enable-unicode --enable-threads --without-subdirs
$ make
then do some patches and bootstrap CB by CB.

If you plan on making a binary that will actually look great on a Retina display, you'll need my fixes to wxWidgets.   They are in my fork of wxWidgets:
https://github.com/dkulp/wxWidgets
on the  WX_3_0_BRANCH branch there.   I've submitted pull requests back, but  they haven't applied them yet.

That said, we also need to add some flags to the Info.plist:

Code
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>

to turn on support.  Your binary isn't allowing it to use the retina display resolution.

Quote
The binary file is located at
https://fedorapeople.org/~easior/CodeBlocks-Mac-16.1-r1.tar.bz2.
I found that some bugs are fixed, e.g. changing font size in CB Editor does not make CB crash. However, my binary file is full of bugs. For examples:
* mouse scrolling in CB Editor with some source codes will make CB crashed;
* Compiler plugin does not work well because the build target of project to build is not displayed on compiler toolbar.

The attachment is the patch which have been merged together.

I don't build anything from with CB, I pretty much just use it for wxSmith.  The scrolling crash looks like it's in Scintilla which I know nothing about. 

I stuck a new binary up at:
http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz

that I build from the command line and should be retina ready.   
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 04, 2016, 02:38:32 am
They are in my fork of wxWidgets:
https://github.com/dkulp/wxWidgets
on the  WX_3_0_BRANCH branch there.   I've submitted pull requests back, but  they haven't applied them yet.

Your branch can't be compiled on My Mac, for
Code: bash
../src/osx/cocoa/window.mm:514:50: warning: 'convertBaseToScreen:' is deprecated: first deprecated in OS X 10.7 - Use -convertRectToScreen: instead [-Wdeprecated-declarations]
            locationInWindow = [[nsEvent window] convertBaseToScreen:locationInWindow];
                                                 ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:661:1: note: 'convertBaseToScreen:' has been explicitly marked deprecated here
- (NSPoint)convertBaseToScreen:(NSPoint)aPoint __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.7,message="" "Use -convertRectToScreen: instead")));
^
../src/osx/cocoa/window.mm:517:52: warning: 'convertScreenToBase:' is deprecated: first deprecated in OS X 10.7 - Use -convertRectFromScreen: instead [-Wdeprecated-declarations]
            locationInWindow = [[m_osxView window] convertScreenToBase:locationInWindow];
                                                   ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:662:1: note: 'convertScreenToBase:' has been explicitly marked deprecated here
- (NSPoint)convertScreenToBase:(NSPoint)aPoint __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.7,message="" "Use -convertRectFromScreen: instead")));
^
../src/osx/cocoa/window.mm:2439:46: error: use of undeclared identifier 'NSTextAlignmentCenter'
                [paragraphStyle setAlignment:NSTextAlignmentCenter];
                                             ^
../src/osx/cocoa/window.mm:2461:24: warning: 'NSView' may not respond to 'setAttributedTitle:'
            [m_osxView setAttributedTitle:attrString];
             ~~~~~~~~~ ^
../src/osx/cocoa/window.mm:2886:40: warning: 'convertScreenToBase:' is deprecated: first deprecated in OS X 10.7 - Use -convertRectFromScreen: instead [-Wdeprecated-declarations]
        location = [[m_osxView window] convertScreenToBase:location];
                                       ^
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:662:1: note: 'convertScreenToBase:' has been explicitly marked deprecated here
- (NSPoint)convertScreenToBase:(NSPoint)aPoint __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.7,message="" "Use -convertRectFromScreen: instead")));
^
4 warnings and 1 error generated.
make: *** [monodll_osx_cocoa_window.o] Error 1

Could you fix it?

Quote
The scrolling crash looks like it's in Scintilla which I know nothing about. 
Hi, Dan! Could you share any experiences on how to debug the CB binary? Is there any effective debugging tool to be recommended?

Quote
I stuck a new binary up at:
http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz
Unfortunately, Your binary also has a bug. It will crash if you open a c++ source code and format it by choosing format use astyle in a popup menu with right mouse clicking.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 06, 2016, 05:47:39 am
I made another build which is more stable than ever. However, new completion plugin does not still work well. The following attachments are the recently crashing report.
Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on February 06, 2016, 12:39:26 pm
I made another build which is more stable than ever.
...where?! :-)

The following attachments are the recently crashing report.
Did you strip the sources? Because all lines are missing. For the development on the Mac you should not strip anything. This will help to track down the errors.
Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on February 06, 2016, 12:48:40 pm
...wrt the patch you kindly provided: The method:
m_Bitmap->CreateScaled
...is not available on wx2.8.x. Therefore the build will be broken with that version. You'll need to wrap this into a wxCHECK_VERSION or alike.
Title: Re: Release 16.01 for Mac
Post by: dkulp on February 06, 2016, 02:51:06 pm
...wrt the patch you kindly provided: The method:
m_Bitmap->CreateScaled
...is not available on wx2.8.x. Therefore the build will be broken with that version. You'll need to wrap this into a wxCHECK_VERSION or alike.

Personally, I would suggest requiring 3.0.x for the Mac.   There are so many parts of wxWidgets that will cause awful behavior or crashes with 2.8.x on the Mac, particularly with Yosemite or newer.   Without my fixes to 3.0.x, the Retina support is pretty bad as well, particularly for wxSmith.  :(


Title: Re: Release 16.01 for Mac
Post by: MortenMacFly on February 06, 2016, 03:14:21 pm
Personally, I would suggest requiring 3.0.x for the Mac.
I have not problem with that, but as long as we don't have a stable wx3.0 for all platforms we need to consider using wx28 on other platforms as base.

If you wrap this code into
Code: cpp
#ifdef wxCHECK_VERSION(3, 0, 0)
 ... // new code
#else
 ... // old code
#endif

All is fine.

We surely target supporting wx3 for the next release.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 06, 2016, 11:31:07 pm
...where?! :-)

It is at https://fedorapeople.org/~easior/CodeBlocks-Mac-16.01-r2-debug.tar.bz2 with debug symbols.

Quote
Did you strip the sources? Because all lines are missing. For the development on the Mac you should not strip anything. This will help to track down the errors.
Ok. I have changed the value of variable CB_RELEASE_TYPE from -O2 to -g and temporally comment all strip scripts in update30.

All cbp files for Mac OS, I think, work fine. It should be committed to CB source tree. I have abandoned patch for update30 since there are there places to hold update scripts, i.e CB_DIR/src, PLUGIN_DIR/ and cbp file for plugin.

There is also some bug for wxsmith (see the second attachment).
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 14, 2016, 10:40:31 am
Did you strip the sources? Because all lines are missing. For the development on the Mac you should not strip anything. This will help to track down the errors.

CB has crashed again. It complained that
Code: xml
<?xml version="1.0" encoding="UTF-8"?>
<report version="1.0" kind="exception">
  <system description="Mac OS X (Darwin 14.5.0 x86_64)"/>
  <stack>
    <frame level="0" function="wxDebugReport::AddContext(wxDebugReport::Context) " offset="00000000" file="debugrpt.cpp" line="49"/>
    <frame level="1" function="wxDebugReport::AddAll(wxDebugReport::Context) " offset="00000000" file="debugrpt.cpp" line="35"/>
    <frame level="2" function="CodeBlocksApp::OnFatalException() " offset="00000000" file="app.cpp" line="88"/>
    <frame level="3" function="wxFatalSignalHandler " offset="00000000" file="utilsunx.cpp" line="139"/>
    <frame level="4" function="_sigtramp " offset="00000000"/>
    <frame level="5" function="_sigtramp " offset="00000000"/>
    <frame level="6" function="CallTip::CallTipCancel() " offset="00000000" file="CallTip.cxx" line="30"/>
    <frame level="7" function="ScintillaBase::WndProc(unsigned int, unsigned long, long) " offset="00000000" file="ScintillaBase.cxx" line="92"/>
    <frame level="8" function="ScintillaWX::WndProc(unsigned int, unsigned long, long) " offset="00000000" file="ScintillaWX.cpp" line="94"/>
    <frame level="9" function="wxScintilla::SendMsg(unsigned int, unsigned long, long) const " offset="00000000" file="wxscintilla.cpp" line="26"/>
    <frame level="10" function="wxScintilla::CallTipCancel() " offset="00000000" file="wxscintilla.cpp" line="200"/>
    <frame level="11" function="cbStyledTextCtrl::CallTipCancel() " offset="00000000" file="cbstyledtextctrl.cpp" line="33"/>
    <frame level="12" function="cbStyledTextCtrl::OnKillFocus(wxFocusEvent&amp;) " offset="00000000" file="cbstyledtextctrl.cpp" line="8"/>
    <frame level="13" function="wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&amp;), wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="61"/>
    <frame level="14" function="wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&amp;, wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="62"/>
    <frame level="15" function="wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;) " offset="00000000" file="event.cpp" line="139"/>
    <frame level="16" function="wxEventHashTable::HandleEvent(wxEvent&amp;, wxEvtHandler*) " offset="00000000" file="event.cpp" line="99"/>
    <frame level="17" function="wxEvtHandler::TryHereOnly(wxEvent&amp;) " offset="00000000" file="event.cpp" line="158"/>
    <frame level="18" function="wxEvtHandler::TryBeforeAndHere(wxEvent&amp;) " offset="00000000" file="event.h" line="367"/>
    <frame level="19" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="148"/>
    <frame level="20" function="wxEvtHandler::DoTryChain(wxEvent&amp;) " offset="00000000" file="event.cpp" line="155"/>
    <frame level="21" function="wxEvtHandler::ProcessEventLocally(wxEvent&amp;) " offset="00000000" file="event.cpp" line="152"/>
    <frame level="22" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="149"/>
    <frame level="23" function="wxEvtHandler::SafelyProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="161"/>
    <frame level="24" function="wxWindowBase::HandleWindowEvent(wxEvent&amp;) const " offset="00000000" file="wincmn.cpp" line="152"/>
    <frame level="25" function="wxWidgetCocoaImpl::DoNotifyFocusEvent(bool, wxWidgetImpl*) " offset="00000000" file="window.mm" line="287"/>
    <frame level="26" function="wxWidgetCocoaImpl::DoNotifyFocusLost() " offset="00000000" file="window.mm" line="283"/>
    <frame level="27" function="wxWidgetCocoaImpl::resignFirstResponder(NSView*, void*) " offset="00000000" file="window.mm" line="153"/>
    <frame level="28" function="wxOSX_resignFirstResponder(NSView*, objc_selector*) " offset="00000000" file="window.mm" line="105"/>
    <frame level="29" function="-[NSWindow makeFirstResponder:] " offset="00000000"/>
    <frame level="30" function="-[wxNSWindow makeFirstResponder:] " offset="00000000" file="nonownedwnd.mm" line="21"/>
    <frame level="31" function="-[wxNonOwnedWindowController windowDidResignKey:] " offset="00000000" file="nonownedwnd.mm" line="50"/>
    <frame level="32" function="__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ " offset="00000000"/>
    <frame level="33" function="_CFXNotificationPost " offset="00000000"/>
    <frame level="34" function="-[NSNotificationCenter postNotificationName:object:userInfo:] " offset="00000000"/>
    <frame level="35" function="-[NSWindow resignKeyWindow] " offset="00000000"/>
    <frame level="36" function="-[NSWindow _changeKeyAndMainLimitedOK:] " offset="00000000"/>
    <frame level="37" function="-[NSWindow _makeKeyRegardlessOfVisibility] " offset="00000000"/>
    <frame level="38" function="-[NSWindow makeKeyAndOrderFront:] " offset="00000000"/>
    <frame level="39" function="wxNonOwnedWindowCocoaImpl::Show(bool) " offset="00000000" file="nonownedwnd.mm" line="77"/>
    <frame level="40" function="wxNonOwnedWindow::Show(bool) " offset="00000000" file="nonownedwnd_osx.cpp" line="37"/>
    <frame level="41" function="Window::Show(bool) " offset="00000000" file="PlatWX.cpp" line="80"/>
    <frame level="42" function="ScintillaWX::WndProc(unsigned int, unsigned long, long) " offset="00000000" file="ScintillaWX.cpp" line="92"/>
    <frame level="43" function="wxScintilla::SendMsg(unsigned int, unsigned long, long) const " offset="00000000" file="wxscintilla.cpp" line="26"/>
    <frame level="44" function="wxScintilla::CallTipShow(int, wxString const&amp;) " offset="00000000" file="wxscintilla.cpp" line="200"/>
    <frame level="45" function="CCManager::DoShowTips(std::__1::vector&lt;wxString, std::__1::allocator&lt;wxString&gt; &gt; const&amp;, cbStyledTextCtrl*, int, int, int, int) " offset="00000000" file="ccmanager.cpp" line="137"/>
    <frame level="46" function="CCManager::OnEditorTooltip(CodeBlocksEvent&amp;) " offset="00000000" file="ccmanager.cpp" line="71"/>
    <frame level="47" function="cbEventFunctor&lt;CCManager, CodeBlocksEvent&gt;::Call(CodeBlocksEvent&amp;) " offset="00000000" file="cbfunctor.h" line="4"/>
    <frame level="48" function="Manager::ProcessEvent(CodeBlocksEvent&amp;) " offset="00000000" file="manager.cpp" line="26"/>
    <frame level="49" function="PluginManager::NotifyPlugins(CodeBlocksEvent&amp;) " offset="00000000" file="pluginmanager.cpp" line="145"/>
    <frame level="50" function="cbEditor::NotifyPlugins(int, int, wxString const&amp;, int, int) " offset="00000000" file="cbeditor.cpp" line="82"/>
    <frame level="51" function="cbEditor::OnEditorDwellStart(wxScintillaEvent&amp;) " offset="00000000" file="cbeditor.cpp" line="327"/>
    <frame level="52" function="wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&amp;), wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="61"/>
    <frame level="53" function="wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&amp;, wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="62"/>
    <frame level="54" function="wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;) " offset="00000000" file="event.cpp" line="139"/>
    <frame level="55" function="wxEvtHandler::SearchDynamicEventTable(wxEvent&amp;) " offset="00000000" file="event.cpp" line="174"/>
    <frame level="56" function="wxEvtHandler::TryHereOnly(wxEvent&amp;) " offset="00000000" file="event.cpp" line="158"/>
    <frame level="57" function="wxEvtHandler::TryBeforeAndHere(wxEvent&amp;) " offset="00000000" file="event.h" line="367"/>
    <frame level="58" function="wxEvtHandler::ProcessEventLocally(wxEvent&amp;) " offset="00000000" file="event.cpp" line="152"/>
    <frame level="59" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="149"/>
    <frame level="60" function="wxWindowBase::TryAfter(wxEvent&amp;) " offset="00000000" file="wincmn.cpp" line="342"/>
    <frame level="61" function="wxEvtHandler::TryAfter(wxEvent&amp;) " offset="00000000" file="event.cpp" line="144"/>
    <frame level="62" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="150"/>
    <frame level="63" function="wxScintilla::NotifyParent(SCNotification*) " offset="00000000" file="wxscintilla.cpp" line="570"/>
    <frame level="64" function="ScintillaWX::NotifyParent(SCNotification) " offset="00000000" file="ScintillaWX.cpp" line="54"/>
    <frame level="65" function="Editor::NotifyDwelling(Point, bool) " offset="00000000" file="Editor.cxx" line="240"/>
    <frame level="66" function="Editor::TickFor(Editor::TickReason) " offset="00000000" file="Editor.cxx" line="465"/>
    <frame level="67" function="ScintillaWX::DoOnTimer(wxTimerEvent&amp;) " offset="00000000" file="ScintillaWX.cpp" line="132"/>
    <frame level="68" function="wxScintilla::OnTimer(wxTimerEvent&amp;) " offset="00000000" file="wxscintilla.cpp" line="550"/>
    <frame level="69" function="wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&amp;), wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="61"/>
    <frame level="70" function="wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&amp;, wxEvent&amp;) const " offset="00000000" file="appbase.cpp" line="62"/>
    <frame level="71" function="wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&amp;, wxEvtHandler*, wxEvent&amp;) " offset="00000000" file="event.cpp" line="139"/>
    <frame level="72" function="wxEvtHandler::SearchDynamicEventTable(wxEvent&amp;) " offset="00000000" file="event.cpp" line="174"/>
    <frame level="73" function="wxEvtHandler::TryHereOnly(wxEvent&amp;) " offset="00000000" file="event.cpp" line="158"/>
    <frame level="74" function="wxEvtHandler::TryBeforeAndHere(wxEvent&amp;) " offset="00000000" file="event.h" line="367"/>
    <frame level="75" function="wxEvtHandler::ProcessEventLocally(wxEvent&amp;) " offset="00000000" file="event.cpp" line="152"/>
    <frame level="76" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="149"/>
    <frame level="77" function="wxEvtHandler::SafelyProcessEvent(wxEvent&amp;) " offset="00000000" file="event.cpp" line="161"/>
    <frame level="78" function="wxTimerImpl::SendEvent() " offset="00000000" file="timerimpl.cpp" line="5"/>
    <frame level="79" function="wxTimer::Notify() " offset="00000000" file="timercmn.cpp" line="10"/>
    <frame level="80" function="wxTimerImpl::Notify() " offset="00000000" file="timer.h" line="4"/>
    <frame level="81" function="wxProcessTimer(__CFRunLoopTimer*, void*) " offset="00000000" file="timer.cpp" line="3"/>
    <frame level="82" function="__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ " offset="00000000"/>
    <frame level="83" function="__CFRunLoopDoTimer " offset="00000000"/>
    <frame level="84" function="__CFRunLoopDoTimers " offset="00000000"/>
    <frame level="85" function="__CFRunLoopRun " offset="00000000"/>
    <frame level="86" function="CFRunLoopRunSpecific " offset="00000000"/>
    <frame level="87" function="RunCurrentEventLoopInMode " offset="00000000"/>
    <frame level="88" function="ReceiveNextEventCommon " offset="00000000"/>
    <frame level="89" function="_BlockUntilNextEventMatchingListInModeWithFilter " offset="00000000"/>
    <frame level="90" function="_DPSNextEvent " offset="00000000"/>
    <frame level="91" function="-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] " offset="00000000"/>
    <frame level="92" function="-[NSApplication run] " offset="00000000"/>
    <frame level="93" function="wxGUIEventLoop::OSXDoRun() " offset="00000000" file="evtloop.mm" line="30"/>
    <frame level="94" function="wxCFEventLoop::DoRun() " offset="00000000" file="evtloop_cf.cpp" line="34"/>
    <frame level="95" function="wxEventLoopBase::Run() " offset="00000000" file="evtloopcmn.cpp" line="7"/>
    <frame level="96" function="wxAppConsoleBase::MainLoop() " offset="00000000" file="appbase.cpp" line="33"/>
    <frame level="97" function="wxAppConsoleBase::OnRun() " offset="00000000" file="appbase.cpp" line="25"/>
    <frame level="98" function="wxAppBase::OnRun() " offset="00000000" file="appcmn.cpp" line="30"/>
    <frame level="99" function="wxApp::OnRun() " offset="00000000" file="app.cpp" line="92"/>
    <frame level="100" function="CodeBlocksApp::OnRun() " offset="00000000" file="app.cpp" line="85"/>
    <frame level="101" function="wxEntry(int&amp;, wchar_t**) " offset="00000000" file="init.cpp" line="50"/>
    <frame level="102" function="wxEntry(int&amp;, char**) " offset="00000000" file="init.cpp" line="51"/>
    <frame level="103" function="main " offset="00000000" file="app.cpp" line="32"/>
    <frame level="104" function="start " offset="00000000"/>
  </stack>
</report>
Any clue to debug?
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on February 14, 2016, 11:49:37 am
Does it happen every time or is it just some random event?
You can try to start cb under lldb/gdb and wait for the crash to happen.
Then inspect the variables.

The line numbers in the crash report are totally wrong (the last character is removed).
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on February 14, 2016, 11:58:59 am
If the backtrace is correct the crash has happened, because the editor has lost the focus while the tooltip is still being created.
Which leads to the tooltip being destroyed in an unexpected time.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 14, 2016, 12:24:04 pm
Does it happen every time or is it just some random event?

It happened while mouse scrolling in CB editor with some source codes.

Quote from: oBFusCATed
You can try to start cb under lldb/gdb and wait for the crash to happen.
Then inspect the variables.

The line numbers in the crash report are totally wrong (the last character is removed).

Thanks. lldb is used by me  this time to debug and it gives some information as follow:
Code: bash
Process 62378 stopped
* thread #1: tid = 0x7770f, 0x0000000101f9025d libcodeblocks.dylib`Window::Destroy(this=0x0000000110f2ed90) + 61 at PlatWX.cpp:764, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000101f9025d libcodeblocks.dylib`Window::Destroy(this=0x0000000110f2ed90) + 61 at PlatWX.cpp:764
   761 {
   762     if (wid) {
   763         Show(false);
-> 764         GETWIN(wid)->Destroy();
   765     }
   766     wid = 0;
   767 }
(lldb)

Any suggestion?
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on February 14, 2016, 12:59:22 pm
Any suggestion?
Am I correct in my guess that the calltip is cancelled while it is being created?
Probably you can add a flag that marks the beginning/end of the calltip creation and then don't call the cancel function if this flag is set.
Or find out why the creation or cancellation is happening.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on February 14, 2016, 01:18:08 pm
Am I correct in my guess that the calltip is cancelled while it is being created?

I don't know whether you are correct or not since I'm not familiar with the CB sources.

Quote from: oBFusCATed
Probably you can add a flag that marks the beginning/end of the calltip creation and then don't call the cancel function if this flag is set.
How to add a flag? Do you mean that setting a breakpoint in lldb to debug CB?
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on February 14, 2016, 02:45:15 pm
I don't know whether you are correct or not since I'm not familiar with the CB sources.
Just inspect the backtrace. The name of the function on it will reveal what is going on.

How to add a flag? Do you mean that setting a breakpoint in lldb to debug CB?
Modify the source by adding a bool flag then when you start the method that creates the calltip set it to true, when the method exits set it to false. Lastly add a check if the flag is set in the onkillfocus method.
Title: Re: Release 16.01 for Mac
Post by: ollydbg on February 14, 2016, 03:22:55 pm
Does it happen every time or is it just some random event?

It happened while mouse scrolling in CB editor with some source codes.

Quote from: oBFusCATed
You can try to start cb under lldb/gdb and wait for the crash to happen.
Then inspect the variables.

The line numbers in the crash report are totally wrong (the last character is removed).

Thanks. lldb is used by me  this time to debug and it gives some information as follow:
Code: bash
Process 62378 stopped
* thread #1: tid = 0x7770f, 0x0000000101f9025d libcodeblocks.dylib`Window::Destroy(this=0x0000000110f2ed90) + 61 at PlatWX.cpp:764, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000101f9025d libcodeblocks.dylib`Window::Destroy(this=0x0000000110f2ed90) + 61 at PlatWX.cpp:764
   761 {
   762     if (wid) {
   763         Show(false);
-> 764         GETWIN(wid)->Destroy();
   765     }
   766     wid = 0;
   767 }
(lldb)

Any suggestion?
If I remember correctly, there are similar crashes under Windows system several years ago, and later we fixed it. You need to search the forum to find the discussions. oBFusCATed's explanation is reasonable as I can see.
Title: Re: Release 16.01 for Mac
Post by: Easior Lars on March 11, 2016, 11:08:35 am
Since a file name may include characters which need to be escaped to be passed to a shell command, the following patch is needed:
Code: bash
Index: src/sdk/globals.cpp
===================================================================
--- src/sdk/globals.cpp (revision 10805)
+++ src/sdk/globals.cpp (working copy)
@@ -58,7 +58,7 @@
 #ifndef __WXMAC__
 const wxString DEFAULT_CONSOLE_TERM  = _T("xterm -T $TITLE -e");
 #else
-const wxString DEFAULT_CONSOLE_TERM  = _T("osascript -e 'tell app \"Terminal\"' -e 'activate' -e 'do script \"$SCRIPT\"' -e 'end tell'");
+const wxString DEFAULT_CONSOLE_TERM  = _T("osascript -e 'tell app \"Terminal\"' -e 'activate' -e 'do script quoted form of \"$SCRIPT\"' -e 'end tell'");
 #endif
 const wxString DEFAULT_CONSOLE_SHELL = _T("/bin/sh -c");
Title: Re: Release 16.01 for Mac
Post by: oBFusCATed on March 11, 2016, 11:56:18 pm
In svn thanks for the contribution.
Title: Re: Release 16.01 for Mac
Post by: guoqingaa on October 08, 2016, 05:23:46 am

I stuck an experimental OSX build up at:

http://dankulp.com/xlights/CodeBlocks-MAC-16.1.tar.gz

This is using a custom build of wxWidgets 3.0.x  which is the latest code from git + a bunch of fixes that I submitted back to them in a pull request.   It also contains some fixes to Code::Blocks to get it working on MAC, particularly finding plugins with the ".app" as well as some fixes for Retina displays.   Not all those fixes are submitted back yet.

Very minimal testing has been done as I pretty much just use it for wxSmith.

in mac os x 10.12, not create wxSmith project, the error report is:
Code: xml
<?xml version="1.0" encoding="UTF-8"?>
<report version="1.0" kind="exception">
  <system description="Mac OS X (Darwin 16.0.0 x86_64)"/>
  <stack>
    <frame level="0" function="wxFatalSignalHandler " offset="00000000"/>
    <frame level="1" function="_sigtramp " offset="00000000"/>
    <frame level="2" function="_sigtramp " offset="00000000"/>
    <frame level="3" function="wxEncodingConverter::Init(wxFontEncoding, wxFontEncoding, int) " offset="00000000"/>
    <frame level="4" function="EncodingDetector::ConvertToWxString(unsigned char const*, unsigned long) " offset="00000000"/>
    <frame level="5" function="EncodingDetector::DetectEncoding(unsigned char const*, unsigned long, bool) " offset="00000000"/>
    <frame level="6" function="EncodingDetector::DetectEncoding(wxString const&amp;, bool) " offset="00000000"/>
    <frame level="7" function="EncodingDetector::EncodingDetector(wxString const&amp;, bool) " offset="00000000"/>
    <frame level="8" function="wxsCoder::FlushFile(wxString const&amp;) " offset="00000000"/>
    <frame level="9" function="wxsCoder::AddCode(wxString const&amp;, wxString const&amp;, wxString const&amp;, wxString const&amp;, bool, bool, bool) " offset="00000000"/>
    <frame level="10" function="wxWidgetsGUI::OnRebuildApplicationCode() " offset="00000000"/>
    <frame level="11" function="(anonymous namespace)::AddWxExtensions(cbProject*, wxString const&amp;, wxString const&amp;, wxString const&amp;, wxString const&amp;) " offset="00000000"/>
    <frame level="12" function="long SqPlus::ReturnSpecialization&lt;void&gt;::Call&lt;cbProject*, wxString const&amp;, wxString const&amp;, wxString const&amp;, wxString const&amp;&gt;(void (*)(cbProject*, wxString const&amp;, wxString const&amp;, wxString const&amp;, wxString const&amp;), SQVM*, long) " offset="00000000"/>
    <frame level="13" function="SqPlus::DirectCallFunction&lt;void (*)(cbProject*, wxString const&amp;, wxString const&amp;, wxString const&amp;, wxString const&amp;)&gt;::Dispatch(SQVM*) " offset="00000000"/>
    <frame level="14" function="SQVM::CallNative(SQNativeClosure*, long, long, SQObjectPtr&amp;, bool&amp;) " offset="00000000"/>
    <frame level="15" function="SQVM::Execute(SQObjectPtr&amp;, long, long, long, SQObjectPtr&amp;, unsigned long, SQVM::ExecutionType) " offset="00000000"/>
    <frame level="16" function="SQVM::Call(SQObjectPtr&amp;, long, long, SQObjectPtr&amp;, unsigned long) " offset="00000000"/>
    <frame level="17" function="sq_call " offset="00000000"/>
    <frame level="18" function="bool SqPlus::SquirrelFunction&lt;bool&gt;::operator()&lt;cbProject*&gt;(cbProject*) " offset="00000000"/>
    <frame level="19" function="Wiz::RunProjectWizard(wxString*) " offset="00000000"/>
    <frame level="20" function="Wiz::Launch(int, wxString*) " offset="00000000"/>
    <frame level="21" function="TemplateManager::New(TemplateOutputType, wxString*) " offset="00000000"/>
    <frame level="22" function="MainFrame::OnFileNewWhat(wxCommandEvent&amp;) " offset="00000000"/>
    <frame level="23" function="MainFrame::OnStartHereLink(wxCommandEvent&amp;) " offset="00000000"/>
    <frame level="24" function="wxEventHashTable::HandleEvent(wxEvent&amp;, wxEvtHandler*) " offset="00000000"/>
    <frame level="25" function="wxEvtHandler::ProcessEventLocally(wxEvent&amp;) " offset="00000000"/>
    <frame level="26" function="wxEvtHandler::ProcessEvent(wxEvent&amp;) " offset="00000000"/>
    <frame level="27" function="wxEvtHandler::ProcessPendingEvents() " offset="00000000"/>
    <frame level="28" function="wxAppConsoleBase::ProcessPendingEvents() " offset="00000000"/>
    <frame level="29" function="wxCFEventLoop::OSXCommonModeObserverCallBack(__CFRunLoopObserver*, int, void*) " offset="00000000"/>
    <frame level="30" function="__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ " offset="00000000"/>
    <frame level="31" function="__CFRunLoopDoObservers " offset="00000000"/>
    <frame level="32" function="__CFRunLoopRun " offset="00000000"/>
    <frame level="33" function="CFRunLoopRunSpecific " offset="00000000"/>
    <frame level="34" function="RunCurrentEventLoopInMode " offset="00000000"/>
    <frame level="35" function="ReceiveNextEventCommon " offset="00000000"/>
    <frame level="36" function="_BlockUntilNextEventMatchingListInModeWithFilter " offset="00000000"/>
    <frame level="37" function="_DPSNextEvent " offset="00000000"/>
    <frame level="38" function="-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] " offset="00000000"/>
    <frame level="39" function="-[NSApplication run] " offset="00000000"/>
    <frame level="40" function="wxGUIEventLoop::OSXDoRun() " offset="00000000"/>
    <frame level="41" function="wxCFEventLoop::DoRun() " offset="00000000"/>
    <frame level="42" function="wxEventLoopBase::Run() " offset="00000000"/>
    <frame level="43" function="wxAppConsoleBase::MainLoop() " offset="00000000"/>
    <frame level="44" function="wxApp::OnRun() " offset="00000000"/>
    <frame level="45" function="CodeBlocksApp::OnRun() " offset="00000000"/>
    <frame level="46" function="wxEntry(int&amp;, wchar_t**) " offset="00000000"/>
    <frame level="47" function="main " offset="00000000"/>
    <frame level="48" function="start " offset="00000000"/>
  </stack>
</report>

help me, In the apple system 10.12 below, can not build the project, in addition, the new project template can support wxWidgets 3.1. Because of the QTKit problem, OSX 10.12 can not normally compile wxWidgets 3.1, can only be compiled under 10.11, and then get the use, CodeBlockes can provide a compiled binary version of the wxWidgets download, CodeBlockes can be a perfect support for OSX 10.12 and 3.x wxWidgets, thank you, from China

Edit: Removed non-english content.