Skip to content

Commit

Permalink
Add support for arm64 docker builds
Browse files Browse the repository at this point in the history
Update README.md

Added Docker instructions for static Linux arm64 builds

relaunch check

Update Makefile

/bin/sh compatbility
  • Loading branch information
redsh4de committed May 19, 2022
1 parent 2e2ae5c commit 9cb0ea1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
29 changes: 22 additions & 7 deletions Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
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"
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 && \
Expand Down Expand Up @@ -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 && \
Expand All @@ -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 \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j4'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - 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
```
Expand Down

0 comments on commit 9cb0ea1

Please sign in to comment.