Boost C++ Libraries: Ticket #12617: clock_gettime not available on OS X 10.11 https://svn.boost.org/trac10/ticket/12617 <p> Looks like the Boost.Interprocess check for <code>clock_gettime</code> does not correctly handle OS X 10.11. </p> <p> (see os_thread_functions.hpp) </p> <p> Here is a small self-contained test case triggering on OS X 10.11 with xcode8: </p> <pre class="wiki">$ xcodebuild -version Xcode 8.1 Build version 8B62 </pre><pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/interprocess/detail/os_thread_functions.hpp&gt; int main() { boost::interprocess::ipcdetail::get_current_system_highres_count(); std::clog &lt;&lt; "hello" &lt;&lt; "\n"; return 0; } </pre><pre class="wiki">$ clang++ -o t t.cpp -Imason_packages/headers/boost/1.61.0/include/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wl,-bind_at_load $ ./t dyld: Symbol not found: _clock_gettime Referenced from: /Users/dane/projects/osrm-backend/./t (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib in /Users/dane/projects/osrm-backend/./t Trace/BPT trap: 5 </pre><p> Downstream ticket is at: <a class="ext-link" href="https://github.com/Project-OSRM/osrm-backend/issues/3297#issuecomment-262037848"><span class="icon">​</span>https://github.com/Project-OSRM/osrm-backend/issues/3297#issuecomment-262037848</a> </p> <p> Seems like is does not trigger on OS X 10.12, though. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12617 Trac 1.4.3 Ion Gaztañaga Sat, 26 Nov 2016 23:13:47 GMT <link>https://svn.boost.org/trac10/ticket/12617#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12617#comment:1</guid> <description> <p> In theory clock_gettime is used if BOOST_INTERPROCESS_CLOCK_MONOTONIC is defined. This is defined if one of the following is defined: </p> <p> CLOCK_MONOTONIC_PRECISE <em>bsd </em></p> <p> CLOCK_MONOTONIC_RAW <em>linux </em></p> <p> CLOCK_HIGHRES <em>solaris </em></p> <p> Is any of those defined in macos 10.11? In theory the implementation should use a mac-os specific code calling match kernel functions (BOOST_INTERPROCESS_MATCH_ABSOLUTE_TIME should be defined). </p> <p> Could you please check why BOOST_INTERPROCESS_MATCH_ABSOLUTE_TIME is not defined in mac os 10.11? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Chris Newbold</dc:creator> <pubDate>Tue, 17 Jan 2017 13:04:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12617#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12617#comment:2</guid> <description> <p> It appears that the macOS 10.12 SDK, which is what is used with XCode 8, defines both CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW which then causes Boost.Interprocess to follow the Linux branch and reach for clock_gettime. That works fine when actually running on a 10.12 machine, but 10.11 does not have clock_gettime so you get a busted executable that dies at runtime with an unresolved external. </p> <p> Unfortunately Apple does not condition the definition of these macros on the deployment target, so even telling XCode 8 that you're targeting 10.11 results in references to clock_gettime. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>rjain</dc:creator> <pubDate>Tue, 31 Jan 2017 06:27:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12617#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12617#comment:3</guid> <description> <p> We applied the following patch. So even if CLOCK_MONOTINIC and CLOCK_MONOTONIC_RAW are defined we explicitly include "mach_time.h". Hence no reference to _clock_gettime() </p> <pre class="wiki">//Xcode 8 fix due to ::clock_gettime issue # if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) # include &lt;mach/mach_time.h&gt; // mach_absolute_time, mach_timebase_info_data_t # define BOOST_INTERPROCESS_MATCH_ABSOLUTE_TIME # elif defined(CLOCK_MONOTONIC_PRECISE) //BSD # define BOOST_INTERPROCESS_CLOCK_MONOTONIC CLOCK_MONOTONIC_PRECISE # elif defined(CLOCK_MONOTONIC_RAW) //Linux # define BOOST_INTERPROCESS_CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW # elif defined(CLOCK_HIGHRES) //Solaris # define BOOST_INTERPROCESS_CLOCK_MONOTONIC CLOCK_HIGHRES # elif defined(CLOCK_MONOTONIC) //POSIX (AIX, BSD, Linux, Solaris) # define BOOST_INTERPROCESS_CLOCK_MONOTONIC CLOCK_MONOTONIC </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Mon, 06 Feb 2017 13:14:11 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12617#comment:4 https://svn.boost.org/trac10/ticket/12617#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks for the patch. Applied in: </p> <p> <a class="ext-link" href="https://github.com/boostorg/interprocess/commit/e9251cd22a3371299dea33bb0a8a9ba0d73e0c06"><span class="icon">​</span>https://github.com/boostorg/interprocess/commit/e9251cd22a3371299dea33bb0a8a9ba0d73e0c06</a> </p> Ticket