Boost C++ Libraries: Ticket #6766: incorrect declaration for putenv in config.hpp https://svn.boost.org/trac10/ticket/6766 <p> File boost/test/utils/runtime/config.hpp at lines 47-49 has </p> <pre class="wiki">#ifdef __SUNPRO_CC extern int putenv(char *); #endif </pre><p> The immediate problem is that the function is declared as <code>extern "C"</code> on Solaris, which causes a conflict in BOOST components that include &lt;stdlib.h&gt;. A quick fix would be make this declaration <code>extern "C"</code>, but IMHO that is not the best fix. It addresses the problem only in testing BOOST, not necessarily in using BOOST. </p> <p> Oracle C++ (SUNPRO_CC) compilers support Linux in addition to Solaris, and follow the C++ standard regarding standard headers. Only declarations that are part of standard C or C++ appear in the &lt;cxxx&gt; headers. Additional declarations appear in the &lt;xxx.h&gt; headers, depending on the platform, since most platforms specify additional declarations for the C headers. </p> <p> For the case in point, &lt;cstdlib&gt; does not contain a declaration for putenv, but &lt;stdlib.h&gt; does, because POSIX specifies putenv as part &lt;stdlib.h&gt;. </p> <p> My guess is that some BOOST component(s) included &lt;cstdlib&gt; and expected to find putenv there -- a non-portable assumption. Somebody tried to fix the problem by adding a declaration to config.hpp, but got the declaration wrong. </p> <p> I recommend removing this hack from config.hpp, and fixing any tests that fail by including &lt;stdlib.h&gt; instead of &lt;cstdlib&gt;. That is, if you want a POSIX function, you should include a POSIX header. </p> <p> After removing the lines, the only failure I have found in BOOST 1.49 is libs/test/src/unit_test_parameters.cpp </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6766 Trac 1.4.3 Gennadiy Rozental Mon, 05 Nov 2012 09:55:28 GMT owner changed https://svn.boost.org/trac10/ticket/6766#comment:1 https://svn.boost.org/trac10/ticket/6766#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Steven Watanabe</span> </li> </ul> <p> Steven, </p> <p> This was your addition. I do not have access to this platform anymore. Do you mind looking into this? </p> Ticket Aparna Kumta <aparna.kumta@…> Thu, 05 Mar 2015 18:29:40 GMT <link>https://svn.boost.org/trac10/ticket/6766#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:2</guid> <description> <p> I see this failure in my Nightly regression testing in the develop branch when compiling libs/test/src/unit_test_parameters.cpp </p> <p> "/usr/include/stdlib.h", line 113: Error: putenv(char*) was declared before with a different language. 1 Error(s) detected. </p> <p> This seems to prevent building of libboost_unit_test_framework.a </p> <p> ...skipped &lt;p/export/users/akumta/BOOST_REGRESSION_patch_local/results/boost/bin.v2/libs/test/build/sun-stlport4/release/link-static/threading-multi&gt;libboost_unit_test_framework.a for lack of &lt;p/export/users/akumta/BOOST_REGRESSION_patch_local/results/boost/bin.v2/libs/test/build/sun-stlport4/release/link-static/threading-multi&gt;unit_test_parameters.o... </p> <p> Any idea when this fix could go in? </p> <p> Thank you. </p> </description> <category>Ticket</category> </item> <item> <author>Aparna Kumta <aparna.kumta@…></author> <pubDate>Thu, 05 Mar 2015 18:31:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6766#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:2</guid> <description> <p> I see this failure in my Nightly regression testing in the develop branch when compiling libs/test/src/unit_test_parameters.cpp </p> <p> "/usr/include/stdlib.h", line 113: Error: putenv(char*) was declared before with a different language. 1 Error(s) detected. </p> <p> This seems to prevent building of libboost_unit_test_framework.a </p> <p> ...skipped &lt;p/export/users/akumta/BOOST_REGRESSION_patch_local/results/boost/bin.v2/libs/test/build/sun-stlport4/release/link-static/threading-multi&gt;libboost_unit_test_framework.a for lack of &lt;p/export/users/akumta/BOOST_REGRESSION_patch_local/results/boost/bin.v2/libs/test/build/sun-stlport4/release/link-static/threading-multi&gt;unit_test_parameters.o... </p> <p> Any idea when this fix could go in? </p> <p> Thank you. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Wed, 11 Mar 2015 21:52:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6766#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:3</guid> <description> <p> The best would be to know which version of the SUNPRO_CC compiler the </p> <pre class="wiki">extern "C" void putenv </pre><p> is needed and change this as a workaround for version of the compiler earlier than this one. </p> <p> The problem is: no one has a Sun here. </p> <p> Digging a bit more: I can see a similar commit in rev cd47d62b4677b003a75885db5d08d50a1a586bf6 for the execution_monitor.hpp. So why not just having that in the config file? </p> <p> What version of the compiler do you have right now? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Wed, 11 Mar 2015 22:07:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6766#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:4</guid> <description> <p> I suspect that #include &lt;stdlib.h&gt; was the correct fix even when I put the workaround in originally. If I remember correctly I was running Solaris 10, Sun CC 5.9. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Wed, 11 Mar 2015 22:13:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6766#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:5</guid> <description> <p> Thanks. I am in favor of removing the hack and including the stdlib. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 21 Mar 2015 15:55:39 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/6766#comment:6 https://svn.boost.org/trac10/ticket/6766#comment:6 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Steven Watanabe</span> to <span class="trac-author">Raffi Enficiaud</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Tentative fix branch tractickets/6766-incorrect-declaration-for-putenv-in-config.hpp, commit 17bef37 (see PR <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/36" title="#36: Bugs: tools/build/jam_src/yyacc need exec mode (closed: Fixed)">#36</a>) </p> <p> Waiting for feedback before merging. </p> Ticket Aparna Kumta <aparna.kumta@…> Thu, 26 Mar 2015 17:34:43 GMT <link>https://svn.boost.org/trac10/ticket/6766#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:7</guid> <description> <p> Branch tractickets/6766-incorrect-declaration-for-putenv-in- config.hpp, commit 17bef37 has been tested with Oracle Solaris Studio compiler and the fix looks good. </p> <p> This ticket prevents building of libboost_unit_test_framework.a. As a result many tests (from accumulators, algorithm, assign, lexical_cast, msm, odeint, polygon, range and sync) fail due to a dependency on libboost_unit_test_framework.a. The fix significantly improves the pass rate of the test runs by 15% . </p> <p> We would highly appreciate it if the fix can be putback to develop/master so it can make 1.58 release. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Sat, 28 Mar 2015 00:55:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6766#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6766#comment:8</guid> <description> <p> Will be in develop soon, thanks for your patience. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Tue, 07 Jul 2015 07:44:35 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/6766#comment:9 https://svn.boost.org/trac10/ticket/6766#comment:9 <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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> Ticket