Author Topic: Building Code::Blocks svn on Mac OS X 10.11  (Read 5903 times)

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Building Code::Blocks svn on Mac OS X 10.11
« on: January 20, 2016, 11:58:12 am »
Hi all,

I want to share my experience with compiling C::B on a Mac with the latest OSX El Capitan, please use it with care as I am not an expert in coding/building apps and most of the time I do not know what I am doing actually!!!

As a general start you should build and install automake (http://ftp.gnu.org/gnu/automake/), autoconf (http://ftp.gnu.org/gnu/autoconf) and libtool (http://ftpmirror.gnu.org/libtool/).

I downloaded the latest development version of wxWidgets from GitHub (https://github.com/wxWidgets/wxWidgets) and configured it with the following options:

Code
CC=clang CXX=clang++ CXXFLAGS='-v -std=c++11 -stdlib=libc++' CCFLAGS='-v -stdlib=libc++' LDFLAGS='-stdlib=libc++' [PATH_TO_THE_configure_SCRIPT] --prefix=$HOME/local --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk --with-macosx-version-min=10.11 --enable-debug --enable-monolithic --with-osx_cocoa --enable-compat28

Then I downloaded the C:B svn:

Code
svn checkout svn://svn.code.sf.net/p/codeblocks/code/trunk 

and configured it:

Code
CC=clang CXX=clang++ CXXFLAGS='-v -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -stdlib=libc++' LDFLAGS='-dylib' [PATH_TO_THE_configure_SCRIPT] --prefix=$HOME/local --enable-debug --enable-fortran --with-wx-config=[PATH_TO_YOUR_wxconfig] --with-platform=macosx

as you can see I do not build contrib plugins as the only one I am using so far is fortranproject (http://cbfortran.sourceforge.net/index.html)

in order for it to build correctly I had to apply the following changes (sorry if I do not use the git-diff patch format, but as I said I am not good in those things ;-) ):

in src/sdk/configmanager.cpp:

Code
@@ -1510,12 +1510,12 @@
             // It seems we can not longer rely on wxStandardPathsBase::Get().GetPluginsDir(),
             // because its behaviour has changed on some systems (at least Fedora 14 64-bit).
             // So we create the pathname manually
-            ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetInstallPrefix() + _T("/lib/codeblocks/plugins");
+            ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetPluginsDir() + _T("/lib/codeblocks/plugins");
             // first assume, we use standard-paths
             if (!wxDirExists(ConfigManager::plugin_path_global) && wxIsPlatform64Bit())
             {
                 // if standard-path does not exist and we are on 64-bit system, use lib64 instead
-                ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetInstallPrefix() + _T("/lib64/codeblocks/plugins");
+                ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetPluginsDir() + _T("/lib64/codeblocks/plugins");
             }
         }
     }

in src/sdk/debuggermanager.cpp:

Code
@@ -486,11 +486,7 @@
 #else
     uint64_t result;
     // different sizes of long/long long on 64bit/32bit need different conversions
-#ifdef __LP64__
-    if (address.ToULong(&result, 16))
-#else
   if (address.ToULongLong(&result, 16))
-#endif // __LP64__
         return result;
     else
         return 0;

Finally, every attempt to do a Search (for files or text or whatever) makes the program crash miserably. The following patch solves the issue:

http://forums.codeblocks.org/index.php/topic,20312.msg138351.html#msg138351

Hope this can help.  :)

Offline Calexus

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Building Code::Blocks svn on Mac OS X 10.11
« Reply #1 on: January 20, 2016, 04:18:10 pm »
And the conclusion is that you successfully built the latest cb source for osx 10.11? Well done :) I know from personal experience that building cb for os x can be a bit of a problem.

Offline iceant

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Building Code::Blocks svn on Mac OS X 10.11
« Reply #2 on: May 14, 2016, 03:56:06 am »
I just changed the computer to Mac Book Pro.
I like Code::Blocks. So I try to build it on Mac OSX 10.11.

I can build it, and run it. but no plugin is loaded. Do you have this problem?
I did not build the contribute plugins.

When I am doing "make install" this information show up for plugins:

make[6]: Nothing to be done for `install-exec-am'.
is this an issue?

Thanks
« Last Edit: May 14, 2016, 04:03:19 am by iceant »

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Building Code::Blocks svn on Mac OS X 10.11
« Reply #3 on: June 03, 2016, 01:18:21 am »
Hey,

sorry but I missed your message. This is something I did not specify:
if I remember well, all plugin libraries are built as *.so files. I renamed them to *.dylib and put them in ~/local/share/codeblocks NOT in ~/local/lib/codeblocks
*.zip plugin files must be located in the same directory
Does this work for you?

w

Offline frankofrank

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Building Code::Blocks svn on Mac OS X 10.11
« Reply #4 on: November 13, 2016, 09:30:43 pm »