Boost C++ Libraries: Ticket #8696: chrono compilation error on Solaris/gcc https://svn.boost.org/trac10/ticket/8696 <p> The "timegm" function is not available on Solaris (Solaris 11) when using the gcc toolchain. It works fine for the sunpro toolchain. The "timegm" manual on regular linux says (man timegm): </p> <p> " </p> <blockquote> <p> For a portable version of timegm(), set the TZ environment variable to UTC, call mktime(3) and restore the value of TZ. Something like </p> </blockquote> <blockquote> <blockquote> <p> #include &lt;time.h&gt; #include &lt;stdlib.h&gt; </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> time_t my_timegm(struct tm *tm) { </p> <blockquote> <p> time_t ret; char *tz; </p> </blockquote> </blockquote> </blockquote> <blockquote> <blockquote> <blockquote> <p> tz = getenv("TZ"); setenv("TZ", "", 1); tzset(); ret = mktime(tm); if (tz) </p> <blockquote> <p> setenv("TZ", tz, 1); </p> </blockquote> <p> else </p> <blockquote> <p> unsetenv("TZ"); </p> </blockquote> <p> tzset(); return ret; </p> </blockquote> <p> } </p> </blockquote> </blockquote> <p> " </p> <p> The Boost.Chrono has its own implementation available as the internal_timegm() function, however the implementation is used only in very limited cases (currently Windows but not Cygwin env.) selected by the BOOST_CHRONO_INTERNAL_TIMEGM macrodefinition. The proposed patch enables the internal_timegm() also for Solaris/gcc. The issue concerns chrono in version 2 (BOOST_CHRONO_VERSION=2). </p> <p> The attached application reproduces the issue: </p> <p> $ g++ chrono_io_test_solaris.cpp -lboost_system -DBOOST_CHRONO_VERSION=2 In file included from boost/chrono/chrono_io.hpp:26:0, </p> <blockquote> <p> from chrono_io_test_solaris.cpp:1: </p> </blockquote> <p> boost/chrono/io/time_point_io.hpp: In function 'std::basic_istream&lt;_CharT, _Traits&gt;&amp; boost::chrono::operator&gt;&gt;(std::basic_istream&lt;_CharT, _Traits&gt;&amp;, boost::chrono::time_point&lt;boost::chrono::system_clock, Duration&gt;&amp;)': boost/chrono/io/time_point_io.hpp:1003:27: error: there are no arguments to 'timegm' that depend on a template parameter, so a declaration of 'timegm' must be available boost/chrono/io/time_point_io.hpp:1003:27: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) boost/chrono/io/time_point_io.hpp:1055:29: error: there are no arguments to 'timegm' that depend on a template parameter, so a declaration of 'timegm' must be available $ </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8696 Trac 1.4.3 tmmikolajczyk@… Fri, 14 Jun 2013 10:57:18 GMT attachment set https://svn.boost.org/trac10/ticket/8696 https://svn.boost.org/trac10/ticket/8696 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bug_8696.patch</span> </li> </ul> <p> patch </p> Ticket tmmikolajczyk@… Fri, 14 Jun 2013 10:57:52 GMT attachment set https://svn.boost.org/trac10/ticket/8696 https://svn.boost.org/trac10/ticket/8696 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">chrono_io_test_solaris.cpp</span> </li> </ul> <p> application to reproduce the issue </p> Ticket viboes Sat, 15 Jun 2013 09:06:27 GMT status, milestone changed https://svn.boost.org/trac10/ticket/8696#comment:1 https://svn.boost.org/trac10/ticket/8696#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> <p> Thanks for the patch. </p> Ticket viboes Sat, 15 Jun 2013 09:36:06 GMT <link>https://svn.boost.org/trac10/ticket/8696#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8696#comment:2</guid> <description> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/84790" title="Chrono: Apply patch to set BOOST_CHRONO_INTERNAL_TIMEGM on Solaris/gcc ...">[84790]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 15 Jun 2013 10:36:42 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8696#comment:3 https://svn.boost.org/trac10/ticket/8696#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84793" title="Chrono: fix #8691,#8696 and update history.">[84793]</a>) Chrono: fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8691" title="#8691: Bugs: iostate is not checked after scan_keyword call (closed: fixed)">#8691</a>,<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8696" title="#8696: Bugs: chrono compilation error on Solaris/gcc (closed: fixed)">#8696</a> and update history. </p> Ticket Stephen Clamage <stephen.clamage@…> Thu, 17 Apr 2014 22:05:38 GMT <link>https://svn.boost.org/trac10/ticket/8696#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8696#comment:4</guid> <description> <p> The original ticket description claims that timegm is available when using the sunpro toolchain on Solaris 11. That claim is not correct, and even with this bug fix the code does not work with the sunpro toolchain. I filed new ticket 9918 for this problem. </p> </description> <category>Ticket</category> </item> </channel> </rss>