diff --git a/.github/workflows/cpp_full_node_workflow.yml b/.github/workflows/cpp_full_node_workflow.yml index b690f645..9d683a7d 100644 --- a/.github/workflows/cpp_full_node_workflow.yml +++ b/.github/workflows/cpp_full_node_workflow.yml @@ -86,6 +86,9 @@ jobs: if: runner.os == 'macOS' run: | bash -x cpp/tools/install_depends.sh -o macos + brew install libiconv + export PATH="/usr/local/opt/libiconv/bin:$PATH" + export DYLD_LIBRARY_PATH=/usr/local/opt/libiconv/lib:${DYLD_LIBRARY_PATH} mkdir -p cpp/build && cd cpp/build export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) && cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ make -j3 @@ -200,6 +203,13 @@ jobs: df /tmp du /tmp | sort -n ls -lh /tmp + - name: upgradeDependss + run: | + wget http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz + tar -xf automake-1.14.1.tar.gz + cd automake-1.14.1 + ./configure && make -j4 && make install + cd .. - name: DependenciesBuild run: | bash -x cpp/tools/install_depends.sh -o centos diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 637727df..b15a5aa3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -69,7 +69,7 @@ jobs: GW_DOCKER_TAG="fiscoorg/wedpr-gateway-service:${GW_DOCKER_TAG}" echo "* Begin to build wedpr-gateway-service docker: ${GW_DOCKER_TAG}" cd docker-files/cpp/ - docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-gateway-service -t ${GW_DOCKER_TAG} . + docker build --no-cache --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-gateway-service -t ${GW_DOCKER_TAG} . echo "* Build wedpr-gateway-service docker: ${GW_DOCKER_TAG} success" docker push ${GW_DOCKER_TAG} echo "* Push wedpr-gateway-service docker: ${GW_DOCKER_TAG} success" diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index ca30bbbe..a1f68255 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -127,7 +127,6 @@ { "name": "libxml2", "version>=": "2.11.5#1", - "default-features": false, "features": ["lzma", "zlib"] }, "tarscpp", diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiCache.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiCache.cpp index 5e7a7168..52c4e083 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiCache.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiCache.cpp @@ -328,15 +328,23 @@ bool CalculatorCache::tryToFinalize() { continue; } + auto data = getPlainDataByIndex(it.second.plainDataIndex); if (it.second.plainDataIndex > 0) { - m_intersectionResult.emplace_back(getPlainDataByIndex(it.second.plainDataIndex)); + m_intersectionResult.emplace_back(data); } - // means the header field, swap with the first element if (it.second.plainDataIndex == 0) { - m_intersectionResult.emplace_back(m_intersectionResult[0]); - m_intersectionResult[0] = getPlainDataByIndex(it.second.plainDataIndex); + // means the header field, swap with the first element + if (m_intersectionResult.size() > 0) + { + m_intersectionResult.emplace_back(m_intersectionResult[0]); + m_intersectionResult[0] = data; + } + else + { + m_intersectionResult.emplace_back(data); + } } } m_cacheState = CacheState::Finalized; diff --git a/docker-files/cpp/Dockerfile b/docker-files/cpp/Dockerfile index eeb65f1b..192445cc 100644 --- a/docker-files/cpp/Dockerfile +++ b/docker-files/cpp/Dockerfile @@ -1,4 +1,4 @@ -FROM fiscoorg/wedpr-component-vcpkg-cache:v3.0.0 as builder +FROM ubuntu:22.04 as builder LABEL maintainer=service@webank.com @@ -8,16 +8,31 @@ ARG SOURCE_BRANCH ENV DEBIAN_FRONTEND=noninteractive \ SOURCE=${SOURCE_BRANCH:-main} -# free the diskspace -RUN rm -rf /vcpkg/buildtrees/*/*dbg && rm -rf /vcpkg/buildtrees/*/*src +# Note: depends on python3; default jdk for jni +RUN apt-get -q update && apt-get install -qy --no-install-recommends \ + vim curl lcov git make nasm build-essential cmake wget libtool ca-certificates python3.11 python3-dev \ + libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config zip tar ccache uuid-runtime automake autoconf \ + m4 tcpdump net-tools gcc g++ default-jdk \ + && ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && apt-get install -qy --no-install-recommends tzdata \ + && dpkg-reconfigure --frontend noninteractive tzdata \ + && rm -rf /var/lib/apt/lists/* + +# install rust +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y + +ENV PATH="/root/.cargo/bin:${PATH}" + +ENV VCPKG_FORCE_SYSTEM_BINARIES=1 + +RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component --recursive --depth=1 -b ${SOURCE} -RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component --recursive --depth=1 -b ${SOURCE} \ # ln the cached vcpkg and compile -RUN cd WeDPR-Component/cpp && rm -rf vcpkg && ln -s /vcpkg \ +RUN cd WeDPR-Component/cpp \ && mkdir -p build && cd build \ && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON \ && make -j8 - + FROM ubuntu:22.04 as wedpr-gateway-service LABEL maintainer=service@webank.com