Re: rapidjson?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: rapidjson?

Abdallah Elshamy

On Tue, Sep 29, 2020, 11:47 PM Dmitri A. Sergatskov <[hidden email]> wrote:
On Fedora 33 configure cannot find working PrettyWriter in RapidJSON (1.1.0):

configure:64508: checking for working PrettyWriter in RapidJSON
configure:64539: g++ -c -O3 -march=native -flto=4 -fno-fat-lto-objects -pthread -fopenmp  conftest.cpp >&5
In file included from conftest.cpp:494:
/usr/include/rapidjson/prettywriter.h: In constructor 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long unsigned int]':
/usr/include/rapidjson/prettywriter.h:53:102: error: 'const size_t rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >::kDefaultLevelDepth' is protected within this context
   53 |     explicit PrettyWriter(OutputStream& os, StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
      |                                                                                                      ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/rapidjson/prettywriter.h:18,
                 from conftest.cpp:494:
/usr/include/rapidjson/writer.h:262:25: note: declared protected here
  262 |     static const size_t kDefaultLevelDepth = 32;
      |                         ^~~~~~~~~~~~~~~~~~
conftest.cpp:511:75: note:   when instantiating default argument for call to 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long unsigned int]'
  511 |                               rapidjson::kWriteNanAndInfFlag> writer (json);
      |                                                                           ^
In file included from conftest.cpp:494:
/usr/include/rapidjson/prettywriter.h: In instantiation of 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long unsigned int]':
conftest.cpp:511:75:   required from here
/usr/include/rapidjson/prettywriter.h:54:110: error: type 'rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >' is not a direct base of 'rapidjson::PrettyWriter<rapidjson::GenericStringBuffer<rapidjson::UTF8<> >, rapidjson::UTF8<>, rapidjson::UTF8<>, rapidjson::CrtAllocator, 2>'
   54 |         Base(os, allocator, levelDepth), indentChar_(' '), indentCharCount_(4), formatOptions_(kFormatDefault) {}
      |                                                                                                              ^
configure:64539: $? = 1
configure: failed program was:

Bug, or I am doing something wrong?

Dmitri.
--

No not a bug. To be able to use the "PrettyWriter" option you must use the new version of RapidJSON from their repo on GitHub not the release.

Unfortunately, their last release was a few years ago so it looks like they won't be releasing the new version soon.

Cheers,
Abdallah


Reply | Threaded
Open this post in threaded view
|

Re: rapidjson?

mmuetzel
> Am 30. September 2020 um 00:07 Uhr schrieb "Dmitri A. Sergatskov":
> > On Tue, Sep 29, 2020 at 6:03 PM Abdallah Elshamy <[hidden email][mailto:[hidden email]]> wrote:
> > No not a bug. To be able to use the "PrettyWriter" option you must use the new version of RapidJSON from their repo on GitHub not the release.
> > 
> > Unfortunately, their last release was a few years ago so it looks like they won't be releasing the new version soon.
> >  
> > Cheers,
> > Abdallah
>  
> Ok. Thanks.
>  
> Dmitri.

If you don't want to wait, you could also apply these changes to the released headers to allow compilation with modern compilers:
https://hg.octave.org/mxe-octave/file/tip/src/rapidjson-1-prettywriter.patch

Markus