Author Topic: Building C::B on Mac OSX High Sierra  (Read 1651 times)

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Building C::B on Mac OSX High Sierra
« on: April 10, 2018, 01:19:43 pm »
Hi all,

I have been able to build successfully C::B 13.12 on Mac OSX 10.11 El Capitan
http://forums.codeblocks.org/index.php/topic,20862.msg142429.html#msg142429
but I am struggling to build the latest svn on High Sierra. In this thread I would like to have
the chance to share my experience with other Mac users that love this IDE as much as I do
and possibly to end up with a working build.

So far I am stuck at the step of compiling squirrel, in fact it is a known issue that
has been solved by renaming type to sqtype, see here: https://github.com/albertodemichelis/squirrel/issues/98
As I am by no means a C++ programmer I am not able to apply the needed patches and fix the
related issues in other C::B files. Is there anyone willing to help out with that?

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11282
    • Travis build status
Re: Building C::B on Mac OSX High Sierra
« Reply #1 on: April 10, 2018, 04:20:26 pm »
The other topic for OSX depicted how to solve it.
You need to add an include at the top of one of squirrel files...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Building C::B on Mac OSX High Sierra
« Reply #2 on: April 10, 2018, 05:55:41 pm »
Hi,
thanks for your quick reply!
Where is the other topic for OSX you are mentioning?

The other topic for OSX depicted how to solve it.
You need to add an include at the top of one of squirrel files...

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11282
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline uenz

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Building C::B on Mac OSX High Sierra
« Reply #4 on: May 19, 2018, 10:18:53 pm »
Hi,
here a patch file to prevent the compile issues with squirrel on MacOS.
After patching squirrel i was able to compile without errors.

Offline uenz

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Building C::B on Mac OSX High Sierra
« Reply #5 on: May 20, 2018, 09:15:27 pm »
After reading several threads, because of the outdated info in the wiki, i decided to post here one possible way of building the codeblocks app bundle.
This worked for OS x 10.13 with Xcodex
Download wxWidgetes 3.1.1 und unpack it. Open a terminal in the folder and type the following.
Code: [Select]
mkdir mac-build
cd mac-build
./configure  --with-osx_cocoa --with-macosx-version-min=10.11 --enable-debug
nice make

Quote
Configured wxWidgets 3.1.1 for `x86_64-apple-darwin17.5.0'

  Which GUI toolkit should wxWidgets use?                 osx_cocoa
  Should wxWidgets be compiled into single library?       no
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets support Unicode?                       yes (using wchar_t)
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.8      no
                                       wxWidgets 3.0      yes
  Which libraries should wxWidgets use?
                                       STL                no
                                       jpeg               sys
                                       png                sys
                                       regex              builtin
                                       tiff               sys
                                       zlib               sys
                                       expat              sys
                                       libmspack          no
                                       sdl                no
Code: [Select]
make
sudo make install

Make a folder for codeblocks source.
Code: [Select]
mkdir codeblocks
cd codeblocks
Get codeblocks source.
Code: [Select]
svn checkout http://svn.code.sf.net/p/codeblocks/code/trunkGo to the scr folder an apply the patch from previous post.
Code: [Select]
patch -p0 < squirrelOsXdiff.txtTo be able to compile i installed automake via homebrew.
Code: [Select]
brew install automakeIn trunk folder issue the folowing commands.
Code: [Select]
./bootstrap
./configure --with-platform=macosx
Quote
*************************************************
* Code::Blocks source tree has been configured. *
*************************************************

You can now build Code::Blocks by issuing 'make'.
When the build is complete, become root and install
it by issuing 'make install'.

   CFLAGS:     -O2 -ffast-math  -fPIC -std=c90
   CXXFLAGS:   -O2 -ffast-math  -Winvalid-pch -fPIC -fexceptions
   CPPFLAGS:   -DCB_AUTOCONF  -DCB_PRECOMP -DPIC -I$(top_srcdir)/src/include/tinyxml -DTIXML_USE_STL=YES
   LDFLAGS:   
   CXX:        g++ -std=c++11
   CC:         gcc
Code: [Select]
make
sudo make install
And to create the App bundle.
Code: [Select]
sudo ./bundle.shThats it...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6368
    • My Best Post
Re: Building C::B on Mac OSX High Sierra
« Reply #6 on: May 21, 2018, 01:50:52 am »
FYI: I am working on a better patch than squirrelOsXdiff.txt that was posted in this thread.
But, I can not test it on MacOS.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6368
    • My Best Post
Re: Building C::B on Mac OSX High Sierra
« Reply #7 on: May 21, 2018, 02:08:22 am »
Edit: Attached patch https://sourceforge.net/p/codeblocks/tickets/697/

Edit2: Tested on Windows using wxWidgets 3.0 32 bit.

Tim S.

« Last Edit: May 21, 2018, 04:26:46 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline juanfal

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Building C::B on Mac OSX High Sierra
« Reply #8 on: September 27, 2018, 06:37:06 pm »
Is is there a patch could we apply to codeblocks-17.12 to compile and build Code:Blocks on Mac??

Offline juanfal

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Building C::B on Mac OSX High Sierra
« Reply #9 on: September 27, 2018, 06:50:30 pm »
FYI: I am working on a better patch than squirrelOsXdiff.txt that was posted in this thread.
But, I can not test it on MacOS.

Tim S.

We could.

Offline juanfal

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Building C::B on Mac OSX High Sierra
« Reply #10 on: September 28, 2018, 11:49:15 am »
I don't understand what's the use of copying the computer /usr/local/bin complete directory with personal executables and scripts into the final OSX CodeBlocks.app/Contents

It does it in ./bundle.sh

PREFIX_DIR="/usr/local"
..
EXECUTABLES=`echo ${PREFIX_DIR}/bin/* `
..
for file in ${EXECUTABLES}
do
   echo $file
   cp $file "${APPDIR}/Contents/MacOS"  # was this is crazy
   copy_deps "${APPDIR}/Contents/MacOS/$(basename $file)"
done

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11282
    • Travis build status
Re: Building C::B on Mac OSX High Sierra
« Reply #11 on: September 28, 2018, 12:01:48 pm »
Have you passed --prefix=something-non-default to ./configure?
I've not seen anything unexpected in the bundle, but I guess I don't have anything in /usr/local.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11282
    • Travis build status
Re: Building C::B on Mac OSX High Sierra
« Reply #12 on: September 28, 2018, 06:25:04 pm »
Yes, this is the expected behaviour. If you install in the default prefix almost everything from /usr/local might end in the bundle. The proper way is to use non-default prefix (--prefix parameter of configure).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]