Changes between Version 36 and Version 37 of MacBuild


Ignore:
Timestamp:
Apr 3, 2008, 8:56:45 PM (16 years ago)
Author:
charlief
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MacBuild

    v36 v37  
    11= Building BOINC Clients and Applications on Macintosh OS X =
    2 '''Last updated 4/2/08'''
    3 
    4 This document applies to BOINC version 6.1.0 and later. It has instructions for building BOINC for Macintosh OS X, plus information for building science project applications to run under BOINC on Macintosh OS X.
     2'''Last updated 4/3/08'''
     3
     4This document applies to BOINC version 6.1.0 and later.  It has instructions for building the BOINC Client and Manager for Macintosh OSX.  Information for building science project applications to run under BOINC on Macintosh OSX can be found [BuildMacApp here].
    55
    66Note: the information in this document changes from time to time for different versions of BOINC. For any version of BOINC source files, the corresponding version of this document can be found in the source tree at:
     
    3737The BOINC Client includes support for the x86_64 (64-bit Intel) architecture beginning with version 6.1.0.
    3838
     39== Cross-Platform Development ==
     40
     41Apple provides the tools necessary to cross-compile for all three BOINC Mac platform on any Mac running OS 10.5.x.
     42
     43Apple provides Software Developer Kits (SDKs) for OS 10.3.9, OS 10.4 and OS 10.5.  These include all the header files and stub libraries appropriate to the corresponding versions of OS X.
     44
     45You get these tools, including the GCC compilers and system library header files, by installing the XCode Tools package.  I recommend running OS 10.5.x and installing XCode Tools 3.0 or later. If you have the OS 10.5 installation DVD for your system, you can install XCode Tools at the time you install the OS, or you can install it later by opening the file `Optional Installs/XCode Tools/XCodeTools.mpkg`.
     46
     47Otherwise, you can download it from Apple's web site (it is large: 1.1 GB).  You must be a member of the Apple Developer Connection to download the software, but you can join for free at:
     48http://connect.apple.com
     49
    3950'''Building BOINC now requires XCode Tools version 2.4.1 or later; XCode 3.0 or later is recommended.'''  Note that the MacOS10.3.9 SDK is not automatically included unless you customize the installation; click  the '''Customize''' button in the '''Installation type''' step when you run the XCode Tools installer.
    4051
     
    8495''XCode installed these utilities in the `/usr/bin/` directory, but the upgrades by default will install in `/usr/local/bin/`. If you install there, you must also set your PATH environment variable to include that location. The scripts referenced below do this automatically.''
    8596
    86 As stated above, all BOINC software for Power PC Macs must be built using MacOS10.3.9 SDK and (for libraries) GCC 3.3 to assure backward compatibility with OS 10.3.  All 32-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.4.u SDK to allow cross-compiling.  And all 64-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.5 SDK.
     97All BOINC software for Power PC Macs must be built using MacOS10.3.9 SDK to assure backward compatibility with OS 10.3.9.
     98All 32-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.4.u SDK to allow cross-compiling.
     99All 64-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.5 SDK.
    87100
    88101These are not done by either the XCode projects which come with wxMac-2.8.7, nor the !AutoMake scripts supplied with wxMac-2.8.7, c-ares-1.5.1, curl-7.18.0, or jpeg-6b. So be sure to use our special scripts to build these packages.
    89102
    90 Building BOINC and the library packages on which it depends requires OS 10.4.4 and XCode 2.4.1 (or greater). It may be possible to use XCode 2.3 and/or versions of OS X earlier than 10.4.4, but this has not been tested by the authors.
     103Building BOINC and the library packages on which it depends requires OS 10.5 and XCode 2.4.1 (or greater).
    91104
    92105   1. Create a parent directory within which to work. In this description , we will call it BOINC_dev, but you can name it anything you wish.
     
    198211For information on interpreting crash dumps and backtraces, see [MacBacktrace Mac Backtrace].
    199212
    200 == Building project applications ==
    201 
    202 === Upgrading applications for Macs with Intel processors ===
    203 
    204 Apple converted all its lines of computers to Intel processors during 2006.  The early Intel Macs used the Core Duo processor, which is a 32-bit CPU.  Later Intel processors, including the Core 2 Duo, can run both 32-bit and 64-bit applications.  However, BOINC will run in 64-bit mode only under OS 10.5 and later.
    205 
    206 All current releases of BOINC include "universal binary" builds for the Macintosh of BOINC Manager, command-line BOINC Client and the boinc_cmd command-line tool.  (Universal binaries contain both PowerPC and Intel executables in one file; the Macintosh OS automatically selects the appropriate one for that computer.)  Beginning with version 6.1, the BOINC Client and libraries also include the 64-bit Intel architecture as part of the universal binaries.
    207 
    208 The advantage of 'universal binaries' is that you only need to have one copy of the application, and it will run on either PowerPC or Intel Macs, so users don't need to choose between two options. Since BOINC participants manually download BOINC from the web site, we will be providing BOINC in 'universal binary' form.
    209 
    210 However, participants do not manually download project applications; this is done automatically by BOINC. So there would be no advantage to combining the 32-bit Intel, 64-bit Intel and PowerPC versions in a single 'universal binary' file, but doing so would triple the size of the download.
    211 
    212 So BOINC treats Intel Macs as 2 new, separate platforms: `i686-apple-darwin` and `x86_64-apple-darwin`, in addition to the PowerPC Mac platform (`powerpc-apple-darwin`).   
    213 
    214 Starting with BOINC 5.9.7, the Intel BOINC Client accepts powerpc-apple-darwin applications if no i686-apple-darwin is available.   The OS will run it in compatibility mode, emulating a PowerPC.  (Apple calls this compatibility mode Rosetta, which of course has nothing to do with the Rosetta BOINC project.) 
    215 
    216 The x86_64 BOINC Client requests `x86_64-apple-darwin` applications from BOINC servers as its first choice, `i686-apple-darwin` as a second choice, and finally `powerpc-apple-darwin` if no Intel applications are available.
    217 
    218 However, older Intel Mac clients will not get any work unless the server offers i686-apple-darwin applications.  As a '''temporary''' measure, projects can set their servers to deliver a copy of their current PowerPC application (renamed for the new platform) under the i686-apple-darwin platform for older BOINC Clients.
    219 
    220 If you do this, be sure to give your native Intel application a higher version number when you do release it, so that clients will download it.
    221 
    222 However, running a PowerPC application in compatibility mode has two significant drawbacks:
    223 
    224     * Screensaver graphics do not work.
    225     * Since it is running under emulation, your application will run at reduced efficiency. But the benchmarks are based on running native Intel applications. This may cause scheduler problems, such as missed deadlines and inadequate credit for participants.
    226 
    227 So it is important to make a native Intel application available as soon as possible. It is very easy to add a new [BoincPlatforms platform] to your server with the [XaddTool xadd utility].
    228 
    229 BOINC 6.1 supports all PowerPC Macs running OS 10.3.9 or later, and all Intel Macs, but older versions of BOINC supported OS 10.3.0 or later for PowerPC Macs.  (The Intel Macs themselves require OS 10.4.4 or later.)
    230 
    231 The easiest way to build your application for these two platforms is to build each one on its native platform. In other words, do your `powerpc-apple-darwin` build on a PowerPC Mac running OS 10.3.9, and your `i686-apple-darwin` build on an Intel Mac.
    232 
    233 But Apple provides the tools to allow you to cross-compile your application on any Mac (PowerPC or Intel) running OS 10.4 or later. Here is how:
    234 
    235 All BOINC project applications for Power PC Macs must be built using GCC 3.3 and MacOS10.3.9 SDK to assure backward compatibility with OS 10.3.  If building a PowerPC application on an Intel Mac, you must also specify `-arch ppc` in the compiler and linker flags.
    236 
    237 All 32-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.4.u SDK to allow cross-compiling.  If building an Intel application on a PowerPC Mac, you must also specify `-arch i386` in the compiler and linker flags.
    238 
    239 All 64-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.5 SDK.  To build for the x86_64 architecture, use a Mac running either OS 10.4 or OS 10.5 and specify the `-arch x86_64` option to the compiler and linker.
    240 
    241 If you prefer, you can cross-compile on one Mac running OS 10.4.x or OS 10.5.x.  You can find examples of how to do this for two different kinds of configure / make scripts in the HEAD branch of the BOINC SVN tree at [source:trunk/boinc/mac_build/buildcurl.sh boinc/mac_build/buildcurl.sh] and [source:trunk/boinc/mac_build/buildjpeg.sh boinc/mac_build/buildjpeg.sh].
    242 
    243 The lipo utility is used at the end of each of these scripts to combine the two binaries into a single "Universal Binary" file.  You won't need to do that with you project applications, since you will be distributing them separately under the two platforms.  But if you prefer, you can create a Universal Binary and distribute the same file for both i686-apple-darwin and powerpc-apple-darwin platforms (and also the x86_64-apple-darwin platform if you wish).
    244 
    245 Note that the BOINC libraries (and any third-party libraries) which you link with your applications must be built with the same configuration as the application itself. Follow the instructions earlier in this document to build the needed libraries.
    246 
    247 Additional information on building Unix applications universal can be found here:
    248 http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html
    249 
    250 and here:
    251 http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_compiling/chapter_2_section_7.html
    252 
    253 For information on making your code work with GCC 4:
    254 http://developer.apple.com/releasenotes/DeveloperTools/GCC40PortingReleaseNotes/index.html
    255 
    256 === Upgrading applications for version 6 graphics ===
    257 
    258 One of the major changes in BOINC for version 6 is that applications are now expected to generate graphics in a separate executable. The graphics application typically communicates with the worker application using shared memory.
    259 
    260 For additional information, please see [milestone:6.0 the 6.0 roadmap] and the [GraphicsApi Graphics API] page.
    261 
    262 === Adding a Finder icon to your graphics application ===
    263 
    264 There is an optional API `setMacIcon()` in the `libboinc_api.a` library. This allows science graphics applications to display an application icon in the Dock and in the Finder. (The icon does not appear in the Dock until the application displays graphics.) To implement this, do the following:
    265 
    266     * Use '/Developer/Applications/utilities/Icon Composer.app' to create a xxx.icns file. (Use any name you wish instead of xxx.)
    267     * Convert the xxx.icns file to an app_icon.h file as follows: in Terminal, run:
    268 {{{
    269 {path}/MakeAppIcon_h {source_file_path}/xxx.icns {dest_file_path}/app_icon.h
    270 }}}
    271       (The !MakeAppIcon_h command-line utility is built by the Mac boinc XCode project in the 'boinc/mac_build/build/' directory.) Add the app_icon.h file to your graphics application's project.
    272     * In the graphics application's main(), add
    273 {{{
    274 #include "app_icon.h"
    275 }}}
    276       and call:
    277 {{{
    278 setMacIcon(argv[0], MacAppIconData, sizeof(MacAppIconData));
    279 }}}
    280     * The graphics application must link with Carbon.framework to use setMacIcon().