From c7066f877c432e9f1161edf91a14d1cfceadcc17 Mon Sep 17 00:00:00 2001 From: Kale-Ko Date: Mon, 10 Jun 2024 15:10:43 -0400 Subject: [PATCH] Build x86_64 on CentOS --- .github/workflows/maven.yml | 46 +++++++++++++++++--------------- CMakeLists.txt | 6 ++--- docker/build/Dockerfile | 10 +++---- docker/centosbuild/Dockerfile | 36 +++++++++++++++++++++++++ docker/centosbuild/setup-repo.sh | 22 +++++++++++++++ docker/completebuild/Dockerfile | 10 +++---- docker/install-qemu.sh | 2 ++ docker/merge-builds.sh | 2 ++ docker/test/Dockerfile | 10 +++---- 9 files changed, 98 insertions(+), 46 deletions(-) create mode 100644 docker/centosbuild/Dockerfile create mode 100755 docker/centosbuild/setup-repo.sh diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 16f18f29..5c94a262 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,31 +26,31 @@ jobs: matrix: architecture: - name: x86_64 - ubuntu_version: 18.04 - gcc_package_name: "gcc g++" - gcc_exec_name: "x86_64-linux-gnu" + centos_version: "6-gcc7" + gcc_package_name: "gcc gcc-c++" + gcc_exec_name: "x86_64-redhat-linux-gnu" - name: x86 - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-i686-linux-gnu g++-i686-linux-gnu" gcc_exec_name: "i686-linux-gnu" - name: aarch64 - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-aarch64-linux-gnu g++-aarch64-linux-gnu" gcc_exec_name: "aarch64-linux-gnu" - name: armv7 - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf" gcc_exec_name: "arm-linux-gnueabihf" - name: ppc64le - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu" gcc_exec_name: "powerpc64le-linux-gnu" - name: riscv64 - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-riscv64-linux-gnu g++-riscv64-linux-gnu" gcc_exec_name: "riscv64-linux-gnu" - name: s390x - ubuntu_version: 18.04 + ubuntu_version: "18.04" gcc_package_name: "gcc-s390x-linux-gnu g++-s390x-linux-gnu" gcc_exec_name: "s390x-linux-gnu" java_version: [ 8, 11, 17, 21 ] @@ -69,32 +69,40 @@ jobs: - name: Setup JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' + distribution: 'corretto' java-version: ${{ matrix.java_version }} architecture: 'x64' check-latest: true - - name: Setup Build + - name: Setup Ubuntu Build + if: ${{ matrix.architecture.ubuntu_version }} run: | docker build \ --platform linux/amd64 \ --build-arg "DOCKER_IMAGE=amd64/ubuntu:${{ matrix.architecture.ubuntu_version }}" \ - --build-arg "JAVA_VERSION=${{ matrix.java_version }}" \ --build-arg "TARGET_GCC_PACKAGE=${{ matrix.architecture.gcc_package_name }}" \ --build-arg "TARGET_GCC_EXEC=${{ matrix.architecture.gcc_exec_name }}" \ --tag linux-buildimage:${{ matrix.architecture.name }} \ docker/build/ - - name: Build + - name: Setup CentOS Build + if: ${{ matrix.architecture.centos_version }} run: | - export MAVEN_HOME=$(dirname $(dirname $(which mvn))) + docker build \ + --platform linux/amd64 \ + --build-arg "DOCKER_IMAGE=gatlingcorp/centos:${{ matrix.architecture.centos_version }}" \ + --build-arg "TARGET_GCC_PACKAGE=${{ matrix.architecture.gcc_package_name }}" \ + --build-arg "TARGET_GCC_EXEC=${{ matrix.architecture.gcc_exec_name }}" \ + --tag linux-buildimage:${{ matrix.architecture.name }} \ + docker/centosbuild/ + - name: Build + run: | chmod +x ./mvnw ./mvnw.cmd docker run \ --platform linux/amd64 \ --volume "$PWD:/data" \ --volume "$JAVA_HOME:/opt/java" \ - --volume "$MAVEN_HOME:/opt/maven" \ linux-buildimage:${{ matrix.architecture.name }} \ ./mvnw -B -V -ntp -P "linux-${{ matrix.architecture.name }}" "-Dmaven.test.skip=true" clean package @@ -245,14 +253,11 @@ jobs: - name: Build run: | - export MAVEN_HOME=$(dirname $(dirname $(which mvn))) - chmod +x ./mvnw ./mvnw.cmd docker run \ --platform linux/amd64 \ --volume "$PWD:/data" \ --volume "$JAVA_HOME:/opt/java" \ - --volume "$MAVEN_HOME:/opt/maven" \ linux-buildimage:complete \ ./mvnw -B -V -ntp -P "release" "-Dmaven.test.skip=true" package @@ -285,7 +290,7 @@ jobs: java_distro: 'temurin' java_name: aarch64 docker_name: linux/aarch64 - ubuntu_version: [ 16.04, 18.04, 20.04, 22.04, 24.04 ] + ubuntu_version: [ "16.04", "18.04", "20.04", "22.04", "24.04" ] java_version: [ 8, 11, 17, 21 ] needs: [ Linux-Build ] @@ -328,14 +333,11 @@ jobs: - name: Test run: | - export MAVEN_HOME=$(dirname $(dirname $(which mvn))) - chmod +x ./mvnw ./mvnw.cmd docker run \ --platform ${{ matrix.architecture.docker_name }} \ --volume "$PWD:/data" \ --volume "$JAVA_HOME:/opt/java" \ - --volume "$MAVEN_HOME:/opt/maven" \ linux-testimage:${{ matrix.architecture.name }} \ ./mvnw -B -V -ntp -P "release" test diff --git a/CMakeLists.txt b/CMakeLists.txt index 48cdb0cd..d9b25647 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) SET (CMAKE_BUILD_TYPE Release) endif() message(STATUS "Build type is '${CMAKE_BUILD_TYPE}'") -SET (CMAKE_C_FLAGS "-flto") -SET (CMAKE_CXX_FLAGS "-Wall -flto") +SET (CMAKE_C_FLAGS "") +SET (CMAKE_CXX_FLAGS "-Wall") SET (CMAKE_CXX_STANDARD 11) SET (CMAKE_CXX_STANDARD_REQUIRED ON) @@ -73,4 +73,4 @@ add_library (brotli ${LIB_TYPE} "natives/src/main/cpp/encoder_jni.cc" ) -SET_TARGET_PROPERTIES (brotli PROPERTIES LINKER_LANGUAGE CXX) +SET_TARGET_PROPERTIES (brotli PROPERTIES LINKER_LANGUAGE CXX) \ No newline at end of file diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile index 74a06050..7405f557 100644 --- a/docker/build/Dockerfile +++ b/docker/build/Dockerfile @@ -14,13 +14,9 @@ RUN apt-get update -y && \ RUN update-alternatives --install /usr/bin/cc cc /usr/bin/${TARGET_GCC_EXEC}-gcc 999 && \ update-alternatives --install /usr/bin/c++ c++ /usr/bin/${TARGET_GCC_EXEC}-g++ 999 -VOLUME "/opt/java" -ENV JAVA_HOME="/opt/java" -ENV PATH="$JAVA_HOME:$PATH" - -VOLUME "/opt/maven" -ENV MAVEN_HOME="/opt/maven" -ENV PATH="$MAVEN_HOME:$PATH" +VOLUME "/opt/java/" +ENV JAVA_HOME "/opt/java/" +ENV PATH "$PATH:$JAVA_HOME/bin/" VOLUME "/data" WORKDIR "/data" diff --git a/docker/centosbuild/Dockerfile b/docker/centosbuild/Dockerfile new file mode 100644 index 00000000..7cdd8db2 --- /dev/null +++ b/docker/centosbuild/Dockerfile @@ -0,0 +1,36 @@ +ARG DOCKER_IMAGE +FROM ${DOCKER_IMAGE} +USER root + +ARG TARGET_GCC_PACKAGE +ARG TARGET_GCC_EXEC + +ARG CMAKE_VERSION="3.20.5" + +COPY setup-repo.sh /setup-repo.sh +RUN /setup-repo.sh + +RUN yum update -y && \ + yum install -y \ + "make" ${TARGET_GCC_PACKAGE} \ + "glibc" "libstdc++" + +RUN update-alternatives --install /usr/bin/cc cc /usr/bin/${TARGET_GCC_EXEC}-gcc 999 && \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/${TARGET_GCC_EXEC}-g++ 999 + +VOLUME "/opt/java/" +ENV JAVA_HOME "/opt/java/" +ENV PATH "$PATH:$JAVA_HOME/bin/" + +RUN curl -L "https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" -o maven.tar.gz && \ + mkdir /opt/maven && \ + tar -xzf maven.tar.gz -C /opt/maven --strip-components 1 && \ + rm maven.tar.gz + +ENV PATH "$PATH:/opt/cmake/bin/" + +VOLUME "/data/" +WORKDIR "/data/" + +ENTRYPOINT [ ] +CMD [ "/bin/bash" ] \ No newline at end of file diff --git a/docker/centosbuild/setup-repo.sh b/docker/centosbuild/setup-repo.sh new file mode 100755 index 00000000..5361fc01 --- /dev/null +++ b/docker/centosbuild/setup-repo.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +(cat <