apache / kvrocks

Apache Kvrocks is a distributed key value NoSQL database that uses RocksDB as storage engine and is compatible with Redis protocol.
https://kvrocks.apache.org/
Apache License 2.0
3.53k stars 464 forks source link

use clang-16 && gcc-13 to build #1447

Open infdahai opened 1 year ago

infdahai commented 1 year ago

Search before asking

Motivation

This issue has a request to use clang-16 and gcc-13 to build docker images or cmakelists.txt in local developing environment and use clang-tidy-16 and clang-format-16 to correct code formattings.

Solution

No response

Are you willing to submit a PR?

torwig commented 1 year ago

@infdahai Does the Ubuntu 20.04 have clang-16 in its repository?

infdahai commented 1 year ago

No. clang-10 is the default version in ubuntu 20.04.

I see the kvrocks.yaml file uses ubuntu-22.04 and this distro supports clang-15. So I just ask this.

PragmaTwice commented 1 year ago

I have been using GCC 13 to build kvrocks for a long time and haven't encountered any issues so far.

Getting GCC 13 or Clang 16 in CI may require manual download and installation, but I don't object to adding new compiler builds in CI (currently, the default versions of GCC and Clang in both ubuntu 20 LTS and ubuntu 22 LTS are used in CI, refer to https://github.com/actions/runner-images).

infdahai commented 1 year ago

for clang-16, we can refer to

https://github.com/MikePopoloski/slang/blob/385e8e3a666551416fe76fcd9f0d6f0ba845b9bc/.github/workflows/build.yml#L40-L46

or execute the shell script.

          wget https://apt.llvm.org/llvm.sh
          chmod +x llvm.sh
          sudo ./llvm.sh 16
          sudo apt-get install -y clang-tidy-16

But I havn't found a vaild example for gcc-13. What do you think @PragmaTwice or just pend for this?

PragmaTwice commented 1 year ago

for clang-16, we can refer to

https://github.com/MikePopoloski/slang/blob/385e8e3a666551416fe76fcd9f0d6f0ba845b9bc/.github/workflows/build.yml#L40-L46

or execute the shell script.

          wget https://apt.llvm.org/llvm.sh
          chmod +x llvm.sh
          sudo ./llvm.sh 16
          sudo apt-get install -y clang-tidy-16

But I havn't found a vaild example for gcc-13. What do you think @PragmaTwice or just pend for this?

For gcc-13 we can add a PPA for ubuntu, refer to https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/ppa .

BTW I am not a ubuntu user : )

PokIsemaine commented 2 months ago

I was suggested to add a blank line at the end of the code when I submitted a PR, but now there are no rules for clang-format. I learned that the rule InsertNewlineAtEOF is supported in clang-format 16. Is it possible to update the clang-format version and add this rule?

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertnewlineateof