Boost C++ Libraries: Ticket #7440: boost::filesystem compile error on solaris 10 https://svn.boost.org/trac10/ticket/7440 <p> It fails to compile on gcc 4.7.2 with compile flags cxxflags=-std=c++0x<br /> </p> <p> libs/filesystem/src/operations.cpp: In function 'void boost::filesystem::detail: :permissions(const boost::filesystem::path&amp;, boost::filesystem::perms, boost::system::error_code*)': libs/filesystem/src/operations.cpp:1412:11: error: '::fchmodat' has not been declared </p> <p> in line 1410 there is:<br /> </p> <pre class="wiki">&amp;&amp; !(defined(__SUNPRO_CC) || defined(sun)) \ </pre><p> proper check for solaris would be:<br /> </p> <pre class="wiki">&amp;&amp; !(defined(__SUNPRO_CC) || defined(sun) || defined(__sun)) \ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7440 Trac 1.4.3 anonymous Sat, 29 Sep 2012 14:23:58 GMT component changed; owner set https://svn.boost.org/trac10/ticket/7440#comment:1 https://svn.boost.org/trac10/ticket/7440#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Beman Dawes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> </ul> Ticket Derek Beatty <dbeatty@…> Mon, 04 Mar 2013 22:11:20 GMT <link>https://svn.boost.org/trac10/ticket/7440#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:2</guid> <description> <p> Actually the OS, not the compiler or compiler version, determines whether or not <code>fchmodat</code> is defined, so a better fix is to test against the OS. </p> <p> One possible fix is per this diff (relative to boost 1.50.0). </p> <pre class="wiki">% diff -c libs/filesystem/src/operations.cpp.ori libs/filesystem/src/operations.cpp *** libs/filesystem/src/operations.cpp.ori Mon Jun 18 04:40:57 2012 --- libs/filesystem/src/operations.cpp Fri Feb 22 15:00:15 2013 *************** *** 1397,1403 **** // Mac OS X Lion and some other platforms don't support fchmodat() # if defined(AT_FDCWD) &amp;&amp; defined(AT_SYMLINK_NOFOLLOW) \ ! &amp;&amp; (!defined(__SUNPRO_CC) || __SUNPRO_CC &gt; 0x5100) if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms), !(prms &amp; symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW)) # else // fallback if fchmodat() not supported --- 1397,1403 ---- // Mac OS X Lion and some other platforms don't support fchmodat() # if defined(AT_FDCWD) &amp;&amp; defined(AT_SYMLINK_NOFOLLOW) \ ! &amp;&amp; (!defined(__SunOS)) if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms), !(prms &amp; symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW)) # else // fallback if fchmodat() not supported % </pre> </description> <category>Ticket</category> </item> <item> <author>aleksandar.vukajlovic@…</author> <pubDate>Tue, 05 Mar 2013 09:50:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7440#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:3</guid> <description> <p> Did you try it on solaris 10 , gcc 4.7.2 with -std=c++0x switch enabled ? gcc should not define <span class="underline">SunOS , you can try gcc -dM -E - &lt; /dev/null it will print all predefined macros </span></p> <p> gcc claims that sun and <span class="underline">sun should be defined both , and they are if std=c++0x not used, but when using std=c++0x than only </span>sun is defined. I am not sure if this is proper behavior of gcc, but doc says that "<span class="underline">platform" macros like </span>sun , <span class="underline">linux and so on are newer than sun or linux. For fchmodat issue boost already uses </span></p> <table class="wiki"> <tr>&amp;&amp; !(defined(linux) <td> defined(<span class="underline">linux) </span></td><td> defined(<span class="underline">linux</span>)) for linux platform and it works perfectly well. </td></tr></table> </description> <category>Ticket</category> </item> <item> <author>Derek Beatty <dbeatty@…></author> <pubDate>Tue, 05 Mar 2013 14:46:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7440#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:4</guid> <description> <p> No, and I don't have gcc 4.7.2 easily available. I built on Solaris 10 with Oracle Solaris Studio 12 update 3, which is Oracle's latest compiler for Solaris. The compilation fails because in that case <code>__SUNPRO_CC</code> is defined as <code>0x5200</code> but <code>fchmodat</code> is not available on Solaris 10. However, <code>fchmodat</code> is available on Solaris 11. We can't tell for sure what will be in future versions of Solaris, but my guess is that <code>fchmodat</code> will stay, as I doubt Oracle would break the Solaris Binary Guarantee. </p> <p> So, how to fix this? I think Oracle's toolchain is probably what most people prefer on Solaris but Boost needs to work regardless of choice of compiler. </p> <p> Also, it would be good to fix this correctly, or at least as correctly as we can with the efffort we can spare. With gcc, there's no way to test the version of Solaris, so only thing we can test easily, is whether <code>__sun</code> is defined. (The harder way would be to delve into <code>configure</code> magic and test there whether <code>fchmodat</code> is available, but I've never done something like that myself.) </p> <p> So, assuming we don't go the <code>configure</code> route, if <code>__SUNPRO_CC</code> is defined, then if <code>__SunOS_5_10</code> is defined we're on Solaris 10 so we don't have <code>fchmodat</code>, and otherwise we do have <code>fchmodat</code>. But if <code>__SUNPRO_CC</code> is not defined, then if <code>__sun</code> is defined we're on Solaris, of unknown version, so we have to assume we don't have <code>fchmodat</code>. </p> <p> Does that make sense? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 05 Mar 2013 15:23:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7440#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:5</guid> <description> <p> From boost 1.51 it seems that fchmodat is disabled (according to source code) for all solaris platforms (although solaris 11 has fchmodat). I can agree with comment in source code that runtime check is too much trouble. There is compile error when using gcc with compile switch std=c++0x (works without) and we should use <code>__sun</code> macro to fix compile error. I am not sure if this is gcc or boost bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 24 Jun 2013 19:09:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7440#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:6</guid> <description> <p> The actual issue is caused by libs/locale/src/util/gregorian.cpp </p> <pre class="wiki">int first_day_of_week(char const *terr) { static char const * const sat[] = { "AE","AF","BH","DJ","DZ","EG","ER","ET","IQ","IR", "JO","KE","KW","LY","MA","OM","QA","SA","SD","SO", "SY","TN","YE" }; // workaround for Sun Solaris !@#%@#$%@#$%234 #ifdef sun #undef sun #endif static char const * const sun[] = { "AR","AS","AZ","BW","CA","CN","FO","GE","GL","GU", "HK","IL","IN","JM","JP","KG","KR","LA","MH","MN", "MO","MP","MT","NZ","PH","PK","SG","TH","TT","TW", "UM","US","UZ","VI","ZW" }; if(strcmp(terr,"MV") == 0) return 5; // fri if(std::binary_search&lt;char const * const *&gt;(sat,sat+sizeof(sat)/(sizeof(sat[0])),terr,comparator)) return 6; // sat if(std::binary_search&lt;char const * const *&gt;(sun,sun+sizeof(sun)/(sizeof(sun[0])),terr,comparator)) return 0; // sun // default return 1; // mon } </pre><p> <em>sun</em> has actually been redefined! </p> <p> I will attach a patch that fixes this issue (and also adds the additional check for <em>__sun</em> to perform better detection of Solaris). </p> </description> <category>Ticket</category> </item> <item> <author>Chris Stylianou <chris5287@…></author> <pubDate>Mon, 24 Jun 2013 19:10:02 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/7440 https://svn.boost.org/trac10/ticket/7440 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patch.txt</span> </li> </ul> Ticket Chris Stylianou <chris5287@…> Mon, 21 Oct 2013 14:52:05 GMT <link>https://svn.boost.org/trac10/ticket/7440#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7440#comment:7</guid> <description> <p> Any chance of reviewing this? </p> </description> <category>Ticket</category> </item> </channel> </rss>