From dde8dfc4507ee3c569cb2cb38a386618adc0a58f Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 19 Aug 2022 11:09:25 +0100 Subject: [PATCH] libphonenumber: fix build (#8298) --- projects/libphonenumber/Dockerfile | 2 ++ projects/libphonenumber/build.sh | 25 +++++++++---------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/projects/libphonenumber/Dockerfile b/projects/libphonenumber/Dockerfile index fdce5437d..5fa3c69ec 100644 --- a/projects/libphonenumber/Dockerfile +++ b/projects/libphonenumber/Dockerfile @@ -34,6 +34,8 @@ RUN apt-get install -y libgtest-dev && \ ln -sn /usr/local/lib/googletest/libgtest.a /lib/x86_64-linux-gnu/libgtest.a RUN wget https://github.com/unicode-org/icu/releases/download/release-66-rc/icu4c-66rc-src.tgz && \ tar xzvf icu4c-66rc-src.tgz +RUN git clone https://github.com/google/protobuf.git RUN git clone https://github.com/google/libphonenumber +RUN git clone --depth=1 https://github.com/abseil/abseil-cpp COPY build.sh $SRC/ diff --git a/projects/libphonenumber/build.sh b/projects/libphonenumber/build.sh index c0cb9c661..fe30e6f58 100755 --- a/projects/libphonenumber/build.sh +++ b/projects/libphonenumber/build.sh @@ -28,26 +28,18 @@ then export CXXFLAGS=${CXF1//-fcoverage-mapping/} fi -cd $SRC/ -git clone --depth=1 https://github.com/abseil/abseil-cpp -cd abseil-cpp +cd $SRC/abseil-cpp mkdir build && cd build cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ../ && make && make install - ldconfig -cd $SRC/ - # Build Protobuf -git clone https://github.com/google/protobuf.git -cd protobuf -git submodule update --init --recursive -./autogen.sh -./configure +mkdir $SRC/protobuf-install +cd $SRC/protobuf-install +cmake $SRC/protobuf -Dprotobuf_BUILD_TESTS=OFF -DABSL_ROOT_DIR=$SRC/abseil-cpp make -j$(nproc) make install -ldconfig - +cp $SRC/protobuf/src/google/protobuf/*.inc /usr/local/include/google/protobuf/ # Build icu export DEPS_PATH=/src/deps/ @@ -81,9 +73,10 @@ sed -i 's/set(CMAKE_CXX_STANDARD 11/set(CMAKE_CXX_STANDARD 14/g' CMakeLists.txt sed -i 's/list (APPEND CMAKE_C_FLAGS "-pthread")/string (APPEND CMAKE_C_FLAGS " -pthread")/g' CMakeLists.txt sed -i 's/# Safeguarding/find_package(absl REQUIRED) # Safeguarding/g' CMakeLists.txt -mkdir build && cd build +mkdir build +cd build cmake -DUSE_BOOST=OFF -DBUILD_GEOCODER=OFF \ - -DPROTOBUF_LIB="/src/protobuf/src/.libs/libprotobuf.a" \ + -DPROTOBUF_LIB="/src/protobuf-install/libprotobuf.a" \ -DBUILD_STATIC_LIB=ON \ -DICU_UC_INCLUDE_DIR=$SRC/icu/source/comon \ -DICU_UC_LIB=$DEPS_PATH/lib/libicuuc.a \ @@ -96,7 +89,7 @@ make $CXX -I$SRC/libphonenumber/cpp/src $CXXFLAGS -o phonefuzz.o -c ../test/phonenumbers/fuzz_phone.cc $CXX $CXXFLAGS $LIB_FUZZING_ENGINE phonefuzz.o -o $OUT/phonefuzz \ ./libphonenumber.a \ - $SRC/protobuf/src/.libs/libprotobuf.a \ + $SRC/protobuf-install/libprotobuf.a \ /usr/local/lib/libabsl_cord.a \ /usr/local/lib/libabsl_cordz_info.a \ /usr/local/lib/libabsl_cord_internal.a \