mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +00:00 
			
		
		
		
	@@ -124,11 +124,7 @@ CheckOptions:
 | 
			
		||||
  readability-braces-around-statements.ShortStatementLines: 2
 | 
			
		||||
  bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
 | 
			
		||||
  bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc;::std::expected
 | 
			
		||||
  misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*'
 | 
			
		||||
  misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*;.*(expected|unexpected).*'
 | 
			
		||||
 | 
			
		||||
HeaderFilterRegex: '^.*/(src|unittests)/.*\.(h|hpp)$'
 | 
			
		||||
WarningsAsErrors: '*'
 | 
			
		||||
ExtraArgs: 
 | 
			
		||||
  - -D__cpp_concepts=202002
 | 
			
		||||
  - -Wno-builtin-macro-redefined
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								.github/actions/restore_cache/action.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/actions/restore_cache/action.yml
									
									
									
									
										vendored
									
									
								
							@@ -4,6 +4,9 @@ inputs:
 | 
			
		||||
  conan_dir:
 | 
			
		||||
    description: Path to .conan directory
 | 
			
		||||
    required: true
 | 
			
		||||
  conan_profile:
 | 
			
		||||
    description: Conan profile name
 | 
			
		||||
    required: true
 | 
			
		||||
  ccache_dir:
 | 
			
		||||
    description: Path to .ccache directory
 | 
			
		||||
    required: true
 | 
			
		||||
@@ -48,7 +51,7 @@ runs:
 | 
			
		||||
      id: conan_cache
 | 
			
		||||
      with:
 | 
			
		||||
        path: ${{ inputs.conan_dir }}/data
 | 
			
		||||
        key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-develop-${{ steps.conan_hash.outputs.hash }}
 | 
			
		||||
        key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ steps.conan_hash.outputs.hash }}
 | 
			
		||||
 | 
			
		||||
    - name: Restore ccache cache
 | 
			
		||||
      uses: actions/cache/restore@v4
 | 
			
		||||
@@ -56,4 +59,4 @@ runs:
 | 
			
		||||
      if: ${{ env.CCACHE_DISABLE != '1' }}
 | 
			
		||||
      with:
 | 
			
		||||
        path: ${{ inputs.ccache_dir }}
 | 
			
		||||
        key: clio-ccache-${{ runner.os }}-${{ inputs.build_type }}${{ inputs.code_coverage == 'true' && '-code_coverage' || '' }}-develop-${{ steps.git_common_ancestor.outputs.commit }}
 | 
			
		||||
        key: clio-ccache-${{ runner.os }}-${{ inputs.build_type }}${{ inputs.code_coverage == 'true' && '-code_coverage' || '' }}-${{ inputs.conan_profile }}-develop-${{ steps.git_common_ancestor.outputs.commit }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								.github/actions/save_cache/action.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/actions/save_cache/action.yml
									
									
									
									
										vendored
									
									
								
							@@ -4,6 +4,9 @@ inputs:
 | 
			
		||||
  conan_dir:
 | 
			
		||||
    description: Path to .conan directory
 | 
			
		||||
    required: true
 | 
			
		||||
  conan_profile:
 | 
			
		||||
    description: Conan profile name
 | 
			
		||||
    required: true
 | 
			
		||||
  conan_hash:
 | 
			
		||||
    description: Hash to use as a part of conan cache key
 | 
			
		||||
    required: true
 | 
			
		||||
@@ -44,13 +47,13 @@ runs:
 | 
			
		||||
      uses: actions/cache/save@v4
 | 
			
		||||
      with:
 | 
			
		||||
        path: ${{ inputs.conan_dir }}/data
 | 
			
		||||
        key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-develop-${{ inputs.conan_hash }}
 | 
			
		||||
        key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ inputs.conan_hash }}
 | 
			
		||||
 | 
			
		||||
    - name: Save ccache cache
 | 
			
		||||
      if: ${{ inputs.ccache_cache_hit != 'true' || inputs.ccache_cache_miss_rate == '100.0' }}
 | 
			
		||||
      uses: actions/cache/save@v4
 | 
			
		||||
      with:
 | 
			
		||||
        path: ${{ inputs.ccache_dir }}
 | 
			
		||||
        key: clio-ccache-${{ runner.os }}-${{ inputs.build_type }}${{ inputs.code_coverage == 'true' && '-code_coverage' || '' }}-develop-${{ steps.git_common_ancestor.outputs.commit }}
 | 
			
		||||
        key: clio-ccache-${{ runner.os }}-${{ inputs.build_type }}${{ inputs.code_coverage == 'true' && '-code_coverage' || '' }}-${{ inputs.conan_profile }}-develop-${{ steps.git_common_ancestor.outputs.commit }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								.github/actions/setup_conan/action.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/actions/setup_conan/action.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,9 @@
 | 
			
		||||
name: Setup conan
 | 
			
		||||
description: Setup conan profile and artifactory
 | 
			
		||||
inputs:
 | 
			
		||||
  conan_profile:
 | 
			
		||||
    description: Conan profile name
 | 
			
		||||
    required: true
 | 
			
		||||
outputs:
 | 
			
		||||
  conan_profile:
 | 
			
		||||
    description: Created conan profile name
 | 
			
		||||
@@ -11,7 +15,7 @@ runs:
 | 
			
		||||
      if: ${{ runner.os == 'macOS' }}
 | 
			
		||||
      shell: bash
 | 
			
		||||
      env:
 | 
			
		||||
        CONAN_PROFILE: clio_apple_clang_15
 | 
			
		||||
        CONAN_PROFILE: apple_clang_15
 | 
			
		||||
      id: conan_setup_mac
 | 
			
		||||
      run: |
 | 
			
		||||
        echo "Creating $CONAN_PROFILE conan profile";
 | 
			
		||||
@@ -27,7 +31,7 @@ runs:
 | 
			
		||||
      shell: bash
 | 
			
		||||
      id: conan_setup_linux
 | 
			
		||||
      run: |
 | 
			
		||||
        echo "created_conan_profile=default" >> $GITHUB_OUTPUT
 | 
			
		||||
        echo "created_conan_profile=${{ inputs.conan_profile }}" >> $GITHUB_OUTPUT
 | 
			
		||||
 | 
			
		||||
    - name: Export output variable
 | 
			
		||||
      shell: bash
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@@ -50,12 +50,26 @@ jobs:
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            build_type: Release
 | 
			
		||||
            conan_profile: gcc
 | 
			
		||||
            code_coverage: false
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            build_type: Debug
 | 
			
		||||
            conan_profile: gcc
 | 
			
		||||
            code_coverage: true
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            build_type: Release
 | 
			
		||||
            conan_profile: clang
 | 
			
		||||
            code_coverage: false
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            build_type: Debug
 | 
			
		||||
            conan_profile: clang
 | 
			
		||||
            code_coverage: false
 | 
			
		||||
          - os: macos14
 | 
			
		||||
            build_type: Release
 | 
			
		||||
            code_coverage: false
 | 
			
		||||
@@ -88,12 +102,15 @@ jobs:
 | 
			
		||||
      - name: Setup conan
 | 
			
		||||
        uses: ./.github/actions/setup_conan
 | 
			
		||||
        id: conan
 | 
			
		||||
        with:
 | 
			
		||||
          conan_profile: ${{ matrix.conan_profile }}
 | 
			
		||||
 | 
			
		||||
      - name: Restore cache
 | 
			
		||||
        uses: ./.github/actions/restore_cache
 | 
			
		||||
        id: restore_cache
 | 
			
		||||
        with:
 | 
			
		||||
          conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
 | 
			
		||||
          conan_profile: ${{ steps.conan.outputs.conan_profile }}
 | 
			
		||||
          ccache_dir: ${{ env.CCACHE_DIR }}
 | 
			
		||||
          build_type: ${{ matrix.build_type }}
 | 
			
		||||
          code_coverage: ${{ matrix.code_coverage }}
 | 
			
		||||
@@ -125,14 +142,14 @@ jobs:
 | 
			
		||||
      - name: Upload clio_server
 | 
			
		||||
        uses: actions/upload-artifact@v4
 | 
			
		||||
        with:
 | 
			
		||||
          name: clio_server_${{ runner.os }}_${{ matrix.build_type }}
 | 
			
		||||
          name: clio_server_${{ runner.os }}_${{ matrix.build_type }}_${{ steps.conan.outputs.conan_profile }}
 | 
			
		||||
          path: build/clio_server
 | 
			
		||||
 | 
			
		||||
      - name: Upload clio_tests
 | 
			
		||||
        if: ${{ !matrix.code_coverage }}
 | 
			
		||||
        uses: actions/upload-artifact@v4
 | 
			
		||||
        with:
 | 
			
		||||
          name: clio_tests_${{ runner.os }}
 | 
			
		||||
          name: clio_tests_${{ runner.os }}_${{ matrix.build_type }}_${{ steps.conan.outputs.conan_profile }}
 | 
			
		||||
          path: build/clio_tests
 | 
			
		||||
 | 
			
		||||
      - name: Save cache
 | 
			
		||||
@@ -146,6 +163,7 @@ jobs:
 | 
			
		||||
          ccache_cache_miss_rate: ${{ steps.ccache_stats.outputs.miss_rate }}
 | 
			
		||||
          build_type: ${{ matrix.build_type }}
 | 
			
		||||
          code_coverage: ${{ matrix.code_coverage }}
 | 
			
		||||
          conan_profile: ${{ steps.conan.outputs.conan_profile }}
 | 
			
		||||
 | 
			
		||||
      # TODO: This is not a part of build process but it is the easiest way to do it here.
 | 
			
		||||
      # It will be refactored in https://github.com/XRPLF/clio/issues/1075
 | 
			
		||||
@@ -170,7 +188,21 @@ jobs:
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            conan_profile: gcc
 | 
			
		||||
            build_type: Release
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            conan_profile: clang
 | 
			
		||||
            build_type: Release
 | 
			
		||||
          - os: heavy
 | 
			
		||||
            container:
 | 
			
		||||
              image: rippleci/clio_ci:latest
 | 
			
		||||
            conan_profile: clang
 | 
			
		||||
            build_type: Debug
 | 
			
		||||
          - os: macos14
 | 
			
		||||
            conan_profile: apple_clang_15
 | 
			
		||||
            build_type: Release
 | 
			
		||||
    runs-on: [self-hosted, "${{ matrix.os }}"]
 | 
			
		||||
    container: ${{ matrix.container }}
 | 
			
		||||
 | 
			
		||||
@@ -181,7 +213,7 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      - uses: actions/download-artifact@v4
 | 
			
		||||
        with:
 | 
			
		||||
          name: clio_tests_${{ runner.os }}
 | 
			
		||||
          name: clio_tests_${{ runner.os }}_${{ matrix.build_type }}_${{ matrix.conan_profile }}
 | 
			
		||||
      - name: Run clio_tests
 | 
			
		||||
        run: |
 | 
			
		||||
          chmod +x ./clio_tests
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								.github/workflows/clang-tidy.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/clang-tidy.yml
									
									
									
									
										vendored
									
									
								
							@@ -33,6 +33,8 @@ jobs:
 | 
			
		||||
      - name: Setup conan
 | 
			
		||||
        uses: ./.github/actions/setup_conan
 | 
			
		||||
        id: conan
 | 
			
		||||
        with:
 | 
			
		||||
          conan_profile: clang
 | 
			
		||||
 | 
			
		||||
      - name: Restore cache
 | 
			
		||||
        uses: ./.github/actions/restore_cache
 | 
			
		||||
@@ -40,6 +42,7 @@ jobs:
 | 
			
		||||
        with:
 | 
			
		||||
          conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
 | 
			
		||||
          ccache_dir: ${{ env.CCACHE_DIR }}
 | 
			
		||||
          conan_profile: ${{ steps.conan.outputs.conan_profile }}
 | 
			
		||||
 | 
			
		||||
      - name: Run conan and cmake
 | 
			
		||||
        uses: ./.github/actions/generate
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/nightly.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/nightly.yml
									
									
									
									
										vendored
									
									
								
							@@ -41,6 +41,8 @@ jobs:
 | 
			
		||||
      - name: Setup conan
 | 
			
		||||
        uses: ./.github/actions/setup_conan
 | 
			
		||||
        id: conan
 | 
			
		||||
        with:
 | 
			
		||||
          conan_profile: gcc
 | 
			
		||||
 | 
			
		||||
      - name: Run conan and cmake
 | 
			
		||||
        uses: ./.github/actions/generate
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,20 @@
 | 
			
		||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
 | 
			
		||||
    message(FATAL_ERROR "Clang 14+ required for building clio")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
 | 
			
		||||
    message(FATAL_ERROR "Clang 16+ required for building clio")
 | 
			
		||||
  endif ()
 | 
			
		||||
  set(is_clang TRUE)
 | 
			
		||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
 | 
			
		||||
    message(FATAL_ERROR "AppleClang 14+ required for building clio")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
 | 
			
		||||
    message(FATAL_ERROR "AppleClang 15+ required for building clio")
 | 
			
		||||
  endif ()
 | 
			
		||||
  set(is_appleclang TRUE)
 | 
			
		||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
 | 
			
		||||
    message(FATAL_ERROR "GCC 11+ required for building clio")
 | 
			
		||||
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12)
 | 
			
		||||
    message(FATAL_ERROR "GCC 12+ required for building clio")
 | 
			
		||||
  endif ()
 | 
			
		||||
  set(is_gcc TRUE)
 | 
			
		||||
else ()
 | 
			
		||||
  message(FATAL_ERROR "Supported compilers: AppleClang 14+, Clang 14+, GCC 11+")
 | 
			
		||||
  message(FATAL_ERROR "Supported compilers: AppleClang 15+, Clang 16+, GCC 12+")
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
if (san)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
FROM rippleci/clio_gcc:12.3.0
 | 
			
		||||
FROM rippleci/clio_clang:16
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
ARG TARGETARCH
 | 
			
		||||
 | 
			
		||||
@@ -25,6 +25,23 @@ RUN apt update -qq \
 | 
			
		||||
    && pip3 install -q --upgrade --no-cache-dir pip && pip3 install -q --no-cache-dir conan==1.62 gcovr cmake cmake-format \
 | 
			
		||||
    && apt-get clean && apt remove -y software-properties-common
 | 
			
		||||
 | 
			
		||||
# Install gcc-12 and make ldconfig aware of the new libstdc++ location (for gcc)
 | 
			
		||||
# Note: Clang is using libc++ instead
 | 
			
		||||
COPY --from=rippleci/clio_gcc:12.3.0 /gcc12.deb /
 | 
			
		||||
RUN apt update && apt-get install -y binutils libc6-dev \
 | 
			
		||||
    && dpkg -i /gcc12.deb \
 | 
			
		||||
    && rm -rf /gcc12.deb \
 | 
			
		||||
    && ldconfig
 | 
			
		||||
 | 
			
		||||
# Rewire to use gcc-12 as default compiler
 | 
			
		||||
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100
 | 
			
		||||
 | 
			
		||||
WORKDIR /tmp
 | 
			
		||||
 | 
			
		||||
# Install ccache from source
 | 
			
		||||
@@ -51,10 +68,6 @@ RUN wget https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VER
 | 
			
		||||
    && mv gh_${GH_VERSION}_linux_${TARGETARCH}/bin/gh /usr/bin/gh \
 | 
			
		||||
    && rm -rf /tmp/* /var/tmp/*
 | 
			
		||||
 | 
			
		||||
# Libstdc++ from gcc-12 got lost, probably via apt update. Let's recover it
 | 
			
		||||
RUN update-alternatives --install /usr/bin/ccache ccache /usr/local/bin/ccache 100 \
 | 
			
		||||
    && update-alternatives --auto libstdc++.so.6
 | 
			
		||||
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
# Using root by default is not very secure but github checkout action doesn't work with any other user
 | 
			
		||||
# https://github.com/actions/checkout/issues/956
 | 
			
		||||
@@ -62,13 +75,26 @@ WORKDIR /root
 | 
			
		||||
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
 | 
			
		||||
 | 
			
		||||
# Setup conan
 | 
			
		||||
RUN conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
 | 
			
		||||
 | 
			
		||||
# Note: intentionally leaving cppstd=20
 | 
			
		||||
RUN conan profile new default --detect \
 | 
			
		||||
    && conan profile update settings.compiler=gcc default \
 | 
			
		||||
    && conan profile update settings.compiler.version=12 default \
 | 
			
		||||
    && conan profile update settings.compiler.cppstd=20 default \
 | 
			
		||||
    && conan profile update settings.compiler.libcxx=libstdc++11 default \
 | 
			
		||||
    && conan profile update env.CC=/opt/bin/gcc default \
 | 
			
		||||
    && conan profile update env.CXX=/opt/bin/g++ default \
 | 
			
		||||
    && conan profile update "conf.tools.build:compiler_executables={\"c\": \"/opt/bin/gcc\", \"cpp\": \"/opt/bin/g++\"}" default \
 | 
			
		||||
    && conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
 | 
			
		||||
RUN conan profile new gcc --detect \
 | 
			
		||||
    && conan profile update settings.compiler=gcc gcc \
 | 
			
		||||
    && conan profile update settings.compiler.version=12 gcc \
 | 
			
		||||
    && conan profile update settings.compiler.cppstd=20 gcc \
 | 
			
		||||
    && conan profile update settings.compiler.libcxx=libstdc++11 gcc \
 | 
			
		||||
    && conan profile update env.CC=/usr/bin/gcc-12 gcc \
 | 
			
		||||
    && conan profile update env.CXX=/usr/bin/g++-12 gcc \
 | 
			
		||||
    && conan profile update "conf.tools.build:compiler_executables={\"c\": \"/usr/bin/gcc-12\", \"cpp\": \"/usr/bin/g++-12\"}" gcc
 | 
			
		||||
 | 
			
		||||
RUN conan profile new clang --detect \
 | 
			
		||||
    && conan profile update settings.compiler=clang clang \
 | 
			
		||||
    && conan profile update settings.compiler.version=16 clang \
 | 
			
		||||
    && conan profile update settings.compiler.cppstd=20 clang \
 | 
			
		||||
    && conan profile update settings.compiler.libcxx=libc++ clang \
 | 
			
		||||
    && conan profile update env.CC=/usr/bin/clang-16 clang \
 | 
			
		||||
    && conan profile update env.CXX=/usr/bin/clang++-16 clang \
 | 
			
		||||
    && conan profile update env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS" clang \
 | 
			
		||||
    && conan profile update "conf.tools.build:compiler_executables={\"c\": \"/usr/bin/clang-16\", \"cpp\": \"/usr/bin/clang++-16\"}" clang 
 | 
			
		||||
 | 
			
		||||
RUN echo "include(gcc)" >> .conan/profiles/default
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								docker/compilers/clang-16/dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								docker/compilers/clang-16/dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
FROM ubuntu:focal 
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
ARG TARGETARCH
 | 
			
		||||
 | 
			
		||||
SHELL ["/bin/bash", "-c"]
 | 
			
		||||
USER root
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
 | 
			
		||||
ENV CLANG_VERSION=16
 | 
			
		||||
 | 
			
		||||
RUN apt update -qq \
 | 
			
		||||
    && apt install -qq -y --no-install-recommends --no-install-suggests \
 | 
			
		||||
    wget software-properties-common gnupg
 | 
			
		||||
 | 
			
		||||
RUN wget https://apt.llvm.org/llvm.sh \
 | 
			
		||||
    && chmod +x llvm.sh \
 | 
			
		||||
    && ./llvm.sh ${CLANG_VERSION} \
 | 
			
		||||
    && rm -rf llvm.sh \
 | 
			
		||||
    && apt-get install -y libc++-16-dev libc++abi-16-dev
 | 
			
		||||
							
								
								
									
										6
									
								
								docker/compilers/gcc-12/control.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								docker/compilers/gcc-12/control.m4
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
Package: gcc-12-ubuntu-UBUNTUVERSION
 | 
			
		||||
Version: VERSION
 | 
			
		||||
Architecture: TARGETARCH
 | 
			
		||||
Maintainer: Alex Kremer <akremer@ripple.com>
 | 
			
		||||
Description: Gcc VERSION build for ubuntu UBUNTUVERSION
 | 
			
		||||
Depends: binutils, libc6-dev
 | 
			
		||||
@@ -1,41 +1,74 @@
 | 
			
		||||
FROM ubuntu:focal as build
 | 
			
		||||
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
ARG TARGETARCH
 | 
			
		||||
ARG UBUNTU_VERSION=20.04
 | 
			
		||||
ARG GCC_VERSION=12.3.0
 | 
			
		||||
ARG BUILD_VERSION=1
 | 
			
		||||
 | 
			
		||||
SHELL ["/bin/bash", "-c"]
 | 
			
		||||
USER root
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
RUN apt update && apt install -y wget build-essential file flex libz-dev libzstd-dev
 | 
			
		||||
RUN wget https://gcc.gnu.org/pub/gcc/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz \
 | 
			
		||||
    && tar xf gcc-$GCC_VERSION.tar.gz \
 | 
			
		||||
    && cd /gcc-$GCC_VERSION && ./contrib/download_prerequisites
 | 
			
		||||
 | 
			
		||||
ENV GCC_VERSION=12.3.0
 | 
			
		||||
RUN mkdir /${TARGETARCH}-gcc-12
 | 
			
		||||
WORKDIR /${TARGETARCH}-gcc-12
 | 
			
		||||
RUN /gcc-$GCC_VERSION/configure \
 | 
			
		||||
    --with-pkgversion="clio-build-$BUILD_VERSION https://github.com/XRPLF/clio" \
 | 
			
		||||
    --enable-languages=c,c++ \
 | 
			
		||||
    --prefix=/usr \
 | 
			
		||||
    --with-gcc-major-version-only \
 | 
			
		||||
    --program-suffix=-12 \
 | 
			
		||||
    --enable-shared \
 | 
			
		||||
    --enable-linker-build-id \
 | 
			
		||||
    --libexecdir=/usr/lib \
 | 
			
		||||
    --without-included-gettext \
 | 
			
		||||
    --enable-threads=posix \
 | 
			
		||||
    --libdir=/usr/lib \
 | 
			
		||||
    --disable-nls \
 | 
			
		||||
    --enable-clocale=gnu \
 | 
			
		||||
    --enable-libstdcxx-backtrace=yes \
 | 
			
		||||
    --enable-libstdcxx-debug \
 | 
			
		||||
    --enable-libstdcxx-time=yes \
 | 
			
		||||
    --with-default-libstdcxx-abi=new \
 | 
			
		||||
    --enable-gnu-unique-object \
 | 
			
		||||
    --disable-vtable-verify \
 | 
			
		||||
    --enable-plugin \
 | 
			
		||||
    --enable-default-pie \
 | 
			
		||||
    --with-system-zlib \
 | 
			
		||||
    --enable-libphobos-checking=release \
 | 
			
		||||
    --with-target-system-zlib=auto \
 | 
			
		||||
    --disable-werror \
 | 
			
		||||
    --enable-cet \
 | 
			
		||||
    --disable-multilib \
 | 
			
		||||
    --without-cuda-driver \
 | 
			
		||||
    --enable-checking=release \
 | 
			
		||||
    && make -j`nproc` \
 | 
			
		||||
    && make install-strip DESTDIR=/gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION \
 | 
			
		||||
    && mkdir -p /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/share/gdb/auto-load/usr/lib64 \
 | 
			
		||||
    && mv /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/lib64/libstdc++.so.6.0.30-gdb.py /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.30-gdb.py
 | 
			
		||||
 | 
			
		||||
RUN apt update -qq \
 | 
			
		||||
    && apt install -qq -y --no-install-recommends --no-install-suggests \
 | 
			
		||||
    gnupg wget software-properties-common build-essential
 | 
			
		||||
# Generate deb
 | 
			
		||||
WORKDIR /
 | 
			
		||||
COPY control.m4 /
 | 
			
		||||
COPY ld.so.conf /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/etc/ld.so.conf.d/1-gcc-12.conf
 | 
			
		||||
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
 | 
			
		||||
# Install gcc-12 from source
 | 
			
		||||
RUN wget "https://mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz" \
 | 
			
		||||
    && tar xf "gcc-${GCC_VERSION}.tar.gz" \
 | 
			
		||||
    && cd "gcc-${GCC_VERSION}" \
 | 
			
		||||
    && ./contrib/download_prerequisites \
 | 
			
		||||
    && mkdir build && cd build \
 | 
			
		||||
    && ../configure --enable-languages=c,c++ --disable-multilib --with-build-config='bootstrap-O3' --prefix='/opt'  \
 | 
			
		||||
    && make -j$(nproc) profiledbootstrap && make install-strip \
 | 
			
		||||
    && rm -rf /root/*
 | 
			
		||||
RUN mkdir /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/DEBIAN \
 | 
			
		||||
    && m4 -P -DUBUNTU_VERSION=$UBUNTU_VERSION -DVERSION=$GCC_VERSION-$BUILD_VERSION -DTARGETARCH=$TARGETARCH control.m4 > /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/DEBIAN/control \
 | 
			
		||||
    && dpkg-deb --build --root-owner-group /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION /gcc12.deb
 | 
			
		||||
 | 
			
		||||
# Create final image
 | 
			
		||||
FROM ubuntu:focal as gcc
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
COPY --from=build /gcc12.deb /
 | 
			
		||||
 | 
			
		||||
RUN apt update -qq && apt autoclean -y && apt autoremove -y 
 | 
			
		||||
COPY --from=build /opt /opt
 | 
			
		||||
# Make gcc-12 available but also leave gcc12.deb for others to copy if needed
 | 
			
		||||
RUN apt update && apt-get install -y binutils libc6-dev \
 | 
			
		||||
    && dpkg -i /gcc12.deb 
 | 
			
		||||
 | 
			
		||||
# Rewire to use gcc-12
 | 
			
		||||
RUN update-alternatives --install /usr/bin/g++ g++ /opt/bin/g++ 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/c++ c++ /opt/bin/g++ 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcc gcc /opt/bin/gcc 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/cc cc /opt/bin/gcc 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov gcov /opt/bin/gcov 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-dump gcov-dump /opt/bin/gcov-dump 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-tool gcov-tool /opt/bin/gcov-tool 100 \
 | 
			
		||||
    && update-alternatives --install /lib/*-linux-gnu/libstdc++.so.6 libstdc++.so.6 /opt/lib64/libstdc++.so.6 100
 | 
			
		||||
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12 100 \
 | 
			
		||||
    && update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								docker/compilers/gcc-12/ld.so.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								docker/compilers/gcc-12/ld.so.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
# Path to the directory containing libstdc++.so.6
 | 
			
		||||
/usr/lib64
 | 
			
		||||
@@ -203,8 +203,8 @@ public:
 | 
			
		||||
                size_t numWrites = 0;
 | 
			
		||||
                backend_->cache().setFull();
 | 
			
		||||
 | 
			
		||||
                auto seconds = ::util::timed<std::chrono::seconds>([this, edgeKeys = &edgeKeys, sequence, &numWrites] {
 | 
			
		||||
                    for (auto& key : *edgeKeys) {
 | 
			
		||||
                auto seconds = ::util::timed<std::chrono::seconds>([this, keys = &edgeKeys, sequence, &numWrites] {
 | 
			
		||||
                    for (auto& key : *keys) {
 | 
			
		||||
                        LOG(log_.debug()) << "Writing edge key = " << ripple::strHex(key);
 | 
			
		||||
                        auto succ = backend_->cache().getSuccessor(*ripple::uint256::fromVoidChecked(key), sequence);
 | 
			
		||||
                        if (succ)
 | 
			
		||||
 
 | 
			
		||||
@@ -234,9 +234,9 @@ SubscriptionSource::handleError(util::requests::RequestError const& error, boost
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (wsConnection_ != nullptr) {
 | 
			
		||||
        auto const error = wsConnection_->close(yield);
 | 
			
		||||
        if (error) {
 | 
			
		||||
            LOG(log_.error()) << "Error closing websocket connection: " << error->message();
 | 
			
		||||
        auto const err = wsConnection_->close(yield);
 | 
			
		||||
        if (err) {
 | 
			
		||||
            LOG(log_.error()) << "Error closing websocket connection: " << err->message();
 | 
			
		||||
        }
 | 
			
		||||
        wsConnection_.reset();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -171,7 +171,7 @@ TransactionFeed::pub(
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    auto const genJsonByVersion = [&, tx = tx, meta = meta](std::uint32_t version) {
 | 
			
		||||
    auto const genJsonByVersion = [&, tx, meta](std::uint32_t version) {
 | 
			
		||||
        boost::json::object pubObj;
 | 
			
		||||
        auto const txKey = version < 2u ? JS(transaction) : JS(tx_json);
 | 
			
		||||
        pubObj[txKey] = rpc::toJson(*tx);
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,16 @@ target_sources(clio PRIVATE impl/Build.cpp)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(clio PUBLIC clio_etl clio_feed clio_web clio_rpc)
 | 
			
		||||
 | 
			
		||||
target_compile_features(clio PUBLIC cxx_std_20)
 | 
			
		||||
target_compile_features(clio PUBLIC cxx_std_23)
 | 
			
		||||
 | 
			
		||||
# Clio server
 | 
			
		||||
add_executable(clio_server)
 | 
			
		||||
target_sources(clio_server PRIVATE Main.cpp)
 | 
			
		||||
target_link_libraries(clio_server PRIVATE clio)
 | 
			
		||||
target_link_options(
 | 
			
		||||
  clio_server PRIVATE $<$<AND:$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++ -static-libgcc>
 | 
			
		||||
  # For now let's assume that we only using libstdc++ under gcc.
 | 
			
		||||
  #
 | 
			
		||||
  # TODO: libc++ static linkage in https://github.com/XRPLF/clio/issues/1300
 | 
			
		||||
  clio_server PRIVATE $<$<AND:$<BOOL:${is_gcc}>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++ -static-libgcc>
 | 
			
		||||
)
 | 
			
		||||
set_target_properties(clio_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
 | 
			
		||||
 
 | 
			
		||||
@@ -36,9 +36,7 @@ target_link_libraries(
 | 
			
		||||
         clio_options
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if (is_gcc)
 | 
			
		||||
  # FIXME: needed on gcc for now
 | 
			
		||||
  #
 | 
			
		||||
  # For some reason cmake doesn't propagate the compile definitions from clio_options so we need to add them here
 | 
			
		||||
  target_compile_definitions(clio_util PUBLIC BOOST_ASIO_DISABLE_CONCEPTS)
 | 
			
		||||
endif ()
 | 
			
		||||
# FIXME: needed on gcc-12, clang-16 and AppleClang for now (known boost 1.82 issue for some compilers)
 | 
			
		||||
#
 | 
			
		||||
# For some reason cmake doesn't propagate the compile definitions from clio_options so we need to add them here
 | 
			
		||||
target_compile_definitions(clio_util PUBLIC BOOST_ASIO_DISABLE_CONCEPTS)
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,11 @@
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
// for the static_assert at the bottom which fixes clang compilation:
 | 
			
		||||
// see: https://godbolt.org/z/fzTjMd7G1 vs https://godbolt.org/z/jhKG7deen
 | 
			
		||||
#include <any>
 | 
			
		||||
#include <expected>
 | 
			
		||||
 | 
			
		||||
namespace util::async {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -63,4 +68,7 @@ struct ExecutionError {
 | 
			
		||||
    std::string message;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// these are not the robots you are looking for...
 | 
			
		||||
static_assert(std::is_copy_constructible_v<std::expected<std::any, ExecutionError>>);
 | 
			
		||||
 | 
			
		||||
}  // namespace util::async
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user