Patching and Building KiCAD on Mac OS X Lion
I use EAGLE schematic and PCB layout software because I was lucky to get an EAGLE 4.16 Professional license for very reasonable price from a former employer. I upgraded it to EAGLE 5.x, though I felt a bit gypped by what I got for the money. And now, EAGLE is at version 6, and I'm once again having a hard time justifying the upgrade price.
But there's a more important consideration than price. As I am a purveyor of open-source hardware, EAGLE isn't ideal software. It's a closed-source product, and is pay-ware. So it fails on both the "free-as-in-freedom" and "free-as-in-beer" tests. Yes, EAGLE is available in a "free" version, but is quite limited, especially for my designs, which tend to exceed those limits – both in terms of size and number of layers.
So what to do? There are two popular open-source packages for schematic capture and PCB layout: gEDA and KiCAD. I've always liked KiCAD in principle, and have tried a number of times to use it on Mac OS X, but the project's support for Mac is tepid at best. KiCAD is also dependent on wxWidgets, whose Mac OS X support lags other platforms. There are a number of Mac OS X builds of KiCAD out there, which have patches applied and are reasonably stable. But I wanted to build KiCAD (and wxWidgets) from source so I could participate in mainlining Mac OS X improvements – especially for multi-touch trackpad gestures. Here's a video of the touchpad improvements I made:
Below are my patches and notes for how to build wxWidgets and KiCAD on Mac OS X Lion, from their respective repositories. I'm assuming you have Xcode 4.3.2, and bzr and cmake installed somehow (I used MacPorts 2.1.0).
My patches to wxWidgets and KiCAD fix a CMake line formatting bug, a wxWidgets overlay bug, and a Boost #include bug. (Two of these patches are updated from KiCAD patches I found elsewhere.) The patches also add hacked-in support for the Mac OS X touchpad "magnify" event, so I can use the pinch-zoom gesture. I also modified the mouse scrollwheel support to implement horizontal and vertical scrolling using trackpad gestures.
Here are my build notes, derived from several posts I found about how to build on Mac OS X:
git clone git://gist.github.com/2763241.git
svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets
cd wxWidgets
patch -p0 <../2763241/wxWidgets-kicad-overlay.patch
patch -p0 <../2763241/wxWidgets-magnify-macosx.patch
mkdir build-debug
cd build-debug
../configure --enable-debug --enable-unicode=yes --disable-shared --enable-monolithic --with-opengl --with-expat=builtin --enable-aui --with-osx_cocoa --with-macosx-version-min=10.7 --prefix=$PWD/../build-debug CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=1070 CXXFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=1070
make
cd ../..
bzr branch lp:kicad
cd kicad
patch -p0 <../2763241/kicad-cmake-line-formatting.patch
patch -p0 <../2763241/kicad-boost-polygon-sort-adaptor.patch
patch -p0 <../2763241/kicad-magnify-macosx.patch
mkdir build-xcode
cd build-xcode
cmake -DwxWidgets_CONFIG_EXECUTABLE=$PWD/../../wxWidgets/build-debug/wx-config -DwxWidgets_wxrc_EXECUTABLE=$PWD/../../wxWidgets/build-debug/utils/wxrc/wxrc -DKICAD_TESTING_VERSION=ON -DCMAKE_CXX_FLAGS=-D__ASSERTMACROS__ -G Xcode ..
open -a Xcode kicad.xcodeproj
At this point, you're looking at the KiCAD project in Xcode, and can select the particular tool or application you want to build. I've noticed some odd behavior in Xcode, where it can't find #include file pcb_plot_params_lexer.h during the first build attempt, but works fine if you build again.
There are still plenty of bugs to fix. For instance, the overlay stuff doesn't seem to draw correctly when you move an object in the eeschema. It seems as if the overlay size isn't set correctly, but seems to fix itself if you resize the eeschema window. Hmmm…
Comments
hi,
Thank you for sharing. I'm doing the same now following this guide. Will it be ok if I contact you if in case I ran into problems while doing this?
Thanks
Azrin
@Azrin: Sure, please contact me. However, I've gone away from KiCAD, as I found it too frustrating to deal with on Mac OS at the moment. I am excited to see improvements like the nanometer-resolution units, but it seems like these new things aren't quite ready to trust for serious work. So I'm back in a waiting mode, and will try KiCAD again in a few months.
I've compiled them successfully -but with lots of warnings. now how can I make them into distributable application? I cannot seem to find kicad.app that I can execute outside of Xcode (I'm very new to all of this)
@Azrin: The warnings are normal. The KiCAD code base breaks a lot of rules that Xcode's Clang compiler wants fixed.
On my system, I have a "build-xcode" subdirectory. In there, you should find subdirectories like "pcbnew/Debug" that each contain a ".app" bundle you can run directly.
My KiCad build crashes several times. Can you upload your binaries?
@Alex: I will contact you via e-mail. I've lost interest in KiCAD on Mac OS for the time being – it's just too dodgy, and I don't have the time to invest in committing the patches necessary to improve the situation. But I'd be happy to provide my binaries to you privately, as-is. If they work for you, great.
Jboone;
I want to thank you for posting these instructions. Last spring I was able to use them and build the app. (I noted this on the KiCad Yahoo group.) No one took me up on the offer of binaries. There does not seem to be a good place to put them. I thought about github as I already have an account there. Anything on bazzar would probably be seen as semi official.
I should note, that this program needs more than the binary to get to work. The libraries and help files are also required, which would imply a fairly complex install script.
I made some pretty drastic hacks to the installed code. Changing the search paths to the library app directory rather than the usr ~ directory.
Most of the issues are in something called WxFormbuilder. The files say do not modify. But I did anyway. WxFormbuilder will not build under Lion. The issue is that it only builds with 32 bit WxWidgets. I do not have enough time to fix it, as I or whom ever does have the time to fix the tool, will have to bring the tool up agianst the same Widgets build you used.
I undid the trackpad hack, as I prefer the 3 button scroll wheel.
That said, My hacks for the most part seem to work. I have been using KiCad since the spring.
When I last checked this page, there were no comments. Just wanted to say how much I appreciated your efforts. The mac is so much faster than the XP laptops.
-julie
Please contact me, We could arrange to add the trackpad patch directly in the Kicad's developer tree, please give me also magnify support trac ticket.
Hi Marco,
Yes! I would love to see that. The trackpad is really touchy in Kicad at present, and is very hard to use. I don't think the WxWidgets group will be implementing multitouch soon, so fixing it in Kicad may be the best option.
I will attempt to build it on my 10.9.2 system, so I can update and clean up the patches. I've been using your build and Adam Wolf's lately, as it wasn't building for me.
I have been working with the KiCad group over the last 6 months or so. The trackpad difficulties you mentioned (and fixed..) in May of 2012 are still there for me.
The current KiCad developer's list is:
They have fixed a lot of bugs over the past couple of years. It might be useful if you could revisit their efforts.
Best regards
Bob G
The KiCad developer's list is: "kicad-developers@lists.launchpad.net"
@Bob: I never committed fixes to the KiCad project. I offered a patch to WxWidgets, which was not accepted because their team wanted to do some additional design work on multi-touch support. My KiCad patch was dependent on the WxWidgets patch. I have since lost track of WxWidgets' efforts and have learned to use KiCad without multi-touch features. Not ideal, I know…