Boost C++ Libraries: Ticket #3548: Comeau C++ reports global scope has no int64_t https://svn.boost.org/trac10/ticket/3548 <p> When Comeau C/C++ 4.3.10.1 compiles a program that includes &lt;boost/cstdint.hpp&gt; from Boost from SVN trunk (<a class="changeset" href="https://svn.boost.org/trac10/changeset/57088" title="Portability: Adjusted code for gcc-3.4.4. Stable {msvc-8.0, 9.0, ...">r57088</a>) it throws the following error: </p> <pre class="wiki">mloskot@vb-ubuntu904:~/dev/ggl/_svn/trunk/libs/ggl/example$ bjam 02_linestring_example ...patience... ...found 900 targets... ...updating 2 targets... como-linux.compile.c++ bin/como-linux/debug/02_linestring_example.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 "/home/mloskot/dev/boost/_svn/trunk/boost/cstdint.hpp", line 111: error: the global scope has no "int64_t" using ::int64_t; ^ </pre><p> Environment: Linux Ubuntu 9.04 32-bit with GCC 4.3.3 and Comeau C/C++ 4.3.10.1 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3548 Trac 1.4.3 mloskot <mateusz@…> Sun, 25 Oct 2009 12:37:11 GMT <link>https://svn.boost.org/trac10/ticket/3548#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:1</guid> <description> <p> I think I have managed to reproduce the problem with minimal program. I'm not sure where is the problem, either in Boost.Integer or <a class="ext-link" href="http://www.comeaucomputing.com/libcomo/36.html"><span class="icon">​</span>libcomo36</a> I use with my installation of Comeau C/C++ compiler. </p> <ul><li>Simple test which <strong>do not</strong> compile </li></ul><pre class="wiki">$ cat cstdint.cpp #include &lt;iostream&gt; #include &lt;boost/cstdint.hpp&gt; int main() { boost::int64_t i64 = -2; boost::uint64_t ui64 = 2; boost::uint64_t d = ui64 - i64; std::cout &lt;&lt; d &lt;&lt; std::endl; return 0; } $ como -I/home/mloskot/dev/boost/_svn/trunk cstdint.cpp 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 "/home/mloskot/dev/boost/_svn/trunk/boost/cstdint.hpp", line 111: error: the global scope has no "int64_t" using ::int64_t; ^ "cstdint.cpp", line 5: error: namespace "boost" has no member "int64_t" boost::int64_t i64 = -2; ^ 2 errors detected in the compilation of "cstdint.cpp". </pre><ul><li>The same simple test but with <em>#include</em> directives reordered and now it <strong>does</strong> compile </li></ul><pre class="wiki">$ cat cstdint.cpp #include &lt;boost/cstdint.hpp&gt; #include &lt;iostream&gt; int main() { boost::int64_t i64 = -2; boost::uint64_t ui64 = 2; boost::uint64_t d = ui64 - i64; std::cout &lt;&lt; d &lt;&lt; std::endl; return 0; } $ como -I/home/mloskot/dev/boost/_svn/trunk cstdint.cpp 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 $ ./a.out 4 </pre><p> I'd appreciate if somebody could confirm if this is Boost problem or not. </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Fri, 13 Nov 2009 01:09:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3548#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:2</guid> <description> <p> I have made yet another test trying to compile examples of accumulators library from current trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/57618" title="Suppress warnings on msvc-7.1">r57618</a> and the <em>::uint64_t</em> error is still being thrown. It looks like a stopper preventing compilation of most libraries. </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Sat, 14 Nov 2009 23:37:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3548#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:3</guid> <description> <p> Thanks it como's option <em>--list</em>, I confirmed that in the first case that fails to compile uint64_t is not defined indeed. Preprocessed source of the program shows that first header <em>/usr/include/sys/types.h</em> is included and it consits of this: </p> <pre class="wiki">/* These types are defined by the ISO C99 header &lt;inttypes.h&gt;. */ # ifndef __int8_t_defined # define __int8_t_defined typedef char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # elif __GLIBC_HAVE_LONG_LONG __extension__ typedef long long int int64_t; # endif # endif </pre><p> causing the following effects: </p> <ul><li>WORDSIZE == 64 is false, so uint64_t is not defined </li><li>_ _ GLIBC_HAVE_LONG_LONG is not defined, so second try to define uint64_t is not performed </li><li><em>_ _ int8_t_defined</em> is eventually defined </li></ul><p> Next, <em>/usr/include/stdint.h</em> is included and it consits some repeated definitions from <em>sys/types.h</em>, but with slight difference: </p> <pre class="wiki">/* There is some amount of overlap with &lt;sys/types.h&gt; as known by inet code */ #ifndef __int8_t_defined # define __int8_t_defined typedef signed char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # else __extension__ typedef long long int int64_t; # endif #endi # endif </pre><p> However, these definitions are not enabled because <em>_ _ int8_t_defined</em> has been already defined by <em>sys/types.h</em>, so, what's most important here, int64_t type is not defined. </p> <p> The slight difference I mentioned above seems to be important: </p> <pre class="wiki"># elif __GLIBC_HAVE_LONG_LONG __extension__ typedef long long int int64_t; # endif </pre><p> versus </p> <pre class="wiki"># else __extension__ typedef long long int int64_t; # endif </pre><p> To summary, if <em>stdint.h</em> would get first, int64_t was defined. </p> <p> Also, the slight difference in testing vs no testing <em>_ _ GLIBC_HAVE_LONG_LONG</em> seems to be an inconsistency in standard headers and may look like a bug, so I'm going to try to confirm it. </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Sun, 15 Nov 2009 00:09:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3548#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:4</guid> <description> <p> Following my last comment, here is are minimal programs to reproduce the problem using Comeau C/C++ compiler: </p> <ul><li>This version does <strong>not</strong> compile </li></ul><pre class="wiki">$ cat bad.cpp #include &lt;sys/types.h&gt; #include &lt;boost/cstdint.hpp&gt; int main() { boost::int64_t a(0); return 0; } $ como -I/home/mloskot/dev/boost/_svn/trunk bad.cpp 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 "/home/mloskot/dev/boost/_svn/trunk/boost/cstdint.hpp", line 111: error: the global scope has no "int64_t" using ::int64_t; ^ "bad.cpp", line 5: error: namespace "boost" has no member "int64_t" boost::int64_t a(0); ^ </pre><ul><li>This version does compile </li></ul><pre class="wiki">$ cat good.cpp #include &lt;stdint.h&gt; #include &lt;boost/cstdint.hpp&gt; int main() { boost::int64_t a(0); return 0; } $ como -I/home/mloskot/dev/boost/_svn/trunk good.cpp 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 "good.cpp", line 5: warning: variable "a" was declared but never referenced boost::int64_t a(0); ^ </pre><p> I've also tried to find open GCC bugs related to this issue, but the only I found that mentions stdint.h file and preprocessor define <em>_ _ int8_t_defined</em> is <a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=448"><span class="icon">​</span>Bug 448</a> - &lt;stdint.h&gt;-related issues (C99 issues), however it was reported to old GCC 2.96. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 20 Nov 2009 00:42:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3548#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:5</guid> <description> <p> It looks that in my last comment, I mixed names uint64_t vs int64_t in my explanations, however the code examples present everything correctly. I hope it does not confuse much. </p> </description> <category>Ticket</category> </item> <item> <author>mloskot <mateusz@…></author> <pubDate>Fri, 20 Nov 2009 01:05:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3548#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:6</guid> <description> <p> I have consulted this issue with Comeau C/C++ team and the difference in both definitions of int64_t type looks odd and potentially like a bug in GNU C Library. I will keep in touch with Comeau team regarding this. </p> <p> In the meantime, due to the odd difference in definition, I (tentatively) decided to submit bug report to GNU C Library to get the issue analysed by their camp. Here it is: </p> <ul><li>Bug 10990 - <a class="ext-link" href="http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990"><span class="icon">​</span>Inconsistent definition of int64_t in sys/types and stdint.h</a> </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 22 Nov 2009 17:43:53 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/3548#comment:7 https://svn.boost.org/trac10/ticket/3548#comment:7 <ul> <li><strong>cc</strong> <span class="trac-author">John Maddock</span> added </li> </ul> <p> Can you please try the attached patch? </p> Ticket John Maddock Sun, 22 Nov 2009 17:44:40 GMT attachment set https://svn.boost.org/trac10/ticket/3548 https://svn.boost.org/trac10/ticket/3548 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">commeau.diff</span> </li> </ul> Ticket mloskot <mateusz@…> Sun, 22 Nov 2009 20:50:48 GMT <link>https://svn.boost.org/trac10/ticket/3548#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3548#comment:8</guid> <description> <p> John, </p> <p> I can confirm that the simple test <em>bad.cpp</em> which uses &lt;boost/cstdint.hpp&gt; does compile with your patch: </p> <pre class="wiki">mloskot@vb-ubuntu904:~/dev/boost/tickets/3548$ cat bad.cpp #include &lt;sys/types.h&gt; #include &lt;boost/cstdint.hpp&gt; int main() { boost::int64_t a(0); return 0; } mloskot@vb-ubuntu904:~/dev/boost/tickets/3548$ como -I/home/mloskot/dev/boost/_svn/trunk bad.cpp 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 "bad.cpp", line 5: warning: variable "a" was declared but never referenced boost::int64_t a(0); ^ </pre><p> Also, big thanks for your comment to the glibc bugzilla. I will forward Ulrich's explanation about requirement of <em>_ _ GLIBC_HAVE_LONG_LONG</em> to Comeau team as it may be of their interest indeed. </p> <p> So, do you think it's possible to apply your patch to the Boost trunk? It would make it possible to move forward with testing Boost using Comeau. </p> <p> Thanks you! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 23 Nov 2009 09:51:27 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3548#comment:9 https://svn.boost.org/trac10/ticket/3548#comment:9 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57858" title="Fix for Comeau compiler - does not define __GLIBC_HAVE_LONG_LONG which ...">[57858]</a>) Fix for Comeau compiler - does not define <span class="underline">GLIBC_HAVE_LONG_LONG which in turn causes GLIBC's stdint.h to misbehave. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3548" title="#3548: Bugs: Comeau C++ reports global scope has no int64_t (closed: fixed)">#3548</a>. </span></p> Ticket michaelsheppa1469@… Fri, 17 Mar 2017 02:35:58 GMT attachment set https://svn.boost.org/trac10/ticket/3548 https://svn.boost.org/trac10/ticket/3548 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">commeau.2.diff</span> </li> </ul> <p> I want to view my account history&gt; manage my services talk &amp; text history&gt; talk &amp; text history: past 2 months </p> Ticket