Author Topic: Mac OS development  (Read 20731 times)

Offline roxlu

  • Multiple posting newcomer
  • *
  • Posts: 35
Mac OS development
« on: January 24, 2010, 11:27:54 pm »
Hi,

I want to help with the development of Code::Blocks on Mac osx. I've been using
Code::Blocks on windows for a while and I just love it. Though on Mac it's not really
stable. As I'll be developing a lot on a Mac (I recently switched over totally) I want
to start fixing some things.

I'm wondering if there is someone else, hopefully the lead developer, with whom I can
start this. I've been downloading the SVN trunk a couple of times this week and each
time I try to compile it on my Mac the compilation breaks at some point. Most of these
errors are because of Mac related issues with wxWidgets. I've been able to fix most
of them and got it compiled.

I would love to help and create a compilable version of the trunk on MacOS. I'm often on
irc, so just msg me when you've got some time or to make an appointment to fix some things!

Roxlu

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Mac OS development
« Reply #1 on: January 25, 2010, 06:30:22 am »
I want to help with the development of Code::Blocks on Mac osx.
That is great news! A user with the nickname "afb" (http://forums.codeblocks.org/index.php?action=profile;u=1384) in this forum may help you with starting. Any patches concerning MAC are welcome and will be prioritised (as most of the core team does not have a MAC). Hence please make sure you follow our code style and comment what and why you changed so we can understand and don't remove it in the code later again. ;-) Also (if possible) cross-check your modifications with another OS (Windows or Linux), hence it's not a must as other people can do that, too.
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 afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Mac OS development
« Reply #2 on: January 25, 2010, 09:19:38 am »
The build procedure is outlined, although a bit outdated on the Wiki:
Installing_Code::Blocks_from_source_on_Mac_OS_X

That page should be updated for Mac OS X 10.6 and wxWidgets 2.8,
as it's currently covering 10.4 and 2.6. No major differences, though.

Basically it's just ./configure && make just like everywhere else...
I haven't used C::B to rebuild itself, although that is a possibility ?

PS. Most people do have a MAC, even if not everyone has a Mac. ;-)
I won't get started on the OSX name, other than that I don't use it.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Mac OS development
« Reply #3 on: January 25, 2010, 09:24:43 am »
PS. Most people do have a MAC, even if not everyone has a Mac. ;-)
Right. :lol:
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 afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Mac OS development
« Reply #4 on: January 25, 2010, 09:51:45 am »
I'm wondering if there is someone else, hopefully the lead developer, with whom I can
start this. I've been downloading the SVN trunk a couple of times this week and each
time I try to compile it on my Mac the compilation breaks at some point. Most of these
errors are because of Mac related issues with wxWidgets. I've been able to fix most
of them and got it compiled.

I'm not aware of any major compilation issues, other than that
you need to use wxMac and -m32 rather than wxCocoa and -m64.

But any bug reports or code patches are most welcome, as always...
(Some bugs are on http://developer.berlios.de/bugs/?group_id=5358)

Offline roxlu

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Mac OS development
« Reply #5 on: January 25, 2010, 10:21:41 am »
Hi afb,

I want to create  a development environment like this:
codeblocks_dev\wxwidgets_svn
codeblocks_dev\codeblocks_svn

and link codeblocks_svn against the wxwdigets_svn. I've tried to use the wxWidgets trunk but that did not work. I used this configure command:

Code
./configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa  --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin/configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa  --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin --prefix=/Users/roxlu/Documents/programming/c++/codeblocks_dev/wxwidgets_svn/wxwidgets_build

Now, I want to build C::B against this wxwidgets compilation. But each time I tried I got different errors (from redefinition to incorrent function arguments). The errors I got were probably due to the fact I used the latest svn from wxWidgets.  Do you have any idea how I can build C::B against a custom compiled wxWidgets?

Roxlu

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Mac OS development
« Reply #6 on: January 25, 2010, 10:31:44 am »
Hi afb,

I want to create  a development environment like this:
codeblocks_dev\wxwidgets_svn
codeblocks_dev\codeblocks_svn

and link codeblocks_svn against the wxwdigets_svn. I've tried to use the wxWidgets trunk but that did not work. I used this configure command:

Code
./configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa  --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin/configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa  --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin --prefix=/Users/roxlu/Documents/programming/c++/codeblocks_dev/wxwidgets_svn/wxwidgets_build

Now, I want to build C::B against this wxwidgets compilation. But each time I tried I got different errors (from redefinition to incorrent function arguments). The errors I got were probably due to the fact I used the latest svn from wxWidgets.  Do you have any idea how I can build C::B against a custom compiled wxWidgets?

Roxlu

wxWidgets trunk is not (yet) compatible with C::B.
You have to use wxWidgets 2.8 .

Offline roxlu

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Mac OS development
« Reply #7 on: January 25, 2010, 10:48:13 am »
Okay nice! I'll try that tonight!

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Mac OS development
« Reply #8 on: January 25, 2010, 11:06:40 am »
The errors I got were probably due to the fact I used the latest svn from wxWidgets.

Yes, "wrong" version (3.0) and "wrong" platform (wxOSX/Cocoa) of wxWidgets...
I suppose you could have used the WX_2_8_BRANCH in the svn too, but not the trunk.

You'll need 2.8 and wxMac for Code::Blocks to work "out of the box". Otherwise
it (and deps) needs updating to support the newer version and the new platform.
First it needs to be made to work against the (preliminary) API of the 2.9 versions,
and then it needs something like: #if defined(__WXMAC__) || defined(__WXCOCOA__)

PS. Note that wxMac only works in 32-bit mode, which is what I was saying above.
Not a major problem, as GUI doesn't need 64-bit and wxCocoa is in an "alpha" stage.
It's possible to make a Code::Blocks version that works with 2.9.0 wxCocoa as well,
but there are more important and useful things to add to the Mac OS X version I think ?

Offline roxlu

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Mac OS development
« Reply #9 on: January 25, 2010, 11:22:58 am »
Hi afb!

Thanks for your reply! Tonight I'll try and get a compilation working!

And indeed there are more important things to fix! I'm not sure, but I noticed some
shortcut key differences but I'll look into that.

Roxlu

Offline roxlu

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Mac OS development
« Reply #10 on: January 25, 2010, 11:12:11 pm »
Hi Afb,

I've tried to compile codeblocks against the wxWidgets 2.8 trunk but I get some errors.
I've compiled wxWidgets 2.8 w/o problems and used this configure:

 ./configure --enable-shared \
 --enable-monolithic \
 --enable-unicode \
 --with-png=builtin \
 --with-jpeg=builtin \
 --with-tiff=builtin \
 --with-expat=builtin/configure \
 --enable-shared \
 --enable-monolithic \
 --enable-unicode \
 --with-mac \
 --with-expat=builtin \
 --prefix=/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build/ \
 CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" \
 LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"

I configured Code::Blocks using:
./configure --prefix=${PWD}/build --with-wxdir=../wxwidets_from_svn/build/ --with-wx-config=../wxwidets_from_svn/build/bin/wx-config CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"



But I got this error:
/bin/sh ../../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//lib/wx/include/mac-unicode-release-2.8 -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__  -I./include -I./src/scintilla/include -I./src/scintilla/src -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__ -arch i386 -Ulinux -Uunix  -O2 -ffast-math -DCB_AUTOCONF -arch i386 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT ScintillaWX.lo -MD -MP -MF .deps/ScintillaWX.Tpo -c -o ScintillaWX.lo `test -f 'src/ScintillaWX.cpp' || echo './'`src/ScintillaWX.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//lib/wx/include/mac-unicode-release-2.8 -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -I./include -I./src/scintilla/include -I./src/scintilla/src -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__ -arch i386 -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -arch i386 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT ScintillaWX.lo -MD -MP -MF .deps/ScintillaWX.Tpo -c src/ScintillaWX.cpp  -fno-common -DPIC -o .libs/ScintillaWX.o
In file included from src/ScintillaWX.cpp:31:
./src/scintilla/src/ExternalLexer.h:72: error: field 'm_sModuleName' has incomplete type
make[3]: *** [ScintillaWX.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Scintilla?
The m_sModuleName is defined/used in:
src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx:                m_sModuleName = ModuleName;
src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h:  std::string                     m_sModuleName;

Any suggestions?
« Last Edit: January 25, 2010, 11:30:35 pm by roxlu »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Mac OS development
« Reply #11 on: January 26, 2010, 06:57:03 am »
Any suggestions?
Place:
Code
#include <string>
on top of the ExternalLexer.h file. Just before these lines:
Code
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
This should work. BTW: I've resolved many of such compiler errors in scintilla. If this works, please tell me and I'll apply it in trunk.
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 afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Mac OS development
« Reply #12 on: January 26, 2010, 09:03:51 am »
If this works, please tell me and I'll apply it in trunk.

Fix works for me.

There's another error in infowindow.h, but that's another story.
Code
../../../../src/include/infowindow.h:29: error: 'wxScrollingDialog' does not name a type

Missing an #include "scrollingdialog.h". But these are "generic",
and not specific to the Mac OS X build or to the wxMac platform...

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Mac OS development
« Reply #13 on: January 26, 2010, 09:16:08 am »
If this works, please tell me and I'll apply it in trunk.

Fix works for me.

There's another error in infowindow.h, but that's another story.
Code
../../../../src/include/infowindow.h:29: error: 'wxScrollingDialog' does not name a type

Missing an #include "scrollingdialog.h". But these are "generic",
and not specific to the Mac OS X build or to the wxMac platform...

There might be some more of the missing, if compiled without precompiled-headers, I try to find the missing includes and fix it.
If you use pch on mac, try to delete them manually and see if it works.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Mac OS development
« Reply #14 on: January 26, 2010, 09:47:59 am »
Not a pch-problem,  but caused if wxUSE_POPUPWIN is not defined.
Should be fixed in svn r6115.