<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Paul Solt &#187; iPhone</title>
	<atom:link href="http://paulsolt.com/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulsolt.com</link>
	<description>Putting the Inc back in Solt since 2005.</description>
	<lastBuildDate>Wed, 12 May 2010 19:34:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>C++ Logging and building Boost for iPhone/iPad 3.2 and MacOSX</title>
		<link>http://paulsolt.com/2010/04/c-logging-and-building-boost-for-iphoneipad-3-2-and-macosx/</link>
		<comments>http://paulsolt.com/2010/04/c-logging-and-building-boost-for-iphoneipad-3-2-and-macosx/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 05:15:42 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Boost]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone 3.2]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=559</guid>
		<description><![CDATA[In my effort to write more robust and maintainable code I have been searching for a cross-platform C++ logging utility. I&#8217;m working on a C++ static library for iPhone/iPad 3.2/Mac/Windows and I needed a way to log what was happening in my library. Along the way I was forced to build Boost for iPhone, iPhone [...]]]></description>
			<content:encoded><![CDATA[<p>In my effort to write more robust and maintainable code I have been searching for a cross-platform C++ logging utility. I&#8217;m working on a C++ static library for iPhone/iPad 3.2/Mac/Windows and I needed a way to log what was happening in my library. Along the way I was forced to build Boost for iPhone, iPhone Simulator, and the Mac.</p>
<h5>Why logging?</h5>
<p>Mobile devices lack a console when detached from a development machine, so it&#8217;s hard to track down issues. I needed a system that could log at multiple levels (Debug1, Debug2, Info, Error, Warning) and be thread safe. Multiple logger levels allow a developer to turn up/down the detail of information that is stored, which in turn affect performance with I/O writes. A developer with logging information can better track down crashes and other issues during an applications lifetime.</p>
<h5>Why Boost Logger Library v2?</h5>
<p>I struggled trying to get a logger working. After many failed attempts with <a href="http://pantheios.sourceforge.net/">Pantheios</a>, <a href="http://logging.apache.org/log4cxx/">log4cxx</a>, <a href="http://log4cpp.sourceforge.net/">log4cpp</a>, and <a href="http://code.google.com/p/google-glog/">glog</a>, I settled on the <a href="http://torjo.com/log2/">Boost Logger Library v2</a> because I was able to &#8220;compile&#8221; for iPhone/iPad 3.2 and Mac OSX. Most of the loggers required other dependencies that would need to be rebuilt for iPhone and didn&#8217;t directly support iPhone.</p>
<p>The Boost Logger is all header files so it doesn&#8217;t require &#8220;compiling,&#8221; which made it much easier to get working. However, it does require a few Boost libraries that need to be compiled. The Boost Logging needs the following libraries: filesystem, system, and threading depending on what functionality is used.</p>
<h4>Step 1: Building Boost for iPhone/iPad and iPhone Simulator 3.2</h4>
<p>A few Boost libraries need compiling for the iPhone/iPad and the iPhone Simulator in order to link against the Boost Logger. <a href="http://iphone.galloway.me.uk/2009/11/compiling-boost-for-the-iphone/">Matt Galloway</a> provided a demo on how to compile Boost 1.41/1.42 for iPhone/iPhone Simulator. Here are the steps I used for Boost 1.42 based on his tutorial.</p>
<ol>
<li>Get <a href="http://www.boost.org/users/news/version_1_42_0">Boost 1.42</a></li>
<li>Extract Boost:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzf boost_1_42_0.tar.gz</pre></div></div>

<li>Create a user-config.jam file in your user directory (~/user-config.jam) such as /Users/paulsolt/user-config.jam with the following. (<strong>Note</strong>:  this config file needs to be rename or moved during the MacOSX bjam build)</li>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>user-config.jam
using darwin : 4.2.1~iphone
   : <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">4.2</span> <span style="color: #660033;">-arch</span> armv7 <span style="color: #660033;">-mthumb</span> <span style="color: #660033;">-fvisibility</span>=hidden <span style="color: #660033;">-fvisibility-inlines-hidden</span>
   : <span style="color: #000000; font-weight: bold;">&lt;</span>striper<span style="color: #000000; font-weight: bold;">&gt;</span>
   : <span style="color: #000000; font-weight: bold;">&lt;</span>architecture<span style="color: #000000; font-weight: bold;">&gt;</span>arm <span style="color: #000000; font-weight: bold;">&lt;</span>target-os<span style="color: #000000; font-weight: bold;">&gt;</span>iphone <span style="color: #000000; font-weight: bold;">&lt;</span>macosx-version<span style="color: #000000; font-weight: bold;">&gt;</span>iphone-<span style="color: #000000;">3.2</span>
   ;
&nbsp;
using darwin : 4.2.1~iphonesim
   : <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneSimulator.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">4.2</span> <span style="color: #660033;">-arch</span> i386 <span style="color: #660033;">-fvisibility</span>=hidden <span style="color: #660033;">-fvisibility-inlines-hidden</span>
   : <span style="color: #000000; font-weight: bold;">&lt;</span>striper<span style="color: #000000; font-weight: bold;">&gt;</span>
   : <span style="color: #000000; font-weight: bold;">&lt;</span>architecture<span style="color: #000000; font-weight: bold;">&gt;</span>x86 <span style="color: #000000; font-weight: bold;">&lt;</span>target-os<span style="color: #000000; font-weight: bold;">&gt;</span>iphone <span style="color: #000000; font-weight: bold;">&lt;</span>macosx-version<span style="color: #000000; font-weight: bold;">&gt;</span>iphonesim-<span style="color: #000000;">3.2</span>
   ;</pre></div></div>

<p><code></p>
<li>Make sure the file <em>boost_1_42_0/tools/build/v2/tools/darwin.jam</em> has the following information:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tools<span style="color: #000000; font-weight: bold;">/</span>build<span style="color: #000000; font-weight: bold;">/</span>v2<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>darwin.jam
<span style="color: #666666; font-style: italic;">## The MacOSX versions we can target.</span>
.macosx-versions =
    <span style="color: #000000;">10.6</span> <span style="color: #000000;">10.5</span> <span style="color: #000000;">10.4</span> <span style="color: #000000;">10.3</span> <span style="color: #000000;">10.2</span> <span style="color: #000000;">10.1</span>
    iphone-<span style="color: #000000;">3.2</span> iphonesim-<span style="color: #000000;">3.2</span>
    iphone-3.1.3 iphonesim-3.1.3
    iphone-3.1.2 iphonesim-3.1.2
    iphone-<span style="color: #000000;">3.1</span> iphonesim-<span style="color: #000000;">3.1</span>
    iphone-<span style="color: #000000;">3.0</span> iphonesim-<span style="color: #000000;">3.0</span>
    iphone-2.2.1 iphonesim-2.2.1
    iphone-<span style="color: #000000;">2.2</span> iphonesim-<span style="color: #000000;">2.2</span>
    iphone-<span style="color: #000000;">2.1</span> iphonesim-<span style="color: #000000;">2.1</span>
    iphone-<span style="color: #000000;">2.0</span> iphonesim-<span style="color: #000000;">2.0</span>
    iphone-1.x
    ;</pre></div></div>

<li>Change directories to the Boost directory that you downloaded:</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>boost_1_42_0</pre></div></div>

<li>Run the following commands to compile the iPhone and iPhone Simulator Boost libraries. I only need filesystem, system, and thread to be use Boost logging for the iPhone, so I don't build everything. Run ./bootstrap.sh --help or ./bjam --help for more options. I built the binaries to a location in my development folder to include in my project dependencies.</li>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>bootstrap.sh <span style="color: #660033;">--with-libraries</span>=filesystem,system,thread</pre></div></div>

<p></code><br />
<code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>bjam <span style="color: #660033;">--prefix</span>=<span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>boost<span style="color: #000000; font-weight: bold;">/</span>iphone <span style="color: #007800;">toolset</span>=darwin <span style="color: #007800;">architecture</span>=arm target-os=iphone macosx-version=iphone-<span style="color: #000000;">3.2</span> <span style="color: #007800;">define</span>=_LITTLE_ENDIAN <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">link</span></span>=static <span style="color: #c20cb9; font-weight: bold;">install</span>
.<span style="color: #000000; font-weight: bold;">/</span>bjam <span style="color: #660033;">--prefix</span>=<span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>boost<span style="color: #000000; font-weight: bold;">/</span>iphoneSimulator <span style="color: #007800;">toolset</span>=darwin <span style="color: #007800;">architecture</span>=x86 target-os=iphone macosx-version=iphonesim-<span style="color: #000000;">3.2</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">link</span></span>=static <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p></code></p>
<li><strong>Update: </strong>Create a universal Boost Library using the lipo tool. In this example I'm assuming the binaries that were created have the following names. The names from the bjam generation will be different, based on your own configuration.<strong>End Update</strong></li>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">lipo <span style="color: #660033;">-create</span> libboost_filesystem_iphone.a libboost_filesystem_iphonesimulator.a <span style="color: #660033;">-output</span> libboost_filesystem_iphone_universal.a
&nbsp;
lipo <span style="color: #660033;">-create</span> libboost_system_iphone.a libboost_system_iphonesimulator.a <span style="color: #660033;">-output</span> libboost_system_iphone_universal.a
&nbsp;
lipo <span style="color: #660033;">-create</span> libboost_thread_iphone.a libboost_thread_iphonesimulator.a <span style="color: #660033;">-output</span> libboost_thread_iphone_universal.a</pre></div></div>

<p></code></p>
<li>I'm working on a cross-platform project and my directory structure looks like the following structure. I copied the include and lib files for iPhone and iPhone Simulator into the appropriate directories. The dependency structure allows me to checkout the project on another machine and have relative references to Boost and other dependencies.</li>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">|</span>-ArtworkEvolution
   <span style="color: #000000; font-weight: bold;">|</span>---Xcode
   <span style="color: #000000; font-weight: bold;">|</span>-----BoostLoggingTest
   <span style="color: #000000; font-weight: bold;">|</span>---dependencies
   <span style="color: #000000; font-weight: bold;">|</span>-----iphone
   <span style="color: #000000; font-weight: bold;">|</span>-------debug
   <span style="color: #000000; font-weight: bold;">|</span>-------release
   <span style="color: #000000; font-weight: bold;">|</span>---------include
   <span style="color: #000000; font-weight: bold;">|</span>-----------boost
   <span style="color: #000000; font-weight: bold;">|</span>---------lib
   <span style="color: #000000; font-weight: bold;">|</span>-----iphone-simulator
   <span style="color: #000000; font-weight: bold;">|</span>-------debug
   <span style="color: #000000; font-weight: bold;">|</span>-------release
   <span style="color: #000000; font-weight: bold;">|</span>---------include
   <span style="color: #000000; font-weight: bold;">|</span>-----------boost
   <span style="color: #000000; font-weight: bold;">|</span>---------lib
   <span style="color: #000000; font-weight: bold;">|</span>-----macosx
   <span style="color: #000000; font-weight: bold;">|</span>-------debug
   <span style="color: #000000; font-weight: bold;">|</span>-------release
   <span style="color: #000000; font-weight: bold;">|</span>---------include
   <span style="color: #000000; font-weight: bold;">|</span>-----------boost
   <span style="color: #000000; font-weight: bold;">|</span>-----------libs
   <span style="color: #000000; font-weight: bold;">|</span>-----win32
   <span style="color: #000000; font-weight: bold;">|</span>---docs
   <span style="color: #000000; font-weight: bold;">|</span>---source
   <span style="color: #000000; font-weight: bold;">|</span>---tests</pre></div></div>

<p></code></p>
<li>Download the <a href="http://torjo.com/log2/">Boost Logging Library v2</a> and unzip it.</li>
<li>Copy and paste the logging folder into each include/boost folder for iPhone and iPhone Simulator dependency folders like in my directory structure. After you unzip the header files are located in the folder logging/boost/logging.</li>
</ol>
<h4>Step 2:  Creating the Xcode Project</h4>
<p>With the iPhone and iPhone Simulator Boost libraries in hand we're ready to make an Xcode project. Due to the difference in the iPhone and iPhone Simulator libraries we'll need to make two targets. One will build linking against the iPhone Boost libraries (arm) and the other against the iPhone Boost Simulator libraries (x86).</p>
<p><strong>Update:</strong> You don't need to create two targets, as we can use the lipo tool to make a universal iPhone/iPhone Simulator library file. The universal library file can be shared between iPhone and iPhone Simulator build configurations. See the instructions for using lipo to create the universal library files in the previous section. However, I will keep the two target instructions up as an alternate approach for Xcode project development, if you choose not to use the lipo tool.</p>
<p><strong>End Update</strong></p>
<p>1. Create a new iPhone project (view based)</p>
<p>2. There will be two targets: "BoostLoggingTest Device" and "BoostLogging Test Simulator" each will reference different headers and libraries. Duplicate the starting target and rename each target respectively.</p>
<div id="attachment_566" class="wp-caption aligncenter" style="width: 502px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Screen-shot-2010-04-06-at-7.43.21-PM.png"><img class="size-full wp-image-566 " title="Screen shot 2010-04-06 at 7.43.21 PM" src="http://paulsolt.com/wp-content/uploads/2010/04/Screen-shot-2010-04-06-at-7.43.21-PM.png" alt="" width="492" height="427" /></a><p class="wp-caption-text">Duplicate target to make iPhone/iPhoneSimulator targets</p></div>
<p>3. Add the libraries that we compiled into two groups: device and simulator under Resources. Right-click on the group "Simulator" or "Device" and select "Add Existing Files". Search for the library .a files that you copied into the iphone and iphone-simulator directories. These resources should be added relative to the project folder.</p>
<p>4. Drag the appropriate libraries to each Target. We need two targets since the architecture is different on the iPhone device (arm) versus the iPhone Simulator (Intel x86).</p>
<div id="attachment_569" class="wp-caption aligncenter" style="width: 486px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/DragDeviceLibraries.png"><img class="size-full wp-image-569 " title="DragDeviceLibraries" src="http://paulsolt.com/wp-content/uploads/2010/04/DragDeviceLibraries.png" alt="" width="476" height="431" /></a><p class="wp-caption-text">Drag the device libraries to the device target.</p></div>
<div id="attachment_570" class="wp-caption aligncenter" style="width: 486px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/DragSimulatorLibraries.png"><img class="size-full wp-image-570 " title="DragSimulatorLibraries" src="http://paulsolt.com/wp-content/uploads/2010/04/DragSimulatorLibraries.png" alt="" width="476" height="431" /></a><p class="wp-caption-text">Drag simulator dependencies to the iPhone simulator target</p></div>
<p>5. Add the "Header Search Path" for each target. For me the relative path will be two directories up from the Xcode project folders:  <em>../../dependencies/iphone/release/include</em> and <em>../../dependencies/iphone-simulator/release/include.</em> Right-click on each Target in the left pane and click on "Get Info" -&gt; Build -&gt; Type "Header" in the search field -&gt; Edit the list of paths.</p>
<div id="attachment_571" class="wp-caption aligncenter" style="width: 522px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Device-Header-Path.png"><img class="size-full wp-image-571   " title="Device Header Path" src="http://paulsolt.com/wp-content/uploads/2010/04/Device-Header-Path.png" alt="" width="512" height="471" /></a><p class="wp-caption-text">Add the Device Target Header Search path for the boost libraries</p></div>
<div id="attachment_572" class="wp-caption aligncenter" style="width: 528px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Simulator-Header-Path.png"><img class="size-full wp-image-572 " title="Simulator Header Path" src="http://paulsolt.com/wp-content/uploads/2010/04/Simulator-Header-Path.png" alt="" width="518" height="471" /></a><p class="wp-caption-text">Add the simulator targets Header Search Paths</p></div>
<p>6. Change the base SDK of each target. For the Device you need to use <em>iPhone Device 3.2</em> and the Simulator Target needs <em>iPhone Simulator 3.2</em> or later.</p>
<div id="attachment_573" class="wp-caption aligncenter" style="width: 441px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Device-Base-SDK.png"><img class="size-full wp-image-573 " title="Device Base SDK" src="http://paulsolt.com/wp-content/uploads/2010/04/Device-Base-SDK.png" alt="" width="431" height="471" /></a><p class="wp-caption-text">Set the Device Target to iPhone Device 3.2</p></div>
<div id="attachment_574" class="wp-caption aligncenter" style="width: 441px"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Simulator-Base-SDK.png"><img class="size-full wp-image-574 " title="Simulator Base SDK" src="http://paulsolt.com/wp-content/uploads/2010/04/Simulator-Base-SDK.png" alt="" width="431" height="471" /></a><p class="wp-caption-text">Set the Simulator Target to iPhone Simulator 3.2</p></div>
<p>7. Now you have two different targets. One is for the iPhone Device and the other is for the iPhone Simulator. We did this because we built separate binaries for Boost on the iPhone (arm) and simulator (x86) platforms.</p>
<p>8. Set the project's <em>Active SDK</em> to use the Base SDK (top left of Xcode). Now it will automatically choose the iPhone Device or iPhone Simulator based on the Base SDK of each Target you select.</p>
<p>9. Logging on the iPhone requires that we use the full path to the file within the application sandbox. Use the following Objective-C code to get it:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>docsDirectory <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>NSSearchPathForDirectoriesInDomains<span style="color: #002200;">&#40;</span>NSDocumentDirectory, NSUserDomainMask, <span style="color: #a61390;">YES</span><span style="color: #002200;">&#41;</span> objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>path <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>docsDirectory stringByAppendingPathComponent<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;err.txt&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>outputFilename <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>path UTF8String<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>10. I modified one of the Boost Logging samples to use the full file path on the iPhone. Rename the main.m as main.mm to use Objective-C/C++ and copy paste the following:  <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;"><a href="http://paulsolt.com/wp-content/uploads/2010/04/main.txt">main.mm code</a></span></p>
<p>11. If everything compiled and ran on the Device you can get the application data from the Xcode Organizer (Option+Command+O) Navigate to Devices and then look in Applications for the test application. Just drag the "Application Data" to your desktop to download it from the device. Your logs should appear in the Documents folder.</p>
<h4>Part 3: Build Boost for Mac OS X 10.6 - 4 way fat (32/64 PPC and 32/64 Intel)</h4>
<p>1. Build boost for Mac OS X. <strong>Note</strong>:  If you setup the user-config.jam file for iPhone Boost build, rename or move the file to a different folder than your home directory, otherwise ignore this command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> ~<span style="color: #000000; font-weight: bold;">/</span>user-config.jam ~<span style="color: #000000; font-weight: bold;">/</span>user-config.jam.INACTIVE</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>boost_1_42_0
.<span style="color: #000000; font-weight: bold;">/</span>bootstrap.sh <span style="color: #660033;">--with-libraries</span>=filesystem,system,thread
.<span style="color: #000000; font-weight: bold;">/</span>bjam <span style="color: #660033;">--prefix</span>=<span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>boost<span style="color: #000000; font-weight: bold;">/</span>macosx <span style="color: #007800;">toolset</span>=darwin <span style="color: #007800;">architecture</span>=combined address-model=<span style="color: #000000;">32</span>_64 <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">link</span></span>=static <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>2. Copy the output into your dependency structure and add the Boost Logging Library headers into the include/boost folder. (Same procedure as with iPhone)</p>
<p>3. Setup a Xcode project or target with the appropriate header search path, Boost Mac OSX libraries in the same way we setup the iPhone Xcode project.</p>
<p><strong>Note: </strong>If you get warnings about hidden symbols and default settings open the Xcode project for and make sure that the "Inline Methods Hidden" and "Symbols Hidden by Default" are unchecked. Clicking on/off might fix any Xcode warnings.</p>
<p style="text-align: center;"><a href="http://paulsolt.com/wp-content/uploads/2010/04/Hidden-Symbols-Off.png"><img class="aligncenter size-full wp-image-576" title="Hidden Symbols Off" src="http://paulsolt.com/wp-content/uploads/2010/04/Hidden-Symbols-Off.png" alt="" width="431" height="471" /></a></p>
<h5>References:</h5>
<ul>
<li><a href="http://iphone.galloway.me.uk/2009/11/compiling-boost-for-the-iphone/" target="_blank">http://iphone.galloway.me.uk/2009/11/compiling-boost-for-the-iphone/</a></li>
<li><a href="http://brockwoolf.com/blog/compile-and-use-boost-libraries-in-xcode-visual-studio">http://brockwoolf.com/blog/compile-and-use-boost-libraries-in-xcode-visual-studio</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2010/04/c-logging-and-building-boost-for-iphoneipad-3-2-and-macosx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone Development with OpenGL</title>
		<link>http://paulsolt.com/2009/12/iphone-development-with-opengl/</link>
		<comments>http://paulsolt.com/2009/12/iphone-development-with-opengl/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 21:50:20 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=366</guid>
		<description><![CDATA[Here&#8217;s my second presentation on iPhone Development at RIT for the Computer Science Community (CSC).If you enjoyed it let me know. I decided to look into graphics and OpenGL for the presentation. Slides: iPhone Development II &#8211; Paul Solt Demo: Triangle Demo: OpenGL ES on iPhone The first demo is a basic OpenGL ES iPhone [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my second presentation on iPhone Development at RIT for the Computer Science Community (<a title="Computer Science Community" onclick="javascript:pageTracker._trackPageview('/outbound/article/csc.cs.rit.edu');" href="http://csc.cs.rit.edu/">CSC</a>).If you enjoyed it let me know. I decided to look into graphics and OpenGL for the presentation.</p>
<h4>Slides: <a href="http://paulsolt.com/wp-content/uploads/2009/12/iPhone-Development-II-Paul-Solt.pdf">iPhone Development II &#8211; Paul Solt</a></h4>
<h4>Demo: Triangle Demo: <a href="http://paulsolt.com/wp-content/uploads/2009/12/OpenGL-test1.zip">OpenGL ES on iPhone</a></h4>
<p style="text-align: center;">
<div id="attachment_372" class="wp-caption aligncenter" style="width: 300px"><a href="http://paulsolt.com/wp-content/uploads/2009/12/Screen-shot-2009-12-10-at-12.53.35-PM.png"><img class="size-full wp-image-372 " title="OpenGL ES Triangle Demo" src="http://paulsolt.com/wp-content/uploads/2009/12/Screen-shot-2009-12-10-at-12.53.35-PM.png" alt="OpenGL ES Triangle Demo" width="290" height="539" /></a><p class="wp-caption-text">OpenGL ES Triangle Demo</p></div>
<p>The first demo is a basic OpenGL ES iPhone project using vertex/color arrays and an orthogonal view. It&#8217;s based on the tutorials from <a title="opengl es" href="http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html">Jeff LaMarche</a> This is the starting point for any iPhone OpenGL ES project. It&#8217;ll give you a window that you can draw in and manipulate OpenGL state. Use <a title="xcode opengl es template" href="http://www.innerloop.biz/code/Empty%20OpenGL%20ES%20Application.zip">Jeff&#8217;s xcode project template</a> to make this process painless and easy to get started. It&#8217;s easier than using GLUT!</p>
<h4>Demo: Cocos2D for iPhone: <a href="http://paulsolt.com/wp-content/uploads/2009/12/GraphicsDemo.zip">Cocos2D iPhone Graphics Demo</a></h4>
<p style="text-align: center;">
<div id="attachment_368" class="wp-caption aligncenter" style="width: 564px"><a href="http://paulsolt.com/wp-content/uploads/2009/12/Screen-shot-2009-12-09-at-7.33.41-PM.png"><img class="size-full wp-image-368  " title="Cocos2D Demo for iPhone" src="http://paulsolt.com/wp-content/uploads/2009/12/Screen-shot-2009-12-09-at-7.33.41-PM.png" alt="Cocos2D Demo for iPhone" width="554" height="298" /></a><p class="wp-caption-text">Cocos2D Demo for iPhone</p></div>
<p>A 2D graphics package to aid graphical applications on the iPhone. It provides some really neat animation support along with project templates to make setup a breeze. Cocos2D comes with two separate physics packages that you can incorporate into your game. The demo shows an animation trigger when the user pressed on the screen. Animations can be built from simple actions and combined to create a complex animation. It&#8217;s perfect for a platformer.</p>
<h4>Demo: Raytracing on the iPhone</h4>
<div id="attachment_382" class="wp-caption aligncenter" style="width: 300px"><a href="http://paulsolt.com/wp-content/uploads/2009/12/RaytracingIphoneFix.png"><img class="size-full wp-image-382" title="Raytracing with Photon Mapping" src="http://paulsolt.com/wp-content/uploads/2009/12/RaytracingIphoneFix.png" alt="Raytracing with Photon Mapping with correct aspect ratio" width="290" height="539" /></a><p class="wp-caption-text">Raytracing with Photon Mapping</p></div>
<p style="text-align: center;">
<p style="text-align: center;">
<p>I ported my computer graphics II ray tracer from OpenGL/GLUT to OpenGL ES on the iPhone. The performance is very slow on the iPhone 3G (133-230 seconds), but that&#8217;s to be expected with the given hardware. In the simulator it can render a scene in about 15 seconds. This demo shows how the performance of the actual device is vastly different from the iPhone simulator. I&#8217;m sure I can rework portions of the ray tracer to be more efficient, but that wasn&#8217;t the goal of the quick port.</p>
<h4>Resources:</h4>
<ul>
<li>OpenGL: &#8220;The Red Book&#8221; OpenGL(R) Programming Guide: The Official Guide to Learning OpenGL(R), Version 2.1 (6th Edition)</li>
<li>OpenGL ES Tutorials: <a href="http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html">http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html</a></li>
<li>Cocos2D: <a href="http://code.google.com/p/cocos2d-iphone/">http://code.google.com/p/cocos2d-iphone/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/12/iphone-development-with-opengl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone Development Talk</title>
		<link>http://paulsolt.com/2009/10/iphone-development-talk/</link>
		<comments>http://paulsolt.com/2009/10/iphone-development-talk/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 03:05:05 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CSC]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=346</guid>
		<description><![CDATA[Today I gave a presentation on iPhone Development at RIT for the Computer Science Community (CSC).If you enjoyed it let me know. I&#8217;m looking into starting an informal iPhone Dev workshop for more topics. Here are the slides and Xcode projects: Slides:  iPhone Development &#8211; Paul Solt 1. Demo: Hello World Pusher:  Foo2 2. Demo: [...]]]></description>
			<content:encoded><![CDATA[<p>Today I gave a presentation on iPhone Development at RIT for the Computer Science Community (<a title="Computer Science Community" href="http://csc.cs.rit.edu/">CSC</a>).If you enjoyed it let me know. I&#8217;m looking into starting an informal iPhone Dev workshop for more topics.</p>
<p><a href="http://paulsolt.com/wp-content/uploads/2009/10/iphone.jpg"><img class="aligncenter size-full wp-image-355" title="iphone" src="http://paulsolt.com/wp-content/uploads/2009/10/iphone.jpg" alt="iphone" width="337" height="400" /></a></p>
<p>Here are the slides and Xcode projects:</p>
<p>Slides:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/iPhone-Development-Paul-Solt1.pdf">iPhone Development &#8211; Paul Solt</a></p>
<p>1. Demo: Hello World Pusher:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/Foo2.zip">Foo2</a></p>
<p>2. Demo: Touch Input:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/Stalker.zip">Stalker</a></p>
<p>3. Demo: Robot Remote Control:  See my previous <a title="iPhone Remote Control" href="http://paulsolt.com/2009/08/iphone-playerstage-remote-control/">post</a></p>
<p>*The Touch Input demo was based on a demo given during the Stanford iPhone courses available on iTunes <a title="Stanford iPhone Course" href="http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024353968.2024239964?i=1439008681">here</a>.</p>
<p><strong>Resources:</strong></p>
<ul>
<li>Cocoa Programming for Mac OS X by Aaron Hillegass (Third Edition)</li>
<li>Stanford iPhone Course (<a href="http://cs193p.stanford.edu/">cs193p.stanford.edu</a>)
<ul>
<li>Search “iPhone Application Programming” in iTunes</li>
</ul>
</li>
<li>Beginning iPhone 3 Development: Exploring the iPhone SDK by Jeff LaMarche
<ul>
<li>Blog: <a href="http://iphonedevelopment.blogspot.com"> iphonedevelopment.blogspot.com</a></li>
</ul>
</li>
<li>iPhone Dev Center
<ul>
<li><a href="http://developer.apple.com/iphone">developer.apple.com/iphone</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/10/iphone-development-talk/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>iPhone Player/Stage Remote Control</title>
		<link>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/</link>
		<comments>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:28:44 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[player/stage]]></category>
		<category><![CDATA[remote control]]></category>
		<category><![CDATA[robotics]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=329</guid>
		<description><![CDATA[Here&#8217;s the iPhone Player/Stage Remote Control project! There&#8217;s a .pdf that describes how to setup Xcode in the .zip file. The goal of this project was to use the Player/Stage robotics code on the iPhone to communicate and control robots. I discuss how to setup the Xcode development environment. There are two example Xcode projects. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the iPhone Player/Stage Remote Control project! There&#8217;s a .pdf that describes how to setup Xcode in the .zip file.</p>
<p style="text-align: center;">
<div id="attachment_456" class="wp-caption aligncenter" style="width: 549px"><a href="http://paulsolt.com/wp-content/uploads/2009/08/RRemoteiPhone.png"><img class="size-full wp-image-456 " title="RRemoteiPhone" src="http://paulsolt.com/wp-content/uploads/2009/08/RRemoteiPhone.png" alt="" width="539" height="290" /></a><p class="wp-caption-text">Controlling a Robot over Wi-Fi</p></div>
<div id="attachment_455" class="wp-caption aligncenter" style="width: 506px"><a href="http://paulsolt.com/wp-content/uploads/2009/08/PlayerStage.png"><img class="size-full wp-image-455 " title="PlayerStage" src="http://paulsolt.com/wp-content/uploads/2009/08/PlayerStage.png" alt="" width="496" height="510" /></a><p class="wp-caption-text">A Virtual Robot in a Virtual World</p></div>
<p>The goal of this project was to use the Player/Stage robotics code on the iPhone to communicate and control robots. I discuss how to setup the  Xcode development environment. There are two example Xcode projects. The first one is an Objective-C project that wraps around the C++ Player/Stage code. The second project is a very primitive C++ program running on the iPhone without any UI. Both of these Xcode projects are fully documented and will serve as a starting point to iPhone Player/Stage development.</p>
<p>iPhone Player/Stage Remote Control Project: <a href="http://paulsolt.com/wp-content/uploads/2009/08/iPhonePlayerStage.zip">iPhonePlayerStage</a></p>
<p>Feel free to ask questions and let me know how you use the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>iPhone Default User Settings Null?</title>
		<link>http://paulsolt.com/2009/06/iphone-default-user-settings-null/</link>
		<comments>http://paulsolt.com/2009/06/iphone-default-user-settings-null/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 03:30:19 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[default values]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=232</guid>
		<description><![CDATA[I wanted to set default values for my application using a Settings.bundle and I ran into an interesting issue with iPhone SDK 2.2. If you don&#8217;t run the Settings application before your application runs for the first time, then the default settings are not set. It turns out that you&#8217;ll need to manually set them [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to set default values for my application using a Settings.bundle and I ran into an interesting issue with iPhone SDK 2.2. If you don&#8217;t run the Settings application before your application runs for the first time, then the default settings are not set. It turns out that you&#8217;ll need to manually set them on the first time the application is run.</p>
<h4>Setting defaults to the default value&#8230;</h4>
<p>I&#8217;m not sure why there isn&#8217;t a function that can set the values for me, but after digging I found someone who ran into the same dilema. I don&#8217;t want to have multiple locations with default values (code and a Settings.bundle), so I found a programmatic way to set all the default values if they haven&#8217;t been set.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>registerDefaultsFromSettingsBundle <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>settingsBundle <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Settings&quot;</span> ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;bundle&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>settingsBundle<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Could not find Settings.bundle&quot;</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #a61390;">return</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>settings <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithContentsOfFile<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>settingsBundle stringByAppendingPathComponent<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Root.plist&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>preferences <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>settings objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;PreferenceSpecifiers&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #400080;">NSMutableDictionary</span> <span style="color: #002200;">*</span>defaultsToRegister <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableDictionary</span> alloc<span style="color: #002200;">&#93;</span> initWithCapacity<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>preferences count<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>prefSpecification <span style="color: #a61390;">in</span> preferences<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>key <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>prefSpecification objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Key&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>key<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #002200;">&#91;</span>defaultsToRegister setObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>prefSpecification objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DefaultValue&quot;</span><span style="color: #002200;">&#93;</span> forKey<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSUserDefaults</span> standardUserDefaults<span style="color: #002200;">&#93;</span> registerDefaults<span style="color: #002200;">:</span>defaultsToRegister<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>defaultsToRegister release<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>All you have to do is call the above function if one of your Standard User Defaults returns <strong>null</strong>. Make the call once your application finishes loading like so:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// Get the application user default values</span>
	<span style="color: #400080;">NSUserDefaults</span> <span style="color: #002200;">*</span>user <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSUserDefaults</span> standardUserDefaults<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>server <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>user stringForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;server_address&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>server<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		<span style="color: #11740a; font-style: italic;">// If the default value doesn't exist then we need to manually set them.</span>
		<span style="color: #002200;">&#91;</span>self registerDefaultsFromSettingsBundle<span style="color: #002200;">&#93;</span>;
		server <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSUserDefaults</span> standardUserDefaults<span style="color: #002200;">&#93;</span> stringForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;server_address&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span>viewController.view<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p><strong><span class="pun">References:</span></strong></p>
<ul>
<li><span class="pun"><a title="iPhone Settings" href="http://stackoverflow.com/questions/510216/can-you-make-the-settings-in-settings-bundle-default-even-if-you-dont-open-the-s" target="_blank">http://stackoverflow.com/questions/510216/can-you-make-the-settings-in-settings-bundle-default-even-if-you-dont-open-the-s</a><br />
</span></li>
<li>Display code in your WordPress blog: <a href="http://wordpress.org/extend/plugins/wp-syntax/">http://wordpress.org/extend/plugins/wp-syntax/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/06/iphone-default-user-settings-null/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Player/Stage, MacPorts, and iPhone</title>
		<link>http://paulsolt.com/2009/04/playerstage-macports-and-iphone/</link>
		<comments>http://paulsolt.com/2009/04/playerstage-macports-and-iphone/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 22:43:40 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Macbook Pro]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[player/stage]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=193</guid>
		<description><![CDATA[Today I worked on setting up Player/Stage on my Macbook Pro with Leopard 10.5.6 and I ran into a few issues. I was using Macports 1.710 and I was attempting to install player-stage-player (2.03 2.1.2) and player-stage-stage (2.03 2.1.1) following a short guide at http://bentham.k2.t.u-tokyo.ac.jp/notebook/?p=247 If it&#8217;s your first time using macports it can take [...]]]></description>
			<content:encoded><![CDATA[<p>Today I worked on setting up Player/Stage on my Macbook Pro with Leopard 10.5.6 and I ran into a few issues.</p>
<p>I was using Macports 1.710 and I was attempting to install player-stage-player (2.03 <span style="text-decoration: line-through;">2.1.2</span>) and player-stage-stage (2.03 <span style="text-decoration: line-through;">2.1.1</span>) following a short guide at <a href="http://bentham.k2.t.u-tokyo.ac.jp/notebook/?p=247">http://bentham.k2.t.u-tokyo.ac.jp/notebook/?p=247</a></p>
<p>If it&#8217;s your first time using macports it can take a long time. I waited 2+ hours to download/build/install dependencies</p>
<p>I used the command:</p>
<pre>$ sudo port install playerstage-player playerstage-stage</pre>
<p>However it errored out at the end with the message:</p>
<pre>$ sudo port install playerstage-player playerstage-stage
---&gt;  Building playerstage-player
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_science_playerstage-player/work/player-2.0.4" &amp;&amp; make all " returned error 2
Command output: building '_playerc' extension
swigging playerc.i to playerc_wrap.c
swig -python -o playerc_wrap.c playerc.i
playerc.i:44: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG&lt;LANG&gt; instead.
playerc.i:82: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG&lt;LANG&gt; instead.
playerc.i:121: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG&lt;LANG&gt; instead.
playerc.i:127: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG&lt;LANG&gt; instead.
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -I./../.. -I../../../.. -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c playerc_wrap.c -o build/temp.macosx-10.5-i386-2.5/playerc_wrap.o
playerc_wrap.c: In function '_wrap_playerc_mclient_client_set':
playerc_wrap.c:40301: warning: assignment from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_addclient':
playerc_wrap.c:40504: warning: passing argument 2 of 'playerc_mclient_addclient' from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_client_set':
playerc_wrap.c:40301: warning: assignment from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_addclient':
playerc_wrap.c:40504: warning: passing argument 2 of 'playerc_mclient_addclient' from incompatible pointer type
gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc build/temp.macosx-10.5-i386-2.5/playerc_wrap.o -L./../../.libs -L../../../../libplayerxdr/.libs -L../../../../libplayercore/.libs -L../../../../libplayerjpeg/.libs -lplayerxdr -lplayerc -lplayerjpeg -ljpeg -lplayererror -o build/lib.macosx-10.5-i386-2.5/_playerc.so
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccI9TvVp.out
(No such file or directory)
error: command 'gcc' failed with exit status 1
make[6]: *** [pythonbuild] Error 1
make[5]: *** [all] Error 2
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Error: Status 1 encountered during processing.</pre>
<p>So I searched around the MacPorts website and I came across the ticket <a title="Bug Ticket" href="http://trac.macports.org/ticket/18891#comment:3">#18891</a>, which basically said to run the following command to change the version of <strong>python</strong> being used from 3.0 to 2.5.</p>
<pre>$ sudo port install python_select &amp;&amp; sudo python_select python25
Skipping org.macports.activate (python_select +darwin_9) since this
port is already active
---&gt;  Cleaning python_select
Selecting version "python25" for python</pre>
<p>Following that command I was able to finish installing Player/Stage via MacPorts by using the orginal port command.</p>
<pre>$ sudo port install playerstage-player playerstage-stage
---&gt;  Building playerstage-player
---&gt;  Staging playerstage-player into destroot
---&gt;  Installing playerstage-player @2.0.4_2
---&gt;  Activating playerstage-player @2.0.4_2
---&gt;  Cleaning playerstage-player
---&gt;  Fetching playerstage-stage
---&gt;  Attempting to fetch stage-2.0.3.tar.bz2 from

http://voxel.dl.sourceforge.net/playerstage

---&gt;  Verifying checksum(s) for playerstage-stage
---&gt;  Extracting playerstage-stage
---&gt;  Configuring playerstage-stage
---&gt;  Building playerstage-stage
---&gt;  Staging playerstage-stage into destroot
---&gt;  Installing playerstage-stage @2.0.3_0
---&gt;  Activating playerstage-stage @2.0.3_0
---&gt;  Cleaning playerstage-stage</pre>
<p>I tried to use player stage from MacPorts.</p>
<pre>$ player /opt/local/var/macports/software/playerstage-stage\
/*/opt/local/share/stage/worlds/simple.cfg</pre>
<p>And I received the error:</p>
<pre>rr: unable to open color database /usr/X11R6/lib/X11/rgb.txt
 : No such file or directory (stage.c stg_lookup_color)</pre>
<p>Following the advice from <a title="PlayerStage setup" href="http://bentham.k2.t.u-tokyo.ac.jp/notebook/?cat=5" target="_blank">http://bentham.k2.t.u-tokyo.ac.jp/notebook/?cat=5</a> I added the following link.</p>
<div id="codebox">
<pre>$ sudo ln -s /usr/X11/share/X11/rgb.txt /usr/X11R6/lib/X11/rgb.txt</pre>
<p>Now I am able to create a player server and connect with a client with the commands:</p>
<pre>$ player /opt/local/var/macports/software/playerstage-stage\
/*/opt/local/share/stage/worlds/simple.cfg

/opt/local/var/macports/software/playerstage-player\
/*/opt/local/share/player/examples/libplayerc++/laserobstacleavoid</pre>
<p>With the ability to run player/stage I will post again on my progress as I use an iPhone to run the Player client, rather than my Macbook Pro.</p>
<div id="attachment_209" class="wp-caption alignleft" style="width: 644px"><a rel="attachment wp-att-209" href="http://paulsolt.com/2009/04/playerstage-macports-and-iphone/robotiphone/"><img class="size-full wp-image-209" title="robotiphone" src="http://paulsolt.com/wp-content/uploads/2009/04/robotiphone.png" alt="Player client running on iPhone with Player/Stage." width="634" height="688" /></a><p class="wp-caption-text">Player client running on iPhone with Player/Stage.</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/04/playerstage-macports-and-iphone/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->