Skip to content

Commit 3f12761

Browse files
silverjamJason Mobarak
authored andcommitted
Update docker for ARM support
We need to several arduous things to support RPi: - Build on an older variant of Debian: stretch - Manually build LLVM so that we can build llvmlite
1 parent 2f04071 commit 3f12761

File tree

2 files changed

+216
-10
lines changed

2 files changed

+216
-10
lines changed

python/Dockerfile.arm

Lines changed: 166 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,171 @@
1-
FROM balenalib/armv7hf-debian:sid-build
1+
FROM swiftnav/llvm-arm-stretch:2019.06.26
2+
3+
ARG JOBS=8
24

35
RUN [ "cross-build-start" ]
46

7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
WORKDIR /work
10+
511
RUN \
6-
echo Setting up ARM build environment... \
12+
echo '>>> Setting up ARM build environment...' \
713
&& apt-get update \
8-
&& apt-get install wget bzip2 build-essential llvm-6.0-dev python3 \
9-
&& update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-6.0 1 \
10-
&& wget -O /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh \
11-
&& bash /tmp/miniconda.sh -b \
12-
&& conda install --yes pip \
13-
&& rm /tmp/miniconda.sh
14-
15-
ENV PATH=/root/miniconda3/bin:$PATH
14+
&& apt-get install -y wget bzip2 build-essential python3 \
15+
&& apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev \
16+
libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev \
17+
libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev \
18+
libffi-dev cmake ccache binutils-dev ninja-build \
19+
gperf gawk flex bison ncurses-dev m4 patchelf \
20+
texinfo help2man libpthread-stubs0-dev libtinfo-dev \
21+
libatlas-base-dev libsqlite3-dev tk-dev libgdbm-dev \
22+
libc6-dev
23+
24+
RUN \
25+
echo '>>> Downlading get-pip.py...' \
26+
&& wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
27+
28+
ENV OPENSSL_VER=1.0.2s
29+
ENV OPENSSL_PREFIX=/opt/openssl-${OPENSSL_VER}
30+
ENV OPENSSL_URL=https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz
31+
32+
RUN \
33+
echo ">>> Building OpenSSL ${OPENSSL_VER}..." \
34+
&& wget -O /tmp/openssl.tgz ${OPENSSL_URL} \
35+
&& mkdir /tmp/openssl-build-${OPENSSL_VER} \
36+
&& cd /tmp/openssl-build-${OPENSSL_VER} \
37+
&& tar -xzf /tmp/openssl.tgz \
38+
&& cd openssl-${OPENSSL_VER} \
39+
&& ./config shared --prefix=${OPENSSL_PREFIX} \
40+
&& make -j${JOBS} \
41+
&& make -j${JOBS} install \
42+
&& cd /work
43+
44+
ENV PY34=3.4.10
45+
ENV PY34_URL=https://www.python.org/ftp/python/${PY34}/Python-${PY34}.tar.xz
46+
47+
RUN \
48+
echo '>>> Building Python 3.4...' \
49+
&& wget -O /tmp/python${PY34}.txz ${PY34_URL} \
50+
&& mkdir /tmp/python${PY34}-build && cd /tmp/python${PY34}-build \
51+
&& tar -xJf /tmp/python${PY34}.txz \
52+
&& cd Python-${PY34} \
53+
&& ./configure \
54+
LDFLAGS="-L${OPENSSL_PREFIX}/lib -Wl,-rpath=${OPENSSL_PREFIX}/lib" \
55+
CPPFLAGS="-I${OPENSSL_PREFIX}/include" \
56+
\
57+
&& make -j${JOBS} \
58+
&& make altinstall \
59+
&& cd /work \
60+
\
61+
&& /usr/local/bin/python3.4 /tmp/get-pip.py \
62+
&& /usr/local/bin/python3.4 -m pip install --upgrade pip \
63+
&& /usr/local/bin/python3.4 -m pip install wheel setuptools
64+
65+
ENV PY27=2.7.16
66+
ENV PY27_URL=https://www.python.org/ftp/python/${PY27}/Python-${PY27}.tar.xz
67+
68+
RUN \
69+
echo '>>> Downlading Python 2.7...' \
70+
&& wget -O /tmp/python${PY27}.txz ${PY27_URL}
71+
72+
RUN \
73+
echo '>>> Building Python 2.7...' \
74+
\
75+
&& mkdir /tmp/python${PY27}-build && cd /tmp/python${PY27}-build \
76+
&& tar -xJf /tmp/python${PY27}.txz \
77+
&& cd Python-${PY27} \
78+
&& ./configure \
79+
&& make -j${JOBS} \
80+
&& make altinstall \
81+
&& cd /work \
82+
\
83+
&& /usr/local/bin/python2.7 /tmp/get-pip.py \
84+
&& /usr/local/bin/python2.7 -m pip install --upgrade pip \
85+
&& /usr/local/bin/python2.7 -m pip install wheel setuptools
86+
87+
ENV PY27MU=2.7.16-cp27mu
88+
ENV CP27MU_PREFIX=/opt/cp27mu
89+
90+
RUN \
91+
echo '>>> Building Python 2.7 (cp27mu)...' \
92+
\
93+
&& mkdir /tmp/python${PY27MU}-build && cd /tmp/python${PY27MU}-build \
94+
&& tar -xJf /tmp/python${PY27}.txz \
95+
&& cd Python-${PY27} \
96+
&& ./configure \
97+
--enable-unicode=ucs4 \
98+
--prefix=${CP27MU_PREFIX} \
99+
&& make -j${JOBS} \
100+
&& make altinstall \
101+
&& cd /work \
102+
\
103+
&& ${CP27MU_PREFIX}/bin/python2.7 /tmp/get-pip.py \
104+
&& ${CP27MU_PREFIX}/bin/python2.7 -m pip install --upgrade pip \
105+
&& ${CP27MU_PREFIX}/bin/python2.7 -m pip install wheel setuptools
106+
107+
ENV PY35=3.5.7
108+
ENV PY35_URL=https://www.python.org/ftp/python/${PY35}/Python-${PY35}.tar.xz
109+
110+
RUN \
111+
echo '>>> Building Python 3.5...' \
112+
&& wget -O /tmp/python${PY35}.txz ${PY35_URL} \
113+
&& mkdir /tmp/python${PY35}-build \
114+
&& cd /tmp/python${PY35}-build \
115+
&& tar -xJf /tmp/python${PY35}.txz \
116+
&& cd Python-${PY35} \
117+
&& ./configure \
118+
&& make -j${JOBS} \
119+
&& make altinstall \
120+
&& cd /work \
121+
\
122+
&& /usr/local/bin/python3.5 -m pip install --upgrade pip \
123+
&& /usr/local/bin/python3.5 -m pip install wheel setuptools
124+
125+
ENV PY36=3.6.8
126+
ENV PY36_URL=https://www.python.org/ftp/python/${PY36}/Python-${PY36}.tar.xz
127+
128+
RUN \
129+
echo '>>> Building Python 3.6...' \
130+
&& wget -O /tmp/python${PY36}.txz ${PY36_URL} \
131+
&& mkdir /tmp/python${PY36}-build && cd /tmp/python${PY36}-build \
132+
&& tar -xJf /tmp/python${PY36}.txz \
133+
&& cd Python-${PY36} \
134+
&& ./configure \
135+
&& make -j${JOBS} \
136+
&& make altinstall \
137+
&& cd /work \
138+
\
139+
&& /usr/local/bin/python3.6 -m pip install --upgrade pip \
140+
&& /usr/local/bin/python3.6 -m pip install wheel setuptools
141+
142+
ENV PY37=3.7.3
143+
ENV PY37_URL=https://www.python.org/ftp/python/${PY37}/Python-${PY37}.tar.xz
144+
145+
RUN \
146+
echo '>>> Building Python 3.7...' \
147+
&& wget -O /tmp/python${PY37}.txz ${PY37_URL} \
148+
&& mkdir /tmp/python${PY37}-build && cd /tmp/python${PY37}-build \
149+
&& tar -xJf /tmp/python${PY37}.txz \
150+
&& cd Python-${PY37} \
151+
&& ./configure \
152+
&& make -j${JOBS} \
153+
&& make altinstall \
154+
&& cd /work \
155+
&& /usr/local/bin/python3.7 -m pip install --upgrade pip \
156+
&& /usr/local/bin/python3.7 -m pip install wheel setuptools
157+
158+
RUN \
159+
rm /tmp/python${PY27}.txz \
160+
&& rm -rf /tmp/python${PY27}-build \
161+
&& rm /tmp/python${PY34}.txz \
162+
&& rm -rf /tmp/python${PY34}-build \
163+
&& rm /tmp/python${PY35}.txz \
164+
&& rm -rf /tmp/python${PY35}-build \
165+
&& rm /tmp/python${PY36}.txz \
166+
&& rm -rf /tmp/python${PY36}-build \
167+
&& rm /tmp/python${PY37}.txz \
168+
&& rm -rf /tmp/python${PY37}-build \
169+
&& rm -rf /tmp/openssl.tgz \
170+
&& rm -rf /tmp/openssl-build-${OPENSSLVER} \
171+
&& rm /tmp/get-pip.py

python/Dockerfile.llvm_arm

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM swiftnav/llvm-arm:2019.06.26
2+
3+
RUN [ "cross-build-start" ]
4+
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
WORKDIR /work
8+
9+
RUN \
10+
echo '>>> Setting up ARM build environment...' \
11+
&& apt-get update \
12+
&& apt-get install -y wget bzip2 build-essential python3 \
13+
&& apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev \
14+
libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev \
15+
libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev \
16+
libffi-dev cmake ccache binutils-dev ninja-build \
17+
gperf gawk flex bison ncurses-dev m4 patchelf \
18+
texinfo help2man libpthread-stubs0-dev libtinfo-dev \
19+
libatlas-base-dev libsqlite3-dev tk-dev libgdbm-dev \
20+
libc6-dev
21+
22+
ENV LLVM_BRANCH=release_60
23+
ENV LLVM_URL=https://github.com/llvm-mirror/llvm.git
24+
ENV CLANG_URL=https://github.com/llvm-mirror/clang.git
25+
26+
RUN \
27+
echo '>>> Building LLVM 6.0...' \
28+
&& git clone --depth=1 --single-branch -b ${LLVM_BRANCH} ${LLVM_URL} /tmp/llvm \
29+
&& git clone --depth=1 --single-branch -b ${LLVM_BRANCH} ${CLANG_URL} /tmp/llvm/tools/clang \
30+
&& mkdir -p /tmp/llvm/build \
31+
&& cd /tmp/llvm/build \
32+
&& cmake -G Ninja /tmp/llvm \
33+
-DCMAKE_INSTALL_PREFIX=/usr/local \
34+
-DLLVM_TARGETS_TO_BUILD=ARM \
35+
-DCMAKE_BUILD_TYPE=Release \
36+
-DLLVM_BINUTILS_INCDIR=/usr/include \
37+
-DLLVM_INCLUDE_TESTS=OFF \
38+
-DLLVM_ENABLE_TERMINFO=0 \
39+
-DCMAKE_C_COMPILER=/usr/bin/cc \
40+
-DCMAKE_CXX_COMPILER=/usr/bin/c++ \
41+
-DCMAKE_ASM_COMPILER=/usr/bin/as \
42+
-DCMAKE_CXX_FLAGS="-I/root/llvm/build/tools/clang/include -I/root/llvm/tools/clang/include -DENDIAN_LITTLE=1" \
43+
&& ninja -v \
44+
&& ninja install
45+
46+
RUN \
47+
echo '>>> Cleaning up...' \
48+
&& rm -rf /tmp/llvm
49+
50+
RUN [ "cross-build-end" ]

0 commit comments

Comments
 (0)