Building KiCad on Mac OS X

(See also: Running KiCad on Mac OS X)

My rough notes on building KiCad with wxMac on Mac OS X 10.4 (PowerPC):

Building KiCad SVN 2007-01-15 with wxMac 2.6.4

+ cd ~/Code/kicad_dev/build-attempt1

+ svn co https://kicad.svn.sourceforge.net/svnroot/kicad/tags/kicad-2007-01-15/ kicad (TODO: Use export?)

+ wget http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.4.tar.gz

+ tar xzvf wxMac-2.6.4.tar.gz

+ cd wxMac-2.6.4

+ cp ../kicad/mybuild_wxWidgets_macosX_unicode.txt .

+ add "--prefix=$HOME/Code/kicad_dev/build-attempt1" to end of "configure" line in `mybuild_wxWidgets_macosX_unicode.txt` (TODO: Just don't 'make install'?)

+ sh mybuild_wxWidgets_macosX_unicode.txt (ignore rm "no directory error")

+ make

+ make install

+ export PATH=$HOME/Code/kicad_dev/build-attempt1/bin:$PATH

+ "wx-config --version" ==> 2.6.4

+ cd ../kicad/

+ make -f makefile.macosx

# Hmmm, `Code/kicad_dev/build-attempt1/kicad/kicad/kicad` is a classic app!!
# By downloading and using a slightly edited makefile.macosx from svn a OS X application bundle is created.

Building KiCad SVN 2007-07-09 with wxMac 2.8.4

+ mkdir build-attempt2

+ svn export https://kicad.svn.sourceforge.net/svnroot/kicad/tags/kicad-2007-07-09/ kicad # 72MB with docs!

+ wget http://prdownloads.sourceforge.net/wxwindows/wxMac-2.8.4.tar.gz

+ tar xzvf wxMac-2.8.4.tar.gz

+ cd wxMac-2.8.4

+ rm *.cache # not needed for 1st build

+ Use "configure" line now listed in `kicad/how-to-build-kicad.txt` and add:


  specifically from "osX" section:

    ./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --disable-universal --disable-compat24 --prefix=$HOME/Code/kicad_dev/build-attempt2

  # Note: Are "osX" and "osX-unicode" incorrect?

+ make

# Note: This fails on 10.4 ppc gcc4 with:

/Users/phil/Code/kicad_dev/build-attempt2/wxMac-2.8.4/bk-deps g++ -c -o monolib_imagtga.o -I.pch/wxprec_monolib -D__WXMAC__     -I./src/tiff     -I./src/regex -I./src/expat/lib -DwxUSE_BASE=1 -DWX_PRECOMP -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/Users/phil/Code/kicad_dev/build-attempt2/wxMac-2.8.4/lib/wx/include/mac-unicode-release-static-2.8 -I./include -fpascal-strings -I./src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon -Wall -Wundef -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -fno-common ./src/common/imagtga.cpp
./src/common/imagtga.cpp: In function `int ReadTGA(wxImage*, wxInputStream&)':
./include/wx/scopeguard.h:114: error: 'wxScopeGuardImplBase::wxScopeGuardImplBase(const wxScopeGuardImplBase&)' is protected
./src/common/imagtga.cpp:191: error: within this context
./include/wx/scopeguard.h:114: error: 'wxScopeGuardImplBase::wxScopeGuardImplBase(const wxScopeGuardImplBase&)' is protected
./src/common/imagtga.cpp:191: error: within this context
./include/wx/scopeguard.h:112: error: 'wxScopeGuardImplBase::~wxScopeGuardImplBase()' is protected
./src/common/imagtga.cpp:191: error: within this context
./include/wx/scopeguard.h:112: error: 'wxScopeGuardImplBase::~wxScopeGuardImplBase()' is protected
./src/common/imagtga.cpp:191: error: within this context
make: *** [monolib_imagtga.o] Error 1

  So try adding:


  suggested here:


 +  e.g: (remember rm *.cache)

    ./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --disable-universal --disable-compat24 --disable-tga --prefix=$HOME/Code/kicad_dev/build-attempt2

 + make 

 + make install

 + export PATH=$HOME/Code/kicad_dev/build-attempt2/bin:$PATH

 + "wx-config --version" ==> 2.8.4

 + cd ../kicad/

 + (edit makefile.osx to remove 'i386' if on ppc) (for all?)

 + Patch this: (From: http://tech.groups.yahoo.com/group/kicad-devel/message/524) (in latest svn)

--- common/gestfich.cpp 2007-09-06 10:32:03.000000000 +1200
+++ common/gestfich.cpp~        2007-07-09 22:29:53.000000000 +1200
@@ -439,7 +439,7 @@
 #ifdef __WXMAC__
        // Mac part
        wxGetEnv("HOME", &FullFileName);
-       FullFileName += wxString("/bin/") + ExecFile;
+       FullFileName += wxString("/bin/") + newExecFile;
        if (! wxFileExists(FullFileName) )
                FullFileName = FindKicadFile(ExecFile);

 # Make doesn't stop on errors

 ../common/common.a /
 sed errors   # TODO: fix this

 + remove the sed lines -- (bad chars etc)

 + error:

gestfich.cpp: In function `int ExecuteFile(wxWindow*, const wxString&, const wxString&)':
gestfich.cpp:441: error: conversion from 'const char [5]' to 'const wxString' is ambiguous
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:692: note: candidates are: wxString::wxString(wxChar, size_t) <near match>
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:682: note:                 wxString::wxString(int) <near match>
gestfich.cpp:442: error: call of overloaded 'wxString(const char [6])' is ambiguous
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:722: note: candidates are: wxString::wxString(const wxWCharBuffer&) <near match>
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:692: note:                 wxString::wxString(wxChar, size_t) <near match>
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:690: note:                 wxString::wxString(const wxString&) <near match>
/Users/phil/Code/kicad_dev/build-attempt2/include/wx-2.8/wx/string.h:682: note:                 wxString::wxString(int) <near match>


 + Patch this: (From: http://www.wxwidgets.org/wiki/index.php/WxString#Gotchas)
   "it's actually a Unicode error. You have to wrap your strings in wxT()
    or _() to make them compile properly"

--- gestfich.cpp        2007-09-06 11:58:36.000000000 +1200
+++ gestfich.cpp~       2007-09-06 10:32:03.000000000 +1200
@@ -438,8 +438,8 @@

 #ifdef __WXMAC__
        // Mac part
-       wxGetEnv(wxT("HOME"), &FullFileName);
-       FullFileName += wxString(wxT("/bin/")) + ExecFile;
+       wxGetEnv("HOME", &FullFileName);
+       FullFileName += wxString("/bin/") + ExecFile;
        if (! wxFileExists(FullFileName) )
                FullFileName = FindKicadFile(ExecFile);

 # TODO: make clean doesn't remove .app?

 + fix plugins/netlist_form_pads-pcb.cpp (stricmp etc)

Note: From my initial use it seems like the older release is actually more usable than the newer one—I'm unsure if this is to do with KiCad or wxMac issues.

@@ TODO: Clean this up.

Build notes from other people