title: Code coverage on iOS Using Xcode 4.2 on Lion
body: <p>I'm trying to produce gcd a files from an iOS Xcode 4.2 (4D199) project called CocoaTouchHax on Lion and I'm having incredible trouble. I followed the steps <a href="http://code.google.com/p/coverstory/wiki/UsingCoverstory" rel="nofollow">here</a> and I went as far as trying to build llvm/clang from source following steps <a href="http://mattrajca.com/post/8749868513/llvm-code-coverage-and-xcode-4" rel="nofollow">here</a>. However I continue to get this error:</p>
  
  <pre><code>Library not loaded: @executable_path/../lib/libprofile_rt.dylib
  </code></pre>
  
  <p>Where am I going wrong? I've tried to use the install_name_tool to fix the executable path to no avail. Am I over analyzing something? Am I missing something simple? I put this in as a "Run Script" phase prior to linking to ensure I've updated the @executable path and I use tool to examine the file after and the name is updated:</p>
  
  <pre><code>install_name_tool -id @executable_path/Users/cliff/dev/CocoaTouchHax/build/CocoaTouchHax/Build/Products/Debug-iphonesimulator/lib/libprofile_rt.dylib build/CocoaTouchHax/Build/Products/Debug-iphonesimulator/lib/libprofile_rt.dylib
  </code></pre>
  
  <p>What am I doing wrong? Help!</p>
  
  <p><strong>Update</strong>
  Merely adding lib profile_rt.dylib crashes my test run immediately giving the following error when anything is run:
  @executable_path/../lib/libprofile_rt.dylib
  So I am certain that something needs to happen or something needs to be done to the lib profile_rt.dylib prior to execution.</p>
  
  <p><strong>Another Update</strong> I tried creating a sum link to 
  /Developer/usr/lib
  under /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Developer/usr
  Which I believe is part of the base the path forming the current working directory when test runs. (Assuming it runs from the bin folder there.) This would, in theory, complete the relative lookup path of ../lib/libprofile_rt.dylib from that base path but it didn't work. I've tried running the install_name_tool command prior to copying the dylib in place but I still get this error:</p>
  
  <blockquote>
    <p>Library not loaded: @executable_path/../lib/libprofile_rt.dylib</p>
  </blockquote>
  
  <p>I don't know what I'm doing wrong. I somehow did manage to get test coverage files to emit using some combination of the above but I was not paying close enough attention and cannot reproduce the occurance. I know this can work, I just need a little more help figuring out how.</p>