Author Topic: Need help building for Mac OS X  (Read 1388 times)

Offline Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Need help building for Mac OS X
« on: December 27, 2016, 05:04:07 pm »
Hi.

I am currently trying to build C::B on Mac but..... it fails   :-\

As I saw that frankofrank has made a build with wx-3.1.0, I tried with a recently updated git clone of wx-3.1.1
I've made a dynamic build of wxWidgets, and made a copy of wx-config in /usr/local/bin so it callable from any terminal window.

Then I have:
  • created a copy of the C::B svn repo
  • called bootstrap
  • created a "buildtest" sub folder and "cd" into it
  • made a call to ../configure --with-platform=macosx
The configure script stopped while checking for zlib :
Code: [Select]
../configure: line 17846: syntax error near unexpected token `zlib,'
../configure: line 17846: `PKG_CHECK_MODULES(zlib, zlib, HAVE_ZLIB=yes, HAVE_ZLIB=no)'

I've tried to "brew install zlib" but after installing, brew said that osx already have this package:
Quote from: brew
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/zlib/lib
    CPPFLAGS: -I/usr/local/opt/zlib/include
    PKG_CONFIG_PATH: /usr/local/opt/zlib/lib/pkgconfig
And the configure script always fails.

Any idea ?
I also saw that the wxWidgets build process hasn't found it, and used the built-in version.

Regards
Xav'
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10194
Re: Need help building for Mac OS X
« Reply #1 on: December 27, 2016, 07:07:08 pm »
Does the build-in version provide pkg-config file for it?
<debugger plugin maintainer>
(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 frankofrank

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Need help building for Mac OS X
« Reply #2 on: January 09, 2017, 06:58:40 pm »
Hi,

my OSX is 10.11.6

for wxWidgets I have:

$ ACLOCAL=/usr/local/bin/aclocal-1.15  AUTOMAKE=/usr/local/bin/automake-1.15  CC=clang     CXX=clang++  ./configure  --prefix=/usr/local/Cellar/wxmac/3.1.1  --with-platform=macosx --with-osx_cocoa --with-macosx-version-min=10.11 --enable-debug

Configured wxWidgets 3.1.1 for `x86_64-apple-darwin15.6.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


$ pkg-config --debug zlib

returns:

Looking for package 'zlib'
Looking for package 'zlib-uninstalled'
Reading 'zlib' from file '/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.11/zlib.pc'
Parsing package file '/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.11/zlib.pc'
  line>prefix=/usr
 Variable declaration, 'prefix' has value '/usr'
  line>exec_prefix=${prefix}
 Variable declaration, 'exec_prefix' has value '/usr'
  line>libdir=${exec_prefix}/lib
 Variable declaration, 'libdir' has value '/usr/lib'
  line>sharedlibdir=${libdir}
 Variable declaration, 'sharedlibdir' has value '/usr/lib'
  line>includedir=${prefix}/include
 Variable declaration, 'includedir' has value '/usr/include'
  line>
  line>Name: zlib
  line>Description: zlib compression library
  line>Version: 1.2.5
  line>
  line>Requires:
  line>Libs: -L${libdir} -L${sharedlibdir} -lz
  line>Cflags: -I${includedir}


file zlib.h exists in

/usr/include/zlib.h


Regards
frankofrank

Offline iceant

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Need help building for Mac OS X
« Reply #3 on: August 14, 2017, 06:31:16 am »
Have you solved this issue?
I got the same problem when build the cb in MacOSX 10.12.

Offline Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #4 on: August 22, 2017, 11:47:44 am »
Hi
Have you solved this issue?
I got the same problem when build the cb in MacOSX 10.12.
Yes I did (but I don't know how  :-\ )
I've just cleaned my own build sub dir, re-ran bootstrap and configure :
Code: [Select]
cd buildtest
../bootstrap
../configure --with-platform=macosx

The configure process gave me the following result :
Code: [Select]
*************************************************
* 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

I've launched the make process, but I had an error :
Code: [Select]
../../../src/sdk/configmanager.cpp:1515:98: error: no member named 'GetInstallPrefix' in 'wxStandardPaths'
            ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetInstallPrefi...
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
../../../src/sdk/configmanager.cpp:1520:102: error: no member named 'GetInstallPrefix' in 'wxStandardPaths'
                ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetInstallP...
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
2 errors generated.

If I comment these 2 lines (they are non-osx related), the build process seems to be ok.
Edit: I tried again with wx-3.0.3 (the previous steps were with wx-3.1.1) and I was able to uncomment these lines.

The next step will be to create a bundle but I didn't tried this yet.

Regards
Xav'
« Last Edit: August 22, 2017, 12:32:04 pm by Xaviou »
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #5 on: September 17, 2017, 08:59:29 pm »
Hi to all.

I've just seen the "bundle.sh" file created by Dave Murphy, and validated by oBFusCATed : big thanks to them for this

I've tested (rev 11171, wx-3.0.3), and the bundle has been created successfully, with all the wxWidgets dynamic libs files includes.

Moved the bundle in the Applications list, and ran it.

It has less files than the last one provided by frankofrank, and is very smaller : mine is 33MB and frankofrank's one is 70,5MB (it was rev 10922, wx-3.1.1)

The major problem I had with this first test is that the  "New project" wizard is empty (but as I could see, the needed files are present in the app folder).

If one wants to inspect the result, I've made a zip of it and uploaded to google drive.

Regards
Xav'
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10194
Re: Need help building for Mac OS X
« Reply #6 on: September 17, 2017, 10:19:43 pm »
What happens if you do make install and use the installed copy? Does it find the templates?
Probably there is some path in the config manager which needs to be adjusted, similar to the plugin path.

The size difference could be related to universal vs single-arch builds. Can you confirm this? Is the old build universal (32 + 64 bit)?
<debugger plugin maintainer>
(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 Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #7 on: September 18, 2017, 05:04:50 pm »
Hi

What happens if you do make install and use the installed copy? Does it find the templates?
It doesn't find any plugins  :( Tested with both a "user wide" make install and a "sudo" make install
Quote
Scanning for lexers in /usr/local/bin/../share/codeblocks/lexers/...
Found 57 lexers
Loading lexer_A68k
Loading lexer_ada
......
Loading lexer_vhdl
Loading lexer_xml
Configured 0 tools
Scanning for plugins in /Users/xavier/Library/Application Support/codeblocks/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /usr/local/bin/../share/codeblocks/plugins
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'

The size difference could be related to universal vs single-arch builds. Can you confirm this? Is the old build universal (32 + 64 bit)?
Can't confirm (no infos about this) : the start page has just the following information :
svn build rev 10922 (2016-11-17 11:48:57) gcc 4.2.1 Mac OS X/unicode - 64 bit
and mine have :
svn build rev 11171 (2017-09-13 23:12:23) gcc 4.2.1 Mac OS X/unicode - 64 bit

But it can just be a "debug/release" difference : my wx libs were build with "--disable-debug --disable-debug_flag" and some 3rd party libs are not in the bundle as it seems I'm using systems ones (libtiff, libjpeg  for example).
Perhaps frankofrank can provide more informations.
Another difference is that the bundle made from the script doesn't have the "Contents/MacOS/wxContribItems" subfolder

Here is the startup log obtained using the bundle made with your script:
Quote
Scanning for lexers in /Applications/CodeBlocks.app/Contents/Resources/share/codeblocks/lexers/...
Found 57 lexers
Loading lexer_A68k
Loading lexer_ada
............
Loading lexer_vhdl
Loading lexer_xml
Configured 0 tools
Scanning for plugins in /Users/xavier/Library/Application Support/codeblocks/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /Applications/CodeBlocks.app/Contents/Resources/share/codeblocks/plugins
Loaded 13 plugins
Loading:
Abbreviations
AStylePlugin
Autosave
ClassWizard
CodeCompletion
Compiler
Debugger
FilesExtensionHandler
OccurrencesHighlighting
OpenFilesList
ProjectsImporter
ScriptedWizard
ToDoList
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'

Regards
Xav'
« Last Edit: September 18, 2017, 05:07:04 pm by Xaviou »
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5899
    • My Best Post
Re: Need help building for Mac OS X
« Reply #8 on: September 18, 2017, 06:55:28 pm »
Did you run the update script before running the bundle script?
If not, I suggest trying that to see if the missing files are then in the bundle.

The above is a wild guess; just as likely to be wrong as right.

Tim S.
« Last Edit: September 18, 2017, 07:00:33 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10194
Re: Need help building for Mac OS X
« Reply #9 on: September 18, 2017, 09:03:36 pm »
The update script has nothing to do with the bundle script used at the moment. This new one is for autotools builds.

I've found why the templates are missing and I'll commit a patch soon.
I'll need to find a way to add conditional code to copy the contrib plugins, because they are missing from the bundle.

edit: In fact the template fix is already in master.
« Last Edit: September 18, 2017, 09:08:49 pm by oBFusCATed »
<debugger plugin maintainer>
(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 Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #10 on: September 19, 2017, 08:25:40 am »
In fact the template fix is already in master.
Tested, and ..... IT WORKS !!!......

Thank you very much for this great work.
I'll now make more tests with the created and installed bundle.

If someone want to test : https://goo.gl/V84eWT
It is a "google drive" shared folder link, witch contains a resulting dmg file, and 3 text files (configure result, build log and build errors (warnings).

Regards
Xav'
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10194
Re: Need help building for Mac OS X
« Reply #11 on: September 19, 2017, 09:26:55 am »
Xaviou: What are the commands you use to make the dmg?

@others: for the contrib plugins I need help with getting the contrib plugins enable/disable flags to the bundle.sh scripts. I've spent a lot of time trying to do it, but I don't have an idea how to do it. My autofu+googlefu is pretty bad at the moment.
<debugger plugin maintainer>
(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 Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #12 on: September 19, 2017, 03:25:21 pm »
Xaviou: What are the commands you use to make the dmg?
I made it with the disk utility application.

But as I also need to know how to do it using the command line, I'll search for it and I'll tell you about what I've found.

Regards
Xav'
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/

Offline Xaviou

  • Almost regular
  • **
  • Posts: 248
    • X@v's wxStuff
Re: Need help building for Mac OS X
« Reply #13 on: September 19, 2017, 04:55:31 pm »
Hi

I found a great and complete script to make a dmg using command line :
https://github.com/andreyvit/create-dmg

Edit: I've replaced the dmg file (https://goo.gl/V84eWT) with one created using a bash script.
And I also placed in this shared folder the script itself, and the png image used for background.
Both these files have to be placed in the build folder (where is placed the "bundle.sh" script).

I've set the size of the disc image to 100Mb but it can be reduced if needed.

Regards
Xav'
« Last Edit: September 19, 2017, 09:07:44 pm by Xaviou »
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : http://wxstuff.xaviou.fr/