Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: bash ./scripts/addSubmodules.sh

- name: Build with docker
run: docker run --workdir "$GITHUB_WORKSPACE" --mount type=bind,source="$GITHUB_WORKSPACE",target="$GITHUB_WORKSPACE" --user "$(id -u)":"$(id -g)" gringofts/compile:v3 hooks/pre-commit
run: docker run --workdir "$GITHUB_WORKSPACE" --mount type=bind,source="$GITHUB_WORKSPACE",target="$GITHUB_WORKSPACE" --user "$(id -u)":"$(id -g)" gringofts/compile:v4 hooks/pre-commit

Lint:
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ include_directories(third_party/spdlog/include)
# ini parser
include_directories(third_party/inih/cpp)

# abseil-cpp
# abseil-cpp - use system installed absl
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL)
include_directories(third_party/abseil-cpp)
find_package(absl REQUIRED CONFIG)
set(ABSL_LIBS absl::strings absl::base absl::str_format absl::time)

# prometheus
Expand Down Expand Up @@ -293,7 +292,6 @@ if(hasParent)
set(GRINGOFTS_INCL
Gringofts/src
Gringofts/test
Gringofts/third_party/abseil-cpp
Gringofts/third_party/prometheus-cpp/core/include
Gringofts/third_party/prometheus-cpp/pull/include
Gringofts/third_party/spdlog/include
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ bash ./scripts/addSubmodules.sh
This approach requires minimum dependencies on the target OS as all of the dependencies are encapsulated in a docker image.
1. Build docker image for compiling the project (one-time setup)
```bash
sudo docker build --rm -t gringofts/dependencies:v3 -f dockers/dependencies/download.Dockerfile .
sudo docker build --rm -t gringofts/compile:v3 -f dockers/dependencies/install.Dockerfile .
sudo docker build --rm -t gringofts/dependencies:v4 -f dockers/dependencies/download.Dockerfile .
sudo docker build --rm -t gringofts/compile:v4 -f dockers/dependencies/install.Dockerfile .
```
1. Build binaries
```bash
sudo docker run --workdir "$(pwd)" --mount type=bind,source="$(pwd)",target="$(pwd)" --user "$(id -u)":"$(id -g)" gringofts/compile:v3 hooks/pre-commit
sudo docker run --workdir "$(pwd)" --mount type=bind,source="$(pwd)",target="$(pwd)" --user "$(id -u)":"$(id -g)" gringofts/compile:v4 hooks/pre-commit
```

### Build directly on local OS
Expand Down Expand Up @@ -166,11 +166,6 @@ Some parts of this software include 3rd party code licensed under open source li
License: https://www.sqlite.org/copyright.html<br/>
SQLite Is Public Domain

1. abseil-cpp<br/>
URL: https://github.com/abseil/abseil-cpp<br/>
License: https://github.com/abseil/abseil-cpp/blob/master/LICENSE<br/>
Originally licensed under the Apache 2.0 license.

1. cpplint<br/>
URL: https://github.com/google/styleguide<br/>
License: https://github.com/google/styleguide/blob/gh-pages/LICENSE<br/>
Expand Down
2 changes: 1 addition & 1 deletion dockers/dependencies/download.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This Dockerfile downloads all the external dependencies
# tag: gringofts/dependencies:v3
# tag: gringofts/dependencies:v4
FROM ubuntu:22.04
LABEL maintainer="jingyichen@ebay.com"
WORKDIR /usr/external
Expand Down
4 changes: 2 additions & 2 deletions dockers/dependencies/install.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Dockerfile installs all the external dependencies
# tag: gringofts/compile:v3
FROM gringofts/dependencies:v3
# tag: gringofts/compile:v4
FROM gringofts/dependencies:v4
LABEL maintainer="jingyichen@ebay.com"
WORKDIR /usr/external
COPY scripts/installDependencies.sh /usr/external
Expand Down
10 changes: 0 additions & 10 deletions scripts/addSubmodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ else
cd "$SPDLOG" || return
git checkout 10578ff
fi
# abseil-cpp
ABSL="third_party/abseil-cpp"
if [[ "$SUMMARY" == *"$ABSL"* ]]; then
echo "Skipping $ABSL"
else
cd "$DIR" || return
git submodule add -f https://github.com/abseil/abseil-cpp.git "$ABSL"
cd "$ABSL" || return
git checkout 20190808
fi
# prometheus-cpp
PROMETHEUS="third_party/prometheus-cpp"
if [[ "$SUMMARY" == *"$PROMETHEUS"* ]]; then
Expand Down
14 changes: 7 additions & 7 deletions scripts/downloadDependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ apt-get update -y &&
apt-get install -y wget tar git build-essential apt-utils &&
apt-get install -y apt-transport-https ca-certificates
# download cmake
cmake_version=3.14
cd ~/temp && version=${cmake_version} && build=0 &&
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz &&
tar -xzf cmake-$version.$build.tar.gz &&
mv cmake-$version.$build cmake
cmake_version=3.14.0
cd ~/temp &&
wget https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}.tar.gz &&
tar -xzf cmake-${cmake_version}.tar.gz &&
mv cmake-${cmake_version} cmake
# download and install gcc/g++
gcc9_version=9.5.0
GCC9=$(g++-9 --version | grep ${gcc9_version})
Expand All @@ -41,8 +41,8 @@ apt-get install -y libcurl4-gnutls-dev &&
git clone -b v${prometheus_version} https://github.com/jupp0r/prometheus-cpp.git &&
cd prometheus-cpp/ && git submodule init && git submodule update
# download grpc and related components
grpc_version="1.16"
cd ~/temp && version=${grpc_version} && build=1 &&
grpc_version="1.40"
cd ~/temp && version=${grpc_version} && build=0 &&
git clone https://github.com/grpc/grpc &&
cd grpc && git fetch --all --tags --prune &&
git checkout tags/v$version.$build -b v$version.$build &&
Expand Down
43 changes: 33 additions & 10 deletions scripts/installDependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ else
echo "cmake ${cmake_version} has been installed, skip"
fi
# install grpc and related components
# 0. install absl (abseil-cpp) to system
absl_version="20210324.0"
ABSL=$(find /usr/local/lib -name 'libabsl_*.a' 2>/dev/null | head -1)
if [ -z "$ABSL" ]; then
Comment thread
jingyichen1223 marked this conversation as resolved.
cd ~/temp/grpc/third_party/abseil-cpp &&
# Fix SIGSTKSZ type mismatch in abseil (glibc 2.34+)
sed -i 's/std::max(SIGSTKSZ, 65536)/std::max<size_t>(SIGSTKSZ, 65536)/' \
absl/debugging/failure_signal_handler.cc &&
Comment thread
jingyichen1223 marked this conversation as resolved.
mkdir -p build && cd build &&
CXX=g++-9 CC=gcc-9 cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DABSL_BUILD_TESTING=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
.. &&
make -j$(nproc) && make install && ldconfig
checkLastSuccess "install abseil-cpp ${absl_version} fails"
echo -e "\033[32mabseil-cpp ${absl_version} installed successfully.\033[0m"
else
echo "abseil-cpp ${absl_version} has been installed, skip"
fi
# 1. install cares
CARES=$(find /usr -name '*c-ares*')
if [ -z "$CARES" ]; then
Expand All @@ -43,19 +64,21 @@ if [ -z "$PROTOBUF" ]; then
else
echo "protobuf ${protobuf_version} has been installed, skip"
fi
# 3. install grpc
# 3. install grpc (using system absl with C++17)
# install libssl-dev to skip installing boringssl
Comment thread
jingyichen1223 marked this conversation as resolved.
grpc_version="1.16"
GRPC=$(grep ${grpc_version} /usr/local/lib/cmake/grpc/gRPCConfigVersion.cmake)
grpc_version="1.40"
GRPC=$(grep ${grpc_version} /usr/local/lib/cmake/grpc/gRPCConfigVersion.cmake 2>/dev/null)
Comment thread
jingyichen1223 marked this conversation as resolved.
if [ -z "$GRPC" ]; then
cd ~/temp/grpc &&
sed -i -E "s/(gRPC_ZLIB_PROVIDER.*)module(.*CACHE)/\1package\2/" CMakeLists.txt &&
sed -i -E "s/(gRPC_CARES_PROVIDER.*)module(.*CACHE)/\1package\2/" CMakeLists.txt &&
sed -i -E "s/(gRPC_SSL_PROVIDER.*)module(.*CACHE)/\1package\2/" CMakeLists.txt &&
sed -i -E "s/(gRPC_PROTOBUF_PROVIDER.*)module(.*CACHE)/\1package\2/" CMakeLists.txt &&
echo "src/core/lib/gpr/log_linux.cc,src/core/lib/gpr/log_posix.cc,src/core/lib/iomgr/ev_epollex_linux.cc" | tr "," "\n" | xargs -L1 sed -i "s/gettid/sys_gettid/" &&
CXX=g++-9 CC=gcc-9 cmake -DCMAKE_BUILD_TYPE=Debug &&
make && make install && make clean && ldconfig
CXX=g++-9 CC=gcc-9 cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=17 \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_ABSL_PROVIDER=package \
. &&
make -j$(nproc) && make install && make clean && ldconfig
Comment thread
jingyichen1223 marked this conversation as resolved.
checkLastSuccess "install grpc ${grpc_version} fails"
else
echo "gRPC ${grpc_version} has been installed, skip"
Expand Down
Loading