Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest grpc version (v1.39.0) for cmake build of otlp exporter. #927

Merged
merged 13 commits into from
Aug 2, 2021
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
./ci/do_ci.sh cmake.abseil.test
cmake_gcc_48_test:
name: CMake gcc 4.8
name: CMake gcc 4.8 (without otlp exporter)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
Expand All @@ -59,6 +59,29 @@ jobs:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8

cmake_gcc_48_otlp_exporter_test:
name: CMake gcc 4.8 (with otlp exporter)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_gcc48.sh
- name: setup cmake
run: |
sudo CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 ./ci/setup_cmake.sh
- name: setup grpc
run: |
sudo CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 ./ci/setup_grpc.sh -v 4.8
- name: run tests
run: ./ci/do_ci.sh cmake.legacy.exporter.otprotocol.test
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8

cmake_test_cxx20:
name: CMake C++20 test
runs-on: ubuntu-20.04
Expand Down
16 changes: 16 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ elif [[ "$1" == "cmake.legacy.test" ]]; then
make
make test
exit 0
elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
export BUILD_ROOT="${BUILD_DIR}"
${SRC_DIR}/tools/build-gtest.sh
${SRC_DIR}/tools/build-benchmark.sh
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP=ON \
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"
sed -i "s~gRPC_CPP_PLUGIN_EXECUTABLE-NOTFOUND~$grpc_cpp_plugin~" ${proto_make_file} #fixme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually copied from here (existing otlp build action on ubuntu-latest):

sed -i "s~gRPC_CPP_PLUGIN_EXECUTABLE-NOTFOUND~$grpc_cpp_plugin~" ${proto_make_file} #fixme

Somehow, cmake is not able to find the grpc_cpp_plugin executable during configuration and so it has to be replaced manually in generated make file before doing the actual make.
I will debug this separately and fix in another PR.

make -j $(nproc)
cd exporters/otlp && make test
exit 0
elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
Expand Down
41 changes: 36 additions & 5 deletions ci/setup_grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,57 @@

set -e
export DEBIAN_FRONTEND=noninteractive
old_grpc_version='v1.33.2'
new_grpc_version='v1.39.0'
gcc_version_for_new_grpc='5.1'
install_grpc_version=${new_grpc_version}
grpc_version='v1.39.0'
usage() { echo "Usage: $0 -v <gcc-version>" 1>&2; exit 1; }

while getopts ":v:" o; do
case "${o}" in
v)
gcc_version=${OPTARG}
;;
*)
usage
;;
esac
done
if [ -z "${gcc_version}" ]; then
gcc_version=`gcc --version | awk '/gcc/ {print $NF}'`
fi
if [[ "${gcc_version}" < "${gcc_version_for_new_grpc}" ]]; then
echo "less"
install_grpc_version=${old_grpc_version}
fi
if ! type cmake > /dev/null; then
#cmake not installed, exiting
exit 1
fi
export BUILD_DIR=/tmp/
export INSTALL_DIR=/usr/local/
pushd $BUILD_DIR
git clone --depth=1 -b v1.34.0 https://github.com/grpc/grpc
cd grpc
echo "installing grpc version: ${install_grpc_version}"
git clone --depth=1 -b ${install_grpc_version} https://github.com/grpc/grpc
pushd grpc
git submodule init
git submodule update --depth 1
mkdir -p cmake/build
pushd cmake/build
mkdir -p "third_party/abseil-cpp/build" && pushd "third_party/abseil-cpp/build"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ..
make -j${nproc} install && popd
mkdir -p build && pushd build
cmake -DgRPC_INSTALL=ON \
-DCMAKE_CXX_STANDARD=11 \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
../..
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
..
make -j $(nproc)
make install
popd
popd

export PATH=${INSTALL_DIR}/bin:$PATH # ensure to use the installed grpc