public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Kalamatee <kalamatee@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Problem porting gcc 12
Date: Tue, 11 Apr 2023 10:49:44 +0100	[thread overview]
Message-ID: <CAH6eHdQc7Jud+LxwQX9s4E_vLTFXm0q7nUQwAiQ_zPveAv4WKA@mail.gmail.com> (raw)
In-Reply-To: <CAJWNc-7Ptt44mo3rO4DpTKB0qPe7FyGxsNfn2fotYPdyqs=dTQ@mail.gmail.com>

On Mon, 10 Apr 2023 at 13:34, Kalamatee <kalamatee@gmail.com> wrote:
>
> Thanks, I'll check that out.

Actually, it looks like the problem might be much simpler:
fast_float.h fails to include <stdint.h>

Libstdc++ provides its own <stdint.h> header which should solve the
__STDC_LIMITS_MACROS issue with non-conforming C libraries.

I'll look into it ...

>
> On Mon, 10 Apr 2023, 13:15 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:
>>
>>
>>
>> On Mon, 10 Apr 2023, 12:34 Kalamatee via Gcc-help, <gcc-help@gcc.gnu.org> wrote:
>>>
>>> Hi,
>>>
>>> When im trying to build gcc12, I get the following error -:
>>>
>>> /bin/bash ../../libtool --tag CXX --tag disable-shared   --mode=compile
>>> /home/test/gcc12/./gcc/xgcc -shared-libgcc -B/home/test/gcc12/./gcc
>>> -nostdinc++ -L/home/test/gcc12/x86_64-aros/libstdc++-v3/src
>>> -L/home/test/gcc12/x86_64-aros/libstdc++-v3/src/.libs
>>> -L/home/test/gcc12/x86_64-aros/libstdc++-v3/libsupc++/.libs
>>> -B/home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/bin/
>>> -B/home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/lib/
>>> -isystem
>>> /home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/include
>>> -isystem
>>> /home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/sys-include
>>>    -I/home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/../libgcc
>>> -I/home/test/gcc12/x86_64-aros/libstdc++-v3/include/x86_64-aros
>>> -I/home/test/gcc12/x86_64-aros/libstdc++-v3/include
>>> -I/home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17
>>> -nostdinc++   -fno-implicit-templates  -Wall -Wextra -Wwrite-strings
>>> -Wcast-qual -Wabi=2  -fdiagnostics-show-location=once   -ffunction-sections
>>> -fdata-sections  -frandom-seed=floating_from_chars.lo  -fimplicit-templates
>>> -g -O2  -c -o floating_from_chars.lo
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
>>> libtool: compile:  /home/test/gcc12/./gcc/xgcc -shared-libgcc
>>> -B/home/test/gcc12/./gcc -nostdinc++
>>> -L/home/test/gcc12/x86_64-aros/libstdc++-v3/src
>>> -L/home/test/gcc12/x86_64-aros/libstdc++-v3/src/.libs
>>> -L/home/test/gcc12/x86_64-aros/libstdc++-v3/libsupc++/.libs
>>> -B/home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/bin/
>>> -B/home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/lib/
>>> -isystem
>>> /home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/include
>>> -isystem
>>> /home/kalam/builds/pc-x86_64-gcc12-clean/bin/linux-x86_64/tools/crosstools/x86_64-aros/sys-include
>>> -I/home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/../libgcc
>>> -I/home/test/gcc12/x86_64-aros/libstdc++-v3/include/x86_64-aros
>>> -I/home/test/gcc12/x86_64-aros/libstdc++-v3/include
>>> -I/home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17
>>> -nostdinc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings
>>> -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections
>>> -fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates
>>> -g -O2 -c
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
>>> -o floating_from_chars.o
>>> In file included from
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc:77:
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/fast_float/fast_float.h:
>>> In function 'void
>>> {anonymous}::fast_float::round_nearest_tie_even(adjusted_mantissa&,
>>> int32_t, callback)':
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/fast_float/fast_float.h:2500:12:
>>> error: 'UINT64_MAX' was not declared in this scope
>>>  2500 |     mask = UINT64_MAX;
>>>       |            ^~~~~~~~~~
>>> /home/test/gcc12/src/gcc-12.2.0/libstdc++-v3/src/c++17/fast_float/fast_float.h:1:1:
>>> note: 'UINT64_MAX' is defined in header '<cstdint>'; did you forget to
>>> '#include <cstdint>'?
>>>   +++ |+#include <cstdint>
>>>     1 | // fast_float by Daniel Lemire
>>> make[7]: *** [Makefile:585: floating_from_chars.lo] Error 1
>>>
>>> I can see from the preprocessor output, the necessary header is included -
>>> but is protected with
>>> #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
>>> #endif
>>>
>>> And since the compiler doesn't define __STDC_LIMIT_MACROS on the command
>>> line, or in the source file - it is resolved.
>>>
>>> I'm not sure though, where is the correct place to fix this?
>>
>>
>>
>> In the C library. The C++ standard is very clear that __STDC_LIMIT_MACROS has no meaning whatsoever in C++. The C library's <stdint.h> must define those macros unconditionally for C++. The C99 standard said the macros are required for C++, so some C libraries follow that rule, but they should follow the C++ standard for C++ code, since C99 only defines C and had no business trying to specify how C++ works.
>>
>> If you cannot fix the libc headers then you can #define __STDC_LIMIT_MACROS in your target's os_defines.h header in libstdc++ (I think that's the right workaround, but I'm not at my desk to check it ... Search for that macro in the libstdc++ source to see how other targets handle non-conforming libc headers.

  parent reply	other threads:[~2023-04-11  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 11:33 Kalamatee
2023-04-10 11:33 ` Kalamatee
2023-04-10 12:14 ` Jonathan Wakely
2023-04-10 12:34   ` Kalamatee
2023-04-10 14:15     ` AW: " Stefan Franke
2023-04-11  9:49     ` Jonathan Wakely [this message]
2023-04-12 20:44       ` Jonathan Wakely
2023-04-12 21:23         ` Kalamatee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdQc7Jud+LxwQX9s4E_vLTFXm0q7nUQwAiQ_zPveAv4WKA@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kalamatee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).