kicad/Documentation/compiling/mac-osx.txt

131 lines
5.3 KiB
Plaintext

Compiling KiCad on Apple Mac OS X
=================================
First written: 2010-01-31
Last edited by: Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
Snow Leopard
------------
Requirements
* XCode Tools (http://developer.apple.com/tools/xcode)
* CMake (http://www.cmake.org)
* wxWidgets 2.9 (http://www.wxwidgets.org/downloads)
* Doxygen (http://www.doxygen.nl)
Building wxWidgets 2.9 Universal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To check if your tools and libraries are installed check with file for architectures.
user@macosx$ file /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib: Mach-O universal binary with 4 architectures
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc7400): Mach-O dynamically linked shared library stub ppc
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc64)Mach-O 64-bit dynamically linked shared library stub ppc64
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture i386):Mach-O dynamically linked shared library stub i386
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library stub x86_64
You need the architectures what you are compiling for !
If you have problems that the 64bits library is not build you should add in
the configure file:
At time of writing (2009-01-16) this is on line 18381
changing this: OSX_UNIV_OPTS="-arch ppc -arch i386"
into this: OSX_UNIV_OPTS="-arch ppc -arch i386 -arch x86_64"
Building a universal monolib wxWidgets 2.9 with the following parameters:
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl \
--enable-universal_binary --enable-aui --enable-debug --with-osx_cocoa \
--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk/ --prefix=/opt/wxwidgets-svn
If you dont need the debugging symbols then you can remove the --enable-debug parameter.
Compiling and installing:
make
sudo make install
Move the old Mac OS X wxconfig and symlink it to the new compiled 2.9
sudo mv /usr/bin/wx-config /usr/bin/wx-config.osx
sudo ln -s /opt/wxwidgets-svn/bin/wx-config /usr
Building KiCad
~~~~~~~~~~~~~~
Extract the sources or get them from subversion.
user@mac-osx$ cmake .
Regarding Kicad the only things i've changed are the Variables
in the generated CMakeCache.txt
It depends on which CMake version you use:
//Flags used by the compiler during all build types.
//This fixes also BOOST macro errors
CMAKE_CXX_FLAGS:STRING=-D__ASSERTMACROS__
//Build architectures for OSX
CMAKE_OSX_ARCHITECTURES:STRING=x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
//The product will be built against the headers and libraries located
// inside the indicated SDK.
CMAKE_OSX_SYSROOT:PATH=/Developer/SDKs/MacOSX10.5.sdk
//Minimum OS X version to target for deployment (at runtime); newer
// APIs weak linked. Set to empty string for default value.
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5
Or:
CMAKE_OSX_ARCHITECTURE = x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
CMAKE_OSX_SYSROOT = /Developer/SDKs/MacOSX10.5.sdk
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__
Then we invoke make:
user@mac-osx$ make
Known Problems
~~~~~~~~~~~~~~
In file included from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22In
file included from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22,
from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_sequence_adapter.hpp:20,
from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_vector.hpp:20,
from
/temp/kicad-sources/kicad/include/board_item_struct.h:9,
from /temp/kicad-sources/kicad/include/pcbstruct.h:10,
from /temp/kicad-sources/kicad/3d-viewer/3d_viewer.h:29,
from /temp/kicad-sources/kicad/3d-viewer/3d_aux.cpp:23:
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/static_move_ptr.hpp:154:50:
error: macro "check" passed 2 arguments, but takes just 1
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__ fixes this :-)
configure:18585: gcc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5 -o conftest -arch i386 -arch x86_64 -arch ppc -arch i386 -arch x86_64 -arch ppc conftest.c >&5
ld: warning: in /Developer/SDKs/MacOSX10.5.sdk//usr/lib/libSystem.dylib, missing required architecture ppc in file
Installing rosetta and xcode with all architectures fixes this "problem"
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
You get this error because the QuickTime 10.6 framework is not build with 64bit support. This not a real issue for KiCad because we don't use it anyway.
Undefined symbols:
"TestForIntersectionOfStraightLineSegments(int, int, int, int, int, int, int, int, int*, int*, double*)", referenced from:
clipLine(EDA_Rect*, int&, int&, int&, int&)in libcommon.a(gr_basic.cpp.o)
Make sure you marked the build type Release:
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=Release