[llvm-dev] Can we start using std::to_string?

Diana Picus via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 7 21:17:00 PST 2017


On 6 November 2017 at 18:51, Pavel Labath <labath at google.com> wrote:
> Hello all,
>
> it took a a bit longer than I hoped, but I am nonetheless pleased to
> report that our dependency on the version of libstdc++ with broken
> std::to_string has been removed. The android bot now builds lldb with
> clang and libc++.

Awesome, thanks Pavel!

> I'm not sure if there are any other obstacles preventing us from using
> std::to_string, but we are not one of them.

I think we still depend on gcc 4.8.x, as Hal mentioned earlier. It's
great to have one less obstacle though.

As a side-note, gcc 4.8.x also has trouble with some C++11
const_iterators (see r317049), so it would be really nice if we could
move on to newer gcc versions...

> regards,
> pavel
>
> On 17 May 2017 at 18:34, Tamas Berghammer <tberghammer at google.com> wrote:
>> The Android NDK currently ships with gcc 4.9.2 what should support
>> std::to_string but there are some issues regarding the implementation of it.
>> The root cause is that complex.h is missing some function from the Android
>> libc (bionic) what results in _GLIBCXX_USE_C99 not being defined what will
>> disable access to a set of string conversion functions (including
>> std::to_string).
>>
>> 2 relevant bug for the Android NDK:
>> https://github.com/android-ndk/ndk/issues/82
>> https://issuetracker.google.com/issues/37015480
>>
>> Tamas
>>
>> On Wed, May 17, 2017 at 2:52 PM 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:
>>>
>>> Maybe it's time to update the Requirements section on Getting Started with
>>> the LLVM System [1]?
>>>
>>> [1]
>>> http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
>>>
>>> 2017-05-17 21:44 GMT+08:00 Hal Finkel via llvm-dev
>>> <llvm-dev at lists.llvm.org>:
>>>>
>>>> I'm fairly sure the problem is that we still support building with gcc
>>>> 4.8.x, and that version of gcc did not have std::to_string. It is not just
>>>> an NDK issue.
>>>>
>>>>  -Hal
>>>>
>>>>
>>>> On 05/17/2017 06:05 AM, Pavel Labath via llvm-dev wrote:
>>>>>
>>>>> Hi Diana,
>>>>>
>>>>> I am responsible for that bot, and probably a great number of those
>>>>> fixups.
>>>>>
>>>>> The root of the problem is that android NDK comes with a libstdc++
>>>>> which does not have std::to_string. I forgot the exact reason but Dan
>>>>> or Tamas (cc'ed) should know it. The NDK also comes with libc++, which
>>>>> does have working std::to_string, but this one is not compatible with
>>>>> older android devices. This part is being actively worked on though. I
>>>>> am going to sync up with Dan to see if I can give you any timeline on
>>>>> that.
>>>>>
>>>>> And yes, the bot does not build the AVR and other backends, that's why
>>>>> we get no std::string errors there.
>>>>>
>>>>>
>>>>>
>>>>> On 17 May 2017 at 11:12, Diana Picus via llvm-dev
>>>>> <llvm-dev at lists.llvm.org> wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I tried to use std::to_string somewhere and one of the bots yelled at
>>>>>> me [1] because it couldn't find it.
>>>>>>
>>>>>> Searching through the mailing lists reveals a long stream of fixup
>>>>>> patches trying to avoid std::to_string, but there are uses of it in
>>>>>> tree in the AVR and Hexagon backends, libFuzzer and the Gold plugin. I
>>>>>> can only imagine they got away with it because the particular bots
>>>>>> that can't find std::to_string are probably not building them.
>>>>>>
>>>>>> Should we fix the bots and remove llvm::to_string? Or is it still too
>>>>>> soon?
>>>>>> Alternatively, should we replace all uses of std::to_string with
>>>>>> llvm::to_string?
>>>>>>
>>>>>> Cheers,
>>>>>> Diana
>>>>>>
>>>>>> [1]
>>>>>> http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/8853/steps/build%20android/logs/stdio
>>>>>> _______________________________________________
>>>>>> LLVM Developers mailing list
>>>>>> llvm-dev at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>>
>>>>> _______________________________________________
>>>>> LLVM Developers mailing list
>>>>> llvm-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>
>>>>
>>>> --
>>>> Hal Finkel
>>>> Lead, Compiler Technology and Programming Languages
>>>> Leadership Computing Facility
>>>> Argonne National Laboratory
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> llvm-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>>
>>>
>>>
>>> --
>>> Wei-Ren Chen (陳韋任)
>>> Homepage: https://people.cs.nctu.edu.tw/~chenwj


More information about the llvm-dev mailing list