<div dir="ltr"><div>I'm surprised DYLD_INSERT_LIBRARIES/DYLD_FORCE_FLAT_NAMESPACE works at all. I don't fully understand the impact of DYLD_FORCE_FLAT_NAMESPACE but non-trivial apps failed when I set it.<br></div><div>
<br></div><div style>One thing to bear in mind is that OpenGL API in Mac OSX is composed by nested dynamic libraries:  (this is from memory) there is a OpenGL.dylib which has a few entrypoints, and then depends on libGL.dydlib for most GL entrypoints, and libGLU.dylib too.</div>
<div><div class="gmail_extra"><br></div><div class="gmail_extra" style>I think your best bet is debugging why DYLD_LIBRARY_PATH does not work. You could set DYLD_PRINT_* debugging env vars like DYLD_PRINT_BINDINGS, with and without apitrace, and then analyse the differences in the logs.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">apitrace has always worked well for me on OSX, but I only use it with a select number of apps. I'd not be surprised if there are some corner case in OSX that we don't handle. Similar issues have happened with other platforms, and it took several iterations to handle them.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra" style>For the record, there might be other ways to inject into MacOSX OpenGL stack -- I suspect that tools like CHUD OpenGL Profiler inject straight into internal dispatch tables, but I never spent time investigating how, as the apitrace injection worked well for me as is.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra">Jose<br><br><div class="gmail_quote">On Sat, May 25, 2013 at 1:06 AM, Peter Lohrmann <span dir="ltr"><<a href="mailto:peterl@valvesoftware.com" target="_blank">peterl@valvesoftware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Now that I've got everything compiling correctly, I'm experiencing other issues that hopefully someone has encountered and knows a workaround for. I've been
 able to successfully use apitrace on a simple sample app (OSXGLEssentials), but am encountering other issues when trying trace a more complicated app.<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">if I use the recommended DYLD_LIBRARY_PATH approach, the app fails to load other libraries and doesn't run (I will investigate this issue, as its likely something
 simple). If I use DYLD_INSERT_LIBRARIES and DYLD_FORCE_FLAT_NAMESPACE=1, the application runs correctly and generates a trace file, but only CGL calls are recorded into the trace and none of the gl* calls. Any suggestions?<u></u><u></u></span></p>

<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thank you all,<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Peter<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class=""><b><span style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif"> José Fonseca [mailto:<a href="mailto:jose.r.fonseca@gmail.com" target="_blank">jose.r.fonseca@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, May 14, 2013 11:13 PM</span></p><div class="im"><br>
<b>To:</b> Peter Lohrmann<br>
<b>Cc:</b> Apitrace list<br>
<b>Subject:</b> Re: apitrace on OS X<u></u><u></u></div><p></p>
<p class=""><u></u> <u></u></p>
<div>
<p class=""><u></u> <u></u></p>
<div>
<p class="" style="margin-bottom:12pt"><u></u> <u></u></p>
<div>
<p class="">On Wed, May 15, 2013 at 1:54 AM, Peter Lohrmann <<a href="mailto:peterl@valvesoftware.com" target="_blank">peterl@valvesoftware.com</a>> wrote:<u></u><u></u></p><div><div class="h5">
<div>
<div>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Looks like the library I was generating was x86_64, but the application was strictly i386.  It took
 a bit of messing around with the project settings to get it to output just a 32-bit version, and then it seems the generated library went to a different directory /ApiTrace/build/wrappers/Debug instead of /ApiTrace/build/Debug/wrappers.</span><u></u><u></u></p>

</div>
</div>
<div>
<p class="">That's peculiar, as CMakeLists.txt should have built both architectures:<u></u><u></u></p>
</div>
<div>
<p class=""><u></u> <u></u></p>
</div>
<div>
<p class="">  # On Mac OS X build fat binaries with i386 and x86_64 architectures by default.<u></u><u></u></p>
</div>
<div>
<p class="">  if (APPLE AND NOT CMAKE_OSX_ARCHITECTURES)<u></u><u></u></p>
</div>
<div>
<p class="">      set (CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)<u></u><u></u></p>
</div>
<div>
<p class="">  endif ()<u></u><u></u></p>
</div>
<div>
<p class=""><u></u> <u></u></p>
</div>
<div>
<p class="">What XCode version did you use? Did you use cmake and make to build from commandline, or something different? <u></u><u></u></p>
</div>
<div>
<p class=""><u></u> <u></u></p>
</div>
<div>
<p class="">Jose<u></u><u></u></p>
</div>
</div></div></div>
</div>
</div>
</div>
</div>

</blockquote></div><br></div></div></div>