kvrocks icon indicating copy to clipboard operation
kvrocks copied to clipboard

use clang-16 && gcc-13 to build

Open infdahai opened this issue 1 year ago • 6 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

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?

  • [ ] I'm willing to submit a PR!

infdahai avatar May 18 '23 16:05 infdahai

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

torwig avatar May 18 '23 16:05 torwig

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.

infdahai avatar May 18 '23 17:05 infdahai

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).

PragmaTwice avatar Jun 16 '23 17:06 PragmaTwice

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?

infdahai avatar Jun 17 '23 07:06 infdahai

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 : )

PragmaTwice avatar Jun 18 '23 11:06 PragmaTwice

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

PokIsemaine avatar Aug 14 '24 02:08 PokIsemaine