facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.28k stars 6.28k forks source link

Discussion: requiring minimum of C++20 #12412

Open pdillinger opened 6 months ago

pdillinger commented 6 months ago

C++20 has at least one feature we would really like to use: std::span for passing (or in some cases, returning) constant references to sequences of objects regardless of whether they are in a vector, array, or just a single object being treated as a sequence. This should ensure long-term efficiency for new APIs not to require a specific sequence representation while avoiding error-prone raw-pointer-and-length.

It looks like std::span is added in GCC 10.1 https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2020

For context, our GitHub Actions CI jobs currently use Ubuntu 20.04 with GCC 9.4. The latest LTS Ubuntu is 22.04 with GCC 11. (https://en.wikipedia.org/wiki/Ubuntu_version_history https://packages.ubuntu.com/search?keywords=gcc)

(Also see old conversation about C++17: #9388 )

@adamretter @jaykorean

adamretter commented 6 months ago

@pdillinger we need to consider Centos 6 which is probably the trickiest. We use that for building RocksJava binaries to ensure compatibility with a wide range of glibc.

At the cost of reduced backwards compatibility of our release binaries, an option could be to move to CentOS 7. However, for CentOS 7, I can only find packages for gcc that take us up to:

  1. GCC 8.3.1 - https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
  2. LLVM with Clang 5.0.1 (only available on x86_64) - https://www.softwarecollections.org/en/scls/rhscl/llvm-toolset-7/

Another possibility that I will investigate, is compiling GCC 10.1 from source code on Centos 6. I will let you know...

cvijdea-bd commented 6 months ago

There is devtoolset-11 (with GCC 11) for CentOS 7 on centos-release-scl

adamretter commented 6 months ago

@cvijdea-bd Huh! That's awesome thanks! I couldn't find any mention of anything newer than devtoolset-8. Thanks for the signpost.

@pdillinger That will give us GCC version: 11.2.1 20220127 (Red Hat 11.2.1-9)

adamretter commented 6 months ago

@pdillinger Have you also considered compatibility with msvc?

adamretter commented 6 months ago

@pdillinger Okay, let me know if and when this is going to happen please

pdillinger commented 6 months ago

Visual Studio 2019 appears to "just work" but gcc 9.x from Ubuntu 20 makes it difficult/ugly for us in CI at the moment. #12415

adamretter commented 6 months ago

@pdillinger Is the problem with your Docker image zjay437/rocksdb:0.6 which has Ubuntu 20.04.5 LTS? If so, I can prepare a Ubuntu 22.04 image for you here - https://github.com/evolvedbinary/docker-rocksjava

zergvszerg commented 6 months ago

In our cloud infrastruction a whole lot of servers are still running Centos 6.5 where the latest gcc is still devtoolset-9. I'm wondering if that will work.

adamretter commented 6 months ago

@pdillinger I have pushed the Docker image evolvedbinary/rocksjava:ubuntu22_x64-be to Docker Hub for you to try. It has Ubuntu 22, GCC 11, and JDK 8.

adamretter commented 5 months ago

@pdillinger Was the Docker image of use? Any further thoughts on this please?