Skip to content

Commit

Permalink
build: support Ubuntu 22.04 and clang 14 (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 authored Feb 15, 2023
1 parent d6c15b8 commit c37bacd
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-push-env-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- ubuntu2204
- centos6
- centos7
steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/regular-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ jobs:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- ubuntu2204
- centos6
- centos7
compiler-family:
- gcc
include:
- compiler-family: clang
compiler: "clang-14,clang++-14"
os: ubuntu2204
- compiler-family: clang
compiler: "clang-10,clang++-10"
os: ubuntu2004
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/thirdparty-regular-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- ubuntu2204
- centos6
- centos7
steps:
Expand Down Expand Up @@ -111,6 +112,7 @@ jobs:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- ubuntu2204
- centos6
- centos7
steps:
Expand Down
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ header:
- 'thirdparty/fix_fds_for_macos.patch'
- 'thirdparty/fix_jemalloc_for_m1_on_macos.patch'
- 'thirdparty/fix_libevent_for_macos.patch'
- 'thirdparty/fix_prometheus-cpp_limits.patch'
- 'thirdparty/fix_s2_for_aarch64.patch'
- 'thirdparty/fix_thrift_for_cpp11.patch'
- 'thirdparty/rocksdb_fix_atomic_flush_0879c240.patch'
Expand Down
2 changes: 1 addition & 1 deletion cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function(dsn_setup_compiler_flags)
# We want access to the PRI* print format macros.
add_definitions(-D__STDC_FORMAT_MACROS)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -gdwarf-4" CACHE STRING "" FORCE)

# -Wall: Enable all warnings.
add_compile_options(-Wall)
Expand Down
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Github Actions automatically rebuilds and publishes build-env for every commit.
- `apache/pegasus:build-env-ubuntu1604`
- `apache/pegasus:build-env-ubuntu1804`
- `apache/pegasus:build-env-ubuntu2004`
- `apache/pegasus:build-env-ubuntu2204`

DockerHub: https://hub.docker.com/r/apache/pegasus

Expand All @@ -62,3 +63,4 @@ so jobs based on this image can skip building third-parties.
- `apache/pegasus:thirdparties-bin-ubuntu1604-master`
- `apache/pegasus:thirdparties-bin-ubuntu1804-master`
- `apache/pegasus:thirdparties-bin-ubuntu2004-master`
- `apache/pegasus:thirdparties-bin-ubuntu2204-master`
72 changes: 72 additions & 0 deletions docker/pegasus-build-env/ubuntu2204/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

FROM ubuntu:22.04

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update -y; \
apt-get install -y --no-install-recommends \
build-essential \
software-properties-common \
clang-14 \
libclang-14-dev \
llvm-14-dev \
openjdk-8-jdk \
pkg-config \
python3-pip \
libaio-dev \
libsnappy-dev \
libbz2-dev \
libzstd-dev \
liblz4-dev \
zlib1g \
zlib1g.dev \
patch \
netcat \
wget \
ccache \
git \
curl \
zip \
unzip \
gdb \
vim \
automake \
libtool \
libssl-dev \
bison \
maven \
flex; \
rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir cmake

RUN wget --progress=dot:giga https://github.com/apache/thrift/archive/refs/tags/0.11.0.tar.gz -P /opt/thrift && \
cd /opt/thrift && tar xzf 0.11.0.tar.gz && cd thrift-0.11.0 && ./bootstrap.sh && \
./configure --enable-libs=no && \
make -j$(($(nproc)/2+1)) && make install && cd - && \
rm -rf thrift-0.11.0 0.11.0.tar.gz

ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
ENV CLASSPATH=$JAVA_HOME/lib/
ENV PATH=$JAVA_HOME/bin:$PATH
ENV LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH

WORKDIR /root/apache
3 changes: 2 additions & 1 deletion thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ ExternalProject_Add(prometheus-cpp
https://codeload.github.com/jupp0r/prometheus-cpp/tar.gz/v0.7.0
URL_MD5 dc75c31ceaefd160e978365bdca8eb01
DEPENDS civetweb curl
PATCH_COMMAND rm -rf 3rdparty/civetweb && cp -R ${civetweb_SRC} 3rdparty/civetweb # replace the submodule
# TODO(yingchun): replace the submodule
PATCH_COMMAND rm -rf 3rdparty/civetweb && cp -R ${civetweb_SRC} 3rdparty/civetweb && patch -p0 < ${TP_DIR}/fix_prometheus-cpp_limits.patch
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
-DENABLE_TESTING=OFF
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
Expand Down
10 changes: 10 additions & 0 deletions thirdparty/fix_prometheus-cpp_limits.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- core/src/histogram.cc 2023-02-13 13:56:03.678985601 +0800
+++ core/src/histogram_fix_limits.cc 2023-02-13 13:55:55.303966447 +0800
@@ -4,6 +4,7 @@
#include <cassert>
#include <iterator>
#include <numeric>
+#include <limits>

namespace prometheus {

0 comments on commit c37bacd

Please sign in to comment.