From d3f6b471c2df837c2e899aee61bb37e3efe6a249 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Mon, 20 Jan 2025 07:31:41 -0600 Subject: [PATCH] static builds working --- Dockerfile.source | 36 +++++++++++++++++++++++++++++++++--- Taskfile.yaml | 5 +++++ node/build.sh | 3 ++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Dockerfile.source b/Dockerfile.source index 1fd3714..1a34735 100644 --- a/Dockerfile.source +++ b/Dockerfile.source @@ -4,8 +4,23 @@ ENV PATH="${PATH}:/root/.cargo/bin/" # Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) RUN apt-get update && apt-get install -y \ - libgmp-dev libflint-dev g++ \ - && rm -rf /var/lib/apt/lists/* + build-essential \ + curl \ + git \ + cmake \ + libgmp-dev \ + libmpfr-dev \ + libmpfr6 \ + wget \ + m4 \ + pkg-config \ + gcc \ + g++ \ + make \ + autoconf \ + automake \ + libtool \ + && rm -rf /var/lib/apt/lists/* RUN apt update && apt install -y wget && \ ARCH=$(dpkg --print-architecture) && \ @@ -21,6 +36,22 @@ RUN apt update && apt install -y wget && \ ENV PATH=$PATH:/usr/local/go/bin +RUN git clone https://github.com/flintlib/flint.git && \ + cd flint && \ + git checkout flint-3.0 && \ + ./bootstrap.sh && \ + ./configure \ + --prefix=/usr/local \ + --with-gmp=/usr/local \ + --with-mpfr=/usr/local \ + --enable-static \ + --disable-shared \ + CFLAGS="-O3" && \ + make && \ + make install && \ + cd .. && \ + rm -rf flint + COPY docker/rustup-init.sh /opt/rustup-init.sh RUN /opt/rustup-init.sh -y --profile minimal @@ -90,7 +121,6 @@ LABEL org.opencontainers.image.revision=$GIT_COMMIT RUN apt-get update && apt-get install -y ca-certificates COPY --from=build /usr/bin/node /usr/local/bin -COPY --from=build /usr/local/go/bin/grpcurl /usr/local/bin COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin WORKDIR /root diff --git a/Taskfile.yaml b/Taskfile.yaml index 3d066ed..27a2604 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -60,6 +60,11 @@ tasks: cmds: - docker build --platform linux/amd64 -f Dockerfile.source --output node/build/amd64_linux --target=node . + build_node_amd64_avx512_linux: + desc: Build the Quilibrium node binary for AMD64 Linux with AVX-512 extensions. Outputs to node/build. + cmds: + - docker build --platform linux/amd64 -f Dockerfile.sourceavx512 --output node/build/amd64_avx512_linux --target=node . + build_qclient_amd64_linux: desc: Build the QClient node binary for AMD64 Linux. Outputs to node/build. cmds: diff --git a/node/build.sh b/node/build.sh index a762d1d..60740c9 100755 --- a/node/build.sh +++ b/node/build.sh @@ -26,7 +26,8 @@ case "$os_type" in fi ;; "Linux") - go build -ldflags "-linkmode 'external' -extldflags '-L$BINARIES_DIR -Wl,-Bstatic -lvdf -lbls48581 -Wl,-Bdynamic -lstdc++ -ldl -lm -lflint -lgmp -lmpfr'" "$@" + export CGO_LDFLAGS="-L/usr/local/lib -lflint -lgmp -lmpfr -ldl -lm -L$BINARIES_DIR -lvdf -lbls48581 -static" + go build -ldflags "-linkmode 'external'" "$@" ;; *) echo "Unsupported platform"