From 9cb0ea1c48f55a9f6cdd1dc0e8ee8fa8f68e0921 Mon Sep 17 00:00:00 2001 From: zer0conf <25299353+zer0conf@users.noreply.github.com> Date: Mon, 16 May 2022 23:28:55 +0300 Subject: [PATCH] Add support for arm64 docker builds Update README.md Added Docker instructions for static Linux arm64 builds relaunch check Update Makefile /bin/sh compatbility --- Dockerfile.linux | 29 ++++++++++++++++++++++------- Makefile | 3 +++ README.md | 4 ++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Dockerfile.linux b/Dockerfile.linux index cb6481cf25..a9c5be3fc9 100644 --- a/Dockerfile.linux +++ b/Dockerfile.linux @@ -1,7 +1,10 @@ -FROM ubuntu:16.04 +ARG UBUNTU_VERSION=16.04 +FROM ubuntu:${UBUNTU_VERSION} +ARG UBUNTU_VERSION ARG THREADS=1 ARG QT_VERSION=v5.15.3-lts-lgpl +ARG DEBIAN_FRONTEND=noninteractive ENV CFLAGS="-fPIC" ENV CPPFLAGS="-fPIC" @@ -9,9 +12,14 @@ ENV CXXFLAGS="-fPIC" ENV SOURCE_DATE_EPOCH=1397818193 RUN apt update && \ + if [ "$UBUNTU_VERSION" = "18.04" ]; then \ + export BUILD_DEPS="build-essential libpng-dev libx11-xcb-dev libxext-dev"; \ + else \ + export BUILD_DEPS="libpng12-dev"; \ + fi && \ apt install -y automake autopoint bison gettext git gperf libgl1-mesa-dev libglib2.0-dev \ - libpng12-dev libpthread-stubs0-dev libsodium-dev libtool-bin libudev-dev libusb-1.0-0-dev mesa-common-dev \ - pkg-config python wget xutils-dev + libpthread-stubs0-dev libsodium-dev libtool-bin libudev-dev libusb-1.0-0-dev mesa-common-dev \ + pkg-config python wget xutils-dev $BUILD_DEPS RUN git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \ cd xorgproto && \ @@ -194,9 +202,16 @@ RUN wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.13.2.tar.gz && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \ - rm /usr/lib/x86_64-linux-gnu/libXext.a && \ - rm /usr/lib/x86_64-linux-gnu/libX11-xcb.a && \ +RUN if [ "$(uname -m)" = "aarch64" ]; then \ + export LIBDIR="/usr/lib/aarch64-linux-gnu"; \ + export QT_PLATFORM="linux-aarch64-gnu-g++"; \ + else \ + export LIBDIR="/usr/lib/x86_64-linux-gnu"; \ + export QT_PLATFORM="linux-g++-64"; \ + fi && \ + rm $LIBDIR/libX11.a && \ + rm $LIBDIR/libXext.a && \ + rm $LIBDIR/libX11-xcb.a && \ git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \ cd qt5 && \ git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \ @@ -215,7 +230,7 @@ RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \ sed -ri s/\(Libs:.*\)/\\1\ -lz/ /usr/local/lib/pkgconfig/freetype2.pc && \ sed -ri s/\(Libs:.*\)/\\1\ -lXau/ /usr/local/lib/pkgconfig/xcb.pc && \ sed -i s/\\/usr\\/X11R6\\/lib64/\\/usr\\/local\\/lib/ qtbase/mkspecs/linux-g++-64/qmake.conf && \ - ./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \ + ./configure --prefix=/usr -platform $QT_PLATFORM -opensource -confirm-license -release -static -no-avx \ -opengl desktop -qpa xcb -xcb -xcb-xlib -feature-xlib -system-freetype -fontconfig -glib \ -no-dbus -no-feature-qml-worker-script -no-linuxfb -no-openssl -no-sql-sqlite -no-kms -no-use-gold-linker \ -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \ diff --git a/Makefile b/Makefile index 42d218ff21..7e0fe66f57 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,9 @@ release-linux-ppc64le: release-static: mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE) +release-static-linux-armv8: + mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="armv8-a" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE) + debug-static-win64: mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE) diff --git a/README.md b/README.md index 2881c4f9f7..fc3eb12159 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,17 @@ Packaging for your favorite distribution would be a welcome contribution! docker build --tag monero:build-env-linux --build-arg THREADS=4 --file Dockerfile.linux . ``` \* `4` - number of CPU threads to use + + For arm64 builds, add `--build-arg UBUNTU_VERSION=18.04` as an argument. 4. Build ``` docker run --rm -it -v :/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j4' ``` \* `` - absolute path to `monero-gui` directory + \* `release-static` - replace with `release-static-linux-armv8` if building for arm64 \* `4` - number of CPU threads to use + 5. Monero GUI Linux static binaries will be placed in `monero-gui/build/release/bin` directory 6. (*Optional*) Compare `monero-wallet-gui` SHA-256 hash to the one obtained from a trusted source ```