Re: Problem porting gcc 12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 10 Apr 2023 at 13:34, Kalamatee <kalamatee@xxxxxxxxx> 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@xxxxxxxxx> wrote:
>>
>>
>>
>> On Mon, 10 Apr 2023, 12:34 Kalamatee via Gcc-help, <gcc-help@xxxxxxxxxxx> 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.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux