Boost C++ Libraries: Ticket #3558: como throws error: the global scope has no snprintf https://svn.boost.org/trac10/ticket/3558 <p> Building Boost.Test from trunk (<a class="changeset" href="https://svn.boost.org/trac10/changeset/57142" title="Spirit: fixed karma alternative handling">r57142</a>) using <a class="ext-link" href="http://www.comeaucomputing.com/43101features.html"><span class="icon">​</span>Comeau C/C++ 4.3.10.1</a> gives errors about missing snprintf function: </p> <pre class="wiki">como-linux.compile.c++ ../../bin.v2/libs/test/build/como-linux/debug/debug.o Comeau C/C++ 4.3.10.1 (May 7 2008 12:23:21) for LINUX_INTEL_ELF_Beta Copyright 1988-2008 Comeau Computing. All rights reserved. MODE:non-strict warnings C++ noC++0x_extensions "../../boost/test/impl/debug.ipp", line 320: error: the global scope has no "snprintf" ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid ); ^ "../../boost/test/impl/debug.ipp", line 420: error: the global scope has no "snprintf" ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); ^ "../../boost/test/impl/debug.ipp", line 426: error: the global scope has no "mkstemp" fd_holder cmd_fd( ::mkstemp( cmd_file_name ) ); ^ "../../boost/test/impl/debug.ipp", line 492: error: the global scope has no "snprintf" ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name ); ^ "../../boost/test/impl/debug.ipp", line 516: error: the global scope has no "snprintf" ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s", ^ "../../boost/test/impl/debug.ipp", line 530: error: the global scope has no "snprintf" ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); ^ "../../boost/test/impl/debug.ipp", line 545: error: the global scope has no "snprintf" ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); ^ "../../boost/test/impl/debug.ipp", line 582: error: the global scope has no "snprintf" ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); ^ "../../boost/test/impl/debug.ipp", line 714: error: the global scope has no "kill" ::kill( ::getpid(), SIGTRAP ); ^ "../../boost/test/impl/debug.ipp", line 863: error: the global scope has no "mkstemp" fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) ); ^ 10 errors detected in the compilation of "../../libs/test/src/debug.cpp". como -tused -c --long_long -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 --no_inlining -O0 -g --exceptions -I"../.." -o "../../bin.v2/libs/test/build/como-linux/debug/debug.o" "../../libs/test/src/debug.cpp" 2&gt;&amp;1 ...failed como-linux.compile.c++ ../../bin.v2/libs/test/build/como-linux/debug/debug.o... </pre><p> I installed Comeau compiler with <em>relaxed mode</em> of compilation configured as default. The snprintf function comes from C99 and as far as I'm experienced with Comeau C/C++, in relaxed mode it is not available unless Comeau's option <em>--c99</em> is specified </p> <p> Environment: Ubuntu 9.04 (32-bit), GCC 4.3.3, Comeau C/C++ 4.3.10.1 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3558 Trac 1.4.3 Gennadiy Rozental Sun, 22 Nov 2009 23:38:55 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3558#comment:1 https://svn.boost.org/trac10/ticket/3558#comment:1 <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">wontfix</span> </li> </ul> <p> Looks like it can't fine mkstemp as well. How about execution_monitor? it uses vsnprintf as well? We do want to use snprintf. I do not have access to this compiler. Please provide patch and I can incorporate it. </p> Ticket mloskot <mateusz@…> Sun, 22 Nov 2009 23:56:15 GMT <link>https://svn.boost.org/trac10/ticket/3558#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3558#comment:2</guid> <description> <p> As I <a class="ext-link" href="http://lists.boost.org/Archives/boost/2009/11/158973.php"><span class="icon">​</span>explained on the mailing list</a>, the issue is that I found it not possible to enable both C99 and C++ modes for Comeau compiler. </p> <p> Regarding mkstemp and others, these are POSIX functions and it's easy to enable them by adding extra preprocessor definition <em>-D_SVID_SOURCE</em> </p> <p> I'll try to sort it out and to submit patch. In the meantime, would it be possible to enable <em>_SVID_SOURCE</em> for the como toolset in Jamfiles? </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Tue, 24 Nov 2009 00:00:50 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3558 https://svn.boost.org/trac10/ticket/3558 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">como-snprintf-svnprintf-ticket-3558.patch</span> </li> </ul> <p> Patch adding snprintf and vsnprintf workaround based on sprintf/vsprintf for Comeau C++ compiler </p> Ticket mloskot <mateusz@…> Tue, 24 Nov 2009 00:02:21 GMT <link>https://svn.boost.org/trac10/ticket/3558#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3558#comment:3</guid> <description> <p> Regarding my comment about POSIX support for Comeau compiler, here is separate ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3662" title="#3662: Patches: Define _SVID_SOURCE and _POSIX_SOURCE for Comeau (closed: duplicate)">#3662</a> with patch that shows what definitions are missing. </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Tue, 24 Nov 2009 02:48:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3558#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3558#comment:4</guid> <description> <p> Related ticket, but not duplicate, is <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3662" title="#3662: Patches: Define _SVID_SOURCE and _POSIX_SOURCE for Comeau (closed: duplicate)">#3662</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>