Here are some instructions for building KiCad 4.0.2 from source on FreeBSD. These instructions have been tested on FreeBSD/amd64 10.2-RELEASE. KiCad mostly builds out of the box, with a few minor adjustments as shown below. 1) KiCad wants WxWidgets 3.0 and to run wx-config, but FreeBSD calls it wxgtk2u-3.0-config. Create an alias, or make a symlink like this: % ln -s /usr/local/bin/wxgtk2u-3.0-config wx-config % setenv PATH `pwd`:$PATH 2) During the build, KiCad downloads the Boost source code and applies some patches to it. The problem is the patches have Microsoft-style line breaks in them (^M) which confuses the patch command a little. Go to the kicad-4.0.2/patches directory and tweak all the .patch files to get rid of the CTRL-Ms. 3) Update CMakeModules/download_boot.cmake so that it uses clang instead of gcc: --- download_boost.cmake.orig 2016-03-31 19:47:17.932416000 -0700 +++ download_boost.cmake 2016-03-31 19:47:24.940326000 -0700 @@ -92,7 +92,7 @@ #message( STATUS "REPLACE libs_csv:${boost_libs_list}" ) # Default Toolset -set( BOOST_TOOLSET "toolset=gcc" ) +set( BOOST_TOOLSET "toolset=clang" ) if( KICAD_BUILD_STATIC OR APPLE ) set( BOOST_LINKTYPE "link=static" ) @@ -130,7 +130,7 @@ string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" ) #message( STATUS "libs_csv:${libs_csv}" ) - set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} ) + set( bootstrap ./bootstrap.sh --with-toolset=clang --with-libraries=${libs_csv} ) # pass to *both* C and C++ compilers set( BOOST_CFLAGS "cflags=${PIC_FLAG}" ) set( BOOST_CXXFLAGS "cxxflags=${PIC_FLAG}" ) 4) Sometimes kicad dumps core on exit. Fix kicad-4.0.2/kicad/kicad.cpp: --- kicad.cpp.orig 2016-03-31 23:10:10.622662000 -0700 +++ kicad.cpp 2016-03-31 23:10:36.885092000 -0700 @@ -278,6 +278,9 @@ Pgm().OnPgmExit(); + /* Avoid crash */ + wxLog::EnableLogging(false); + return wxApp::OnExit(); } 5) Create a build/release path under the kicad-4.0.2 source directory, and then go there: % cd /path/to/kicad-4.0.2 % mkdir build % mkdir build/release % cd build/release 6) Run cmake with the following command, where KICAD_SRC_DIR is the directory where you unpacked kicad-4.0.2 (FreeBSD has its own potrace library which conflicts with the one that's shipped with KiCad): % cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=ON \ -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local/kicad4 \ -DDEFAULT_INSTALL_PATH=/usr/local/kicad4 \ -DCMAKE_C_FLAGS="-IKICAD_SRC_DIR//kicad-4.0.2/potrace -I/usr/local/include" \ -DCMAKE_CXX_FLAGS="-IKICAD_SRC_DIR/kicad-4.0.2/potrace -I/usr/local/include" \ -DKICAD_REPO_NAME=stable -DKICAD_BUILD_VERSION=4.0.2 ../../ Note that this uses /usr/local/kicad4 as the installation directory. 7) Do the build: % gmake VERBOSE=1 8) Do the install: % gmake VERBOSE=1 install