Closed baallan closed 5 months ago
Any hints on how to use current jsoncons with ancient g++ versions much appreciated.
Off hand, it looks like an allocator isn't being propagated to a std::basic_string
, not sure why, need to investigate. Old (4.8) versions of g++ didn't support stateful allocators in strings, and we have some work around code for that, but your compiler certainly should.
Could you try compiling with -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0
Regarding ancient g++ versions, how ancient? We used to support 4.8, but we lost our test environments for that, and at the moment it would take some work to get back 4.8 compatibility.
re ancient versions: rhel-8 and newer, so g++ 8.5. rhel 7 is eol in a month, so no 4.8 is longer of interest (or reasonable).
Same error with
cmake .. -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -DJSONCONS_BUILD_TESTS=On -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON && cmake --build . -- VERBOSE=1 && ctest --output-on-failure
Possibly related to #488
Possibly related to #488
Yes, I misdiagnosed #488, @barracuda156 was using _GLIBCXX_USE_CXX11_ABI=0 and COW strings, and I thought it was related to that.
We've been relying on github-hosted compilers for linux/g++ tests. We introduced tests with std::scoped_allocator_adaptor
wrapping a sample stateful allocator around the time github dropped g++ 9. I've just confirmed that those tests pass with all versions of g++ later than 10 (10, 11,12, 13) but fail to compile with earlier versions. I'm not sure why, I haven't been able to find an obviously related g++ defect report.
So you wouldn't be able to use regular stateful allocators (which we require to be wrapped in an std::scoped_allocator_adaptor
) with g++ versions prior to 10. You should be able to use stateful pmr allocators with C++17. (I believe the vast majority of our users use the default (stateless) allocator.)
We'll fix the tests so you can compile them with the older compilers, and add some compilers to our coverage as well.
Could you try the cmake build with the code on master?
master now happily yields from:
cd build
cmake .. -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -DJSONCONS_BUILD_TESTS=On -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON && cmake --build . -j -- VERBOSE=1 && ctest --output-on-failure
-- The CXX compiler identification is GNU 8.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- jsoncons v0.175.0
-- Forcing tests build type to Release
-- Version 8.5.0
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
JSONCONS_HAS_STATEFUL_ALLOCATOR
...
[100%] Built target unit_tests
gmake[1]: Leaving directory '/app-data-collection/jsoncons/build'
/usr/bin/cmake -E cmake_progress_start /tlt/app-data-collection/jsoncons/build/CMakeFiles 0
Test project /tlt/app-data-collection/jsoncons/build
Start 1: unit_tests
1/1 Test #1: unit_tests ....................... Passed 5.09 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 5.16 sec
Good. Incidentally, you don't need to supply -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0
. Tests for stateful allocators are configured to be #define
'd out if the compiler is g++ and the version is less than 10.
@danielaparker _GLIBCXX_USE_CXX11_ABI=0
is added by MacPorts base for systems using libstdc++
, because if it is not done, different ABI will be used for ports which are built with the OS compiler (Xcode gcc) and newer gccs (which must be used when C++11 or later are required), and linking gonna fail in many instances.
The documented cmake build fails on rhel8 as does attempted cmake permutation: cmake .. -DJSONCONS_BUILD_TESTS=On -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON && cmake --build . -- VERBOSE=1 && ctest --output-on-failure
What compiler, architecture, and operating system?
What jsoncons library version?