From a79a422f31a1ce971107c2c119bb19790f2ea1d7 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 25 Oct 2024 13:01:58 +0900 Subject: [PATCH 1/6] build: riscv64: Add a fundamental architecture cmake file for riscv64 Signed-off-by: Hiroshi Hatake --- CMakeLists.txt | 5 +++++ cmake/riscv64.cmake | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 cmake/riscv64.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 08ecfb7ad94..0e6340bbfc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,6 +321,11 @@ if (FLB_SYSTEM_LINUX) include(cmake/s390x.cmake) endif () +# Build for Linux - riscv64 arch +if (FLB_SYSTEM_LINUX) + include(cmake/riscv64.cmake) +endif () + # Enable signed char support on Linux AARCH64 if specified if (FLB_LINUX_ON_AARCH64) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") diff --git a/cmake/riscv64.cmake b/cmake/riscv64.cmake new file mode 100644 index 00000000000..c4a8fb15751 --- /dev/null +++ b/cmake/riscv64.cmake @@ -0,0 +1,8 @@ +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv64)") + message(STATUS "Forcing characters to be signed, as on x86_64.") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") + if(FLB_LUAJIT) + message(WARNING "LuaJIT is disabled, this platform does not support built-in LuaJIT and system provided one neither.") + set(FLB_LUAJIT OFF) + endif() +endif () From 3ada895aa3836234f4d5715456100d48faebf583 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 25 Oct 2024 13:51:04 +0900 Subject: [PATCH 2/6] build: Add riscv64 architecture target for internal tests Signed-off-by: Hiroshi Hatake --- .github/workflows/unit-tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 3d4a7564ce8..1e28a498221 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -179,6 +179,7 @@ jobs: matrix: arch: - s390x + - riscv64 steps: - name: Checkout Fluent Bit code uses: actions/checkout@v4 From cde44faef6175b91d1ca317053fa646bf1a98c58 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 25 Oct 2024 15:09:33 +0900 Subject: [PATCH 3/6] build: Restrict to use gcc only This is because this workflow is not injected and used clang packages Signed-off-by: Hiroshi Hatake --- .github/workflows/unit-tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 1e28a498221..40ae79475a9 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -196,12 +196,12 @@ jobs: --volume "/etc/machine-id:/etc/machine-id" install: | apt-get update - apt-get install -y gcc-7 g++-7 clang-6.0 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common#libsystemd-dev - ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true + apt-get install -y gcc-7 g++-7 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev + # ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 - update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90 + # update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90 run: | cd build export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) )) From 6dab699ce2b7d44c1e57a9f46f43ff233ef3b1d1 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 25 Oct 2024 15:13:43 +0900 Subject: [PATCH 4/6] build: Use gcc-9 and g++-9 on qemu workflow Signed-off-by: Hiroshi Hatake --- .github/workflows/unit-tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 40ae79475a9..b8dcf73ec63 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -196,11 +196,11 @@ jobs: --volume "/etc/machine-id:/etc/machine-id" install: | apt-get update - apt-get install -y gcc-7 g++-7 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev + apt-get install -y gcc-9 g++-9 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev # ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90 - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 # update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90 run: | cd build From 5a5ac76bd119fa1ece63d2ae5ef84e02e5509b80 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 25 Oct 2024 16:33:31 +0900 Subject: [PATCH 5/6] build: Use ubuntu-22.04 distro due to try to use gcc-12 for atomic operations on riscv64 Signed-off-by: Hiroshi Hatake --- .github/workflows/unit-tests.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index b8dcf73ec63..a041c30d228 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -189,18 +189,18 @@ jobs: id: build-and-test-on-qemu with: arch: ${{ matrix.arch }} - distro: ubuntu20.04 + distro: ubuntu22.04 shell: /bin/bash dockerRunArgs: | --volume "/var/lib/dbus/machine-id:/var/lib/dbus/machine-id" --volume "/etc/machine-id:/etc/machine-id" install: | apt-get update - apt-get install -y gcc-9 g++-9 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev + apt-get install -y gcc-12 g++-12 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev # ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 90 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 90 # update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90 run: | cd build From 7f220114b629ae4052c7360870ba2e311fa4b260 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Wed, 11 Dec 2024 13:07:31 +0900 Subject: [PATCH 6/6] build: riscv64: Remove commented out lines Signed-off-by: Hiroshi Hatake --- .github/workflows/unit-tests.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index a041c30d228..24d93fc61ba 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -196,12 +196,10 @@ jobs: --volume "/etc/machine-id:/etc/machine-id" install: | apt-get update - apt-get install -y gcc-12 g++-12 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common #clang-6.0 libsystemd-dev - # ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true + apt-get install -y gcc-12 g++-12 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 90 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 90 - # update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90 run: | cd build export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) ))