20 | | Of course, you can choose to support only some of these platforms. For example, you may not need a 64-bit version. If your project does not support the x86_64-apple-darwin platform, BOINC will automatically request your i686-apple-darwin application. And /or you may choose not to support the powerpc-apple-darwin platform. |
21 | | |
22 | | Although BOINC version 6.1.0 supports only Mac OS X 10.3.9 and later, earlier versions supported all versions back to OS 10.3.0. The GCC compiler version 4.0 was introduced in OS 10.3.9. OS 10.3.0 through 10.3.8 can't run applications built with GCC 4.0, so you have 2 choices if you want to support PowerPC (G3, G4 and G5) processors: |
23 | | * Build your PowerPC application with GCC 4.0 and distribute it only to Macs running 10.3.9 or later. |
| 21 | Of course, you can choose to support only some of these platforms. For example, you may not need a 64-bit version. If your project does not support the x86_64-apple-darwin platform, BOINC will automatically request your i686-apple-darwin application. And / or you may choose not to support the powerpc-apple-darwin platform. |
| 22 | |
| 23 | Although BOINC version 6.1.0 supports only Mac OS X 10.3.9 and later, earlier versions supported all versions back to OS 10.3.0. The GCC compiler version 4.0 was introduced in OS 10.3.9. OS 10.3.0 through 10.3.8 can't run applications built with GCC 4.0. Also, starting with version 6.10.58, the BOINC Client supports only Mac OS X 10.4.0 and later. This allows it to be built with XCode 3.2 under OS 10.6.x, which does not support the Mac OS 10.3.9 SDK. |
| 24 | |
| 25 | You have 2 choices if you want to support PowerPC (G3, G4 and G5) processors: |
| 26 | * Build your PowerPC application with GCC 4.0 and distribute it only to Macs running 10.3.9 (or 10.4.0) or later. |
28 | | * A PowerPC development system running OS 10.3.0 through 10.3.8 (or 10.3.9 if you won't support the older systems) |
29 | | * An Intel development system running OS 10.4.x |
30 | | * A 64-bit development Intel system running OS 10.5.x (The original Intel Macs used an Intel Core Duo processor which was 32-bit only. You must have an Intel Core 2 Duo or newer processor to run 64-bit applications.) |
31 | | * Use a single development system running OS 10.5.x and cross-compile for the various platforms. The remainder of this document describes that process. |
| 32 | * A PowerPC development system running OS 10.3.0 through 10.3.8 (or 10.3.9 or 10.4.0 if you won't support the older systems) |
| 33 | * An Intel development system running OS 10.4.x |
| 34 | * A 64-bit development Intel system running OS 10.5.x or later (The original Intel Macs used an Intel Core Duo processor which was 32-bit only. You must have an Intel Core 2 Duo or newer processor to run 64-bit applications.) |
| 35 | * Use a single development system running OS 10.5.x or later and cross-compile for the various platforms. The remainder of this document describes that process. |
41 | | Apple 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. |
42 | | |
43 | | You 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`. |
44 | | |
45 | | Otherwise, 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: |
46 | | http://connect.apple.com |
47 | | |
48 | | * All BOINC software for Power PC Macs must be built using MacOS10.3.9 SDK to assure backward compatibility with OS 10.3.9. |
49 | | * 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 to assure backward compatibility with OS 10.4.x. |
50 | | * All 64-bit BOINC software for Intel Macs must be built using GCC 4.0 and MacOS10.5 SDK. |
51 | | |
52 | | Note that the MacOS10.3.9 SDK and GCC-3.3 are not automatically included unless you customize the installation; you must click the '''Customize''' button in the ''Installation type'' step and select the MacOS10.3.9 SDK when you run the XCode Tools installer if you want to support the powerpc-apple-darwin platform. |
53 | | |
54 | | The example_app found in boinc/samples has examples of 3 different ways to build the application for all 3 platforms using cross-development: |
| 42 | Apple provides Software Developer Kits (SDKs) for OS 10.3.9, OS 10.4, OS 10.5 and OS 10.6. These include all the header files and stub libraries appropriate to the corresponding versions of OS X. However, the OS 10.3.9 cannot be used with XCode 3.2 under OS 10.6. |
| 43 | |
| 44 | You get these tools, including the GCC compilers and system library header files, by installing the XCode Tools package. We recommend running OS 10.6.x and installing XCode Tools 3.2 or later. If you have the OS 10.6 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`. |
| 45 | |
| 46 | Otherwise, 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: http://connect.apple.com |
| 47 | |
| 48 | XCode will automatically check compatibility back to OS 10.3 if the following are defined during compilation: |
| 49 | {{{ |
| 50 | MAC_OS_X_VERSION_MAX_ALLOWED=1030 |
| 51 | MAC_OS_X_VERSION_MIN_REQUIRED=1030 |
| 52 | }}} |
| 53 | |
| 54 | Note that the MacOS10.4u 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. |
| 55 | |
| 56 | The example_app found in `boinc/samples` has examples of 3 different ways to build the application for all 3 platforms using cross-development: |
| 57 | |
61 | | * Specify the compiler to use if it is GCC-3.3. |
62 | | * Specify the appropriate SDK for the minimum target OS X version. |
63 | | * Specify the Mac OSX Deployment Target, which is the minimum target OS X version. This tells the compiler to reject any attempts to use APIs not available in that version of OS X. |
| 65 | * Specify the compiler to use (we recommend GCC-4.0). |
| 66 | * Specify an appropriate SDK. It is OK to use the latest SDK even if building for older versions of OS X. |
| 67 | * Specify the Mac OSX Deployment Target, which is the minimum target OS X version on which you want your to application run. |
| 68 | * Add the definitions of MAC_OS_X_VERSION_MAX_ALLOWED and MAC_OS_X_VERSION_MIN_REQUIRED to the C or C++ compiler flags. This also specifies the minimum target OS X version. It tells the compiler to reject any attempts to use APIs not available in that version of OS X. |
| 69 | |
| 70 | ''Important:'' set the value of MAC_OS_X_VERSION_MAX_ALLOWED to be the same as the value of MAC_OS_X_VERSION_MIN_REQUIRED. Possible values for the C compiler flags are: |
| 71 | {{{ |
| 72 | -DMAC_OS_X_VERSION_MAX_ALLOWED=1030 -DMAC_OS_X_VERSION_MIN_REQUIRED=1030 |
| 73 | -DMAC_OS_X_VERSION_MAX_ALLOWED=1040 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 |
| 74 | -DMAC_OS_X_VERSION_MAX_ALLOWED=1050 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050 |
| 75 | }}} |
| 76 | These specify that the executable should be able to run on systems back to OS 10.3, OS 10.4 and OS 10.5, respectively. |
| 77 | |
| 78 | You can find examples in the following files in the BOINC SVN trunk:[[BR]] |
| 79 | `boinc/mac_build/buildc-ares.sh`[[BR]] |
| 80 | `boinc/mac_build/buildcurl.sh`[[BR]] |
| 81 | `boinc/mac_build/buildjpeg.sh`[[BR]] |
| 82 | `boinc/samples/example_app/MakeMacExample.sh`[[BR]] |
| 83 | `boinc/samples/example_app/Makefile_mac2`[[BR]] |
| 84 | `boinc/samples/example_app/Makefile_mac`[[BR]] |
| 85 | `boinc/samples/wrapper/Makefile_mac`[[BR]] |
102 | | -dev:: |
103 | | build the development (debug) version (native architecture only). Default is deployment (release) version (universal binaries containing three architectures: ppc, i386 and x86_64); when you link your application with these libraries, the linker will automatically select the architecture matching your application. |
104 | | -noclean:: |
105 | | don't do a 'clean' of each target before building. default is to clean all first. |
106 | | -no64bit:: |
107 | | build 32-bit binaries only, no x86_64 architecture. |
| 122 | -dev:: build the development (debug) version (native architecture only). Default is deployment (release) version (universal binaries containing three architectures: ppc, i386 and x86_64); when you link your application with these libraries, the linker will automatically select the architecture matching your application. |
| 123 | -noclean:: don't do a 'clean' of each target before building. default is to clean all first. |
111 | | -all:: |
112 | | build all targets (i.e. target 'Build_All' -- this is the default) |
113 | | -lib:: |
114 | | build the three libraries: libboinc_api.a, libboinc_graphics_api.a, libboinc.a. (This uses GCC-3.3 for the PowerPC build for OS 10.3.0 compatibility and uses GCC-4.0 for the Intel builds.) |
115 | | -client:: |
116 | | build two targets: BOINC client and command-line utility [BoincCmd boinc_cmd] (also builds libboinc.a, since boinc_cmd requires it.) |
117 | | |
118 | | Both -lib and -client may be specified to build five targets (no BOINC Manager.) |
119 | | |
120 | | Note: You may find three XCode projects in the BOINC_dev/boinc/mac_build/ directory: |
121 | | * '''boinc.pbproj''' is obsolete and should no longer be used. |
122 | | * '''wxMac-BOINC.xcodeproj''' was needed for building older versions of the wxMac library in conjunction with the older versions of the setupForBoinc.sh or buildWxMac.sh scripts. It is not used for BOINC 5.9.2 or later. |
123 | | * '''boinc.xcodeproj''' builds BOINC. It can be used either with the BuildMacBOINC.sh script or as a stand-alone project. It has three extra build configurations, i386-Deployment and ppc-Deployment, which can be used for testing only to build for just one architecture, and Deployment-no64 which builds only 32-bit products. The Development build configuration builds only the native architecture and is used for debugging. The Deployment build configuration builds a universal binary and is suitable for release builds. |
124 | | |
125 | | The standard release of BOINC version 6.1.0 and later contains a universal binary of the BOINC Client containing builds for three architectures: ppc, i386 and x86_64. The Mac OS automatically chooses the appropriate architecture as follows: |
126 | | * On a PowerPC Mac, it runs the ppc executable. |
127 | | * On a Mac with a 64-bit Intel processor running OS 10.5 or later, it runs the x86_64 executable. |
128 | | * On any other Intel Mac, it runs the i386 executable. |
| 127 | -all:: build all targets (i.e. target 'Build_All' -- this is the default) |
| 128 | -lib:: build the three libraries: libboinc_api.a, libboinc_graphics_api.a, libboinc.a. |
| 129 | -client:: build two targets: BOINC client and command-line utility [wiki:BoincCmd boinc_cmd] (also builds libboinc.a, since boinc_cmd requires it.) |
| 130 | |
| 131 | Both -lib and -client may be specified to build five targets (no BOINC Manager.) |
| 132 | |
| 133 | For more information on this script, please see [wiki:MacBuild here]. |
| 134 | |
| 135 | Note: You may find two XCode projects in the BOINC_dev/boinc/mac_build/ directory: |
| 136 | |
| 137 | * '''wxMac-BOINC.xcodeproj''' was needed for building older versions of the wxMac library in conjunction with the older versions of the setupForBoinc.sh or buildWxMac.sh scripts. It is not used for BOINC 5.9.2 or later. |
| 138 | * '''boinc.xcodeproj''' builds BOINC. It can be used either with the BuildMacBOINC.sh script or as a stand-alone project. The Development build configuration builds only the native architecture and is used for debugging. The Deployment build configuration builds a universal binary and is suitable for release builds. If there are any other build configurations, they should not be used as they are obsolete. |
| 139 | |
| 140 | The standard release of BOINC version 6.1.0 and later contains a universal binary of the BOINC libraries containing builds for three architectures: ppc, i386 and x86_64. |
142 | | Use the example XCode project as a guide or a starting point to create an XCode project for your own application. Pay special attention to the XCode build settings. For more information on using XCode, see [http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/00_00_intro/chapter_1_section_1.html XCode User Guide] and [http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/05_04_bs_build_settings/chapter_33_section_1.html XCode Build Settings]. |
143 | | |
144 | | Also note that you can use the program `xcodebuild` to build XCode projects from the command-line (e.g. in a terminal window or shell script). There are various flags for building particular builds within a project, and for overriding default variables as well (check `man xcodebuild` in a terminal window for the options). |
| 151 | Note: you may see the following warning when building the PowerPC executable. You may safely ignore it: |
| 152 | {{{ |
| 153 | ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o |
| 154 | }}} |
| 155 | |
| 156 | Use the example XCode project as a guide or a starting point to create an XCode project for your own application. Pay special attention to the XCode build settings. For more information on using XCode, see [http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/XcodeWorkspace XCode Workspace Guide]. |
| 157 | |
| 158 | Also note that you can use the program `xcodebuild` to build XCode projects from the command-line (e.g. in a terminal window or shell script). There are various flags for building particular builds within a project, and for overriding default variables as well (check `man xcodebuild` in a terminal window for the options). You can find an example of this approach in the file `boinc/mac_build/buildWxMac.sh` |
172 | | Specifies the Mac OSX Deployment Target, which is the minimum target OS X version. This tells the compiler to reject any attempts to use APIs not available in that version of OS X. |
173 | | |
174 | | {{{ |
175 | | export CC=/usr/bin/gcc-3.3;export CXX=/usr/bin/g++-3.3 |
176 | | }}} |
177 | | Specifies which compiler to use. |
178 | | |
179 | | {{{ |
180 | | export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk -arch ppc" |
181 | | }}} |
182 | | Specifies the appropriate SDK for the minimum target OS X version and the architecture for the linker. |
183 | | |
184 | | {{{ |
185 | | export VARIANTFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk" |
186 | | }}} |
187 | | Specifies the appropriate SDK for the minimum target OS X version and the architecture for the compiler. For an explanation of _NONSTD_SOURCE, see: |
188 | | http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/compat.5.html |
| 190 | Specifies the Mac OSX Deployment Target, which is the minimum target OS X version on which you want your to application run. |
| 191 | |
| 192 | {{{ |
| 193 | export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk,-arch,ppc" |
| 194 | }}} |
| 195 | Specifies the appropriate SDK to use and the architecture for the linker. |
| 196 | |
| 197 | {{{ |
| 198 | export VARIANTFLAGS="-arch ppc -DMAC_OS_X_VERSION_MAX_ALLOWED=1030 -DMAC_OS_X_VERSION_MIN_REQUIRED=1030 -isysroot /Developer/SDKs/MacOSX10.6.sdk -fvisibility=hidden -fvisibility-inlines-hidden" |
| 199 | }}} |
| 200 | Specifies the SDK to use and the architecture for the compiler. MAC_OS_X_VERSION_MAX_ALLOWED and MAC_OS_X_VERSION_MIN_REQUIRED tell the compiler to generate an error if you are using any APIs not yet available in that version of the Mac OS. |
228 | | |
229 | | http://developer.apple.com/technotes/tn2005/tn2137.html [[BR]] |
230 | | http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/ [[BR]] |
231 | | http://developer.apple.com/releasenotes/DeveloperTools/RN-GCC4/ [[BR]] |
232 | | http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html [[BR]] |
233 | | http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_6.html [[BR]] |
234 | | http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_compiling/chapter_2_section_7.html [[BR]] |
235 | | http://developer.apple.com/releasenotes/DeveloperTools/GCC40PortingReleaseNotes/index.html |
236 | | |
| 236 | http://developer.apple.com/technotes/tn2005/tn2137.html [[BR]] http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/ [[BR]] http://developer.apple.com/releasenotes/DeveloperTools/RN-GCC4/ [[BR]] http://developer.apple.com/library/mac/#documentation/Porting/Conceptual/PortingUnix/intro/intro.html [[BR]] http://developer.apple.com/legacy/mac/library/#documentation/MacOSX/Conceptual/universal_binary [[BR]] http://developer.apple.com/releasenotes/DeveloperTools/GCC40PortingReleaseNotes/index.html |