forked from NVIDIA/DALI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.build.aarch64-qnx
168 lines (147 loc) · 6.03 KB
/
Dockerfile.build.aarch64-qnx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
FROM nvidia/cuda:10.0-devel-ubuntu16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
wget \
unzip \
git \
rsync \
dh-autoreconf \
&& rm -rf /var/lib/apt/lists/*
COPY qnx/cuda* /cuda-qnx-cross.deb
COPY qnx /qnx
# We need to remove QNX's libjpeg.so so OpenCV and DALI do not pick it up over static libjpeg-turbo that we compile
RUN rsync -a /qnx/host/linux/x86_64/ / && \
mkdir -p /lib64/qnx7/stubs && mv /qnx/lib64/* /lib64/qnx7/stubs && \
mv /qnx/target/qnx7 /usr/aarch64-unknown-nto-qnx && \
rm -rf /usr/aarch64-unknown-nto-qnx/aarch64le/lib/libjpeg.so* && \
rm -rf /usr/aarch64-unknown-nto-qnx/usr/include/j* && \
rm -rf /usr/aarch64-unknown-nto-qnx/armle-v7 /usr/aarch64-unknown-nto-qnx/x86 /usr/aarch64-unknown-nto-qnx/x86_64 && \
rm -rf /qnx
ENV QNX_HOST=/
ENV QNX_TARGET=/usr/aarch64-unknown-nto-qnx
ENV REPO_DEBS="cuda-qnx-cross.deb"
ENV CUDA_CROSS_VERSION=10-0
ENV CUDA_CROSS_PACKAGES="cublas cudart cufft curand cusolver cusparse driver misc-headers npp"
RUN dpkg -i $REPO_DEBS && \
echo "for i in \$CUDA_CROSS_PACKAGES; do echo \"cuda-\$i-cross-qnx-\${CUDA_CROSS_VERSION}\";done" | bash > /tmp/cuda-packages.txt && \
apt-get update \
&& apt-get install -y $(cat /tmp/cuda-packages.txt) \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/cuda-packages.txt
# Boost
RUN BOOST_VERSION=1_66_0 \
&& cd /usr/local \
&& curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_${BOOST_VERSION}.tar.gz | tar -xzf - \
&& ln -s ../boost_${BOOST_VERSION}/boost include/boost
# CMake
RUN CMAKE_VERSION=3.11 && \
CMAKE_BUILD=3.11.0 && \
curl -L https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_BUILD}.tar.gz | tar -xzf - && \
cd /cmake-${CMAKE_BUILD} && \
./bootstrap --parallel=$(grep ^processor /proc/cpuinfo | wc -l) && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /cmake-${CMAKE_BUILD}
# protobuf v3.5.1
ENV PROTOBUF_VERSION=3.5.1
RUN curl -L https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-all-${PROTOBUF_VERSION}.tar.gz | tar -xzf - && \
cd /protobuf-${PROTOBUF_VERSION} && \
./autogen.sh && \
./configure CXXFLAGS="-fPIC" --prefix=/usr/local --disable-shared 2>&1 > /dev/null && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install 2>&1 > /dev/null
RUN cd /protobuf-${PROTOBUF_VERSION} && make clean \
./autogen.sh && ./configure \
CC=$QNX_HOST/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc \
CXX=$QNX_HOST/usr/bin/aarch64-unknown-nto-qnx7.0.0-g++ \
CXXFLAGS="-fPIC -D__EXT_POSIX1_198808 -I$QNX_TARGET/usr/include -I$QNX_TARGET/usr/include/aarch64 -I$QNX_TARGET/usr/include/c++/v1 -L$QNX_TARGET/aarch64le/lib -D_POSIX_C_SOURCE=200112L -D_QNX_SOURCE -D_FILE_OFFSET_BITS=64" \
--host=aarch64-unknown-nto-qnx7.0.0 \
--build=x86_64-linux-gnu \
--with-sysroot=$QNX_TARGET \
--prefix=/usr/aarch64-unknown-nto-qnx/aarch64le \
--with-protoc=/usr/local/bin/protoc && make -j$(nproc) install && \
rm -rf /protobuf-${PROTOBUF_VERSION}
ENV JPEG_TURBO_VERSION=1.5.3
RUN curl -L https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_TURBO_VERSION}.tar.gz | tar -xzf - && \
cd /libjpeg-turbo-${JPEG_TURBO_VERSION} && \
autoreconf -fiv && \
./configure \
--disable-shared \
CFLAGS="-fPIC" \
CXXFLAGS="-fPIC" \
CC=aarch64-unknown-nto-qnx7.0.0-gcc \
CXX=aarch64-unknown-nto-qnx7.0.0-g++ \
--host=aarch64-unknown-nto-qnx7.0.0 \
--prefix=/usr/aarch64-unknown-nto-qnx/aarch64le && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /libjpeg-turbo-${JPEG_TURBO_VERSION}
# OpenCV
ENV OPENCV_VERSION=3.4.3
COPY docker/opencv-qnx.patch /opencv-qnx.patch
RUN curl -L https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz | tar -xzf - && \
cd /opencv-${OPENCV_VERSION} && git apply /opencv-qnx.patch \
&& mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DVIBRANTE_PDK:STRING=/ \
-DCMAKE_TOOLCHAIN_FILE=$PWD/../platforms/qnx/aarch64-qnx.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=/usr/aarch64-unknown-nto-qnx/aarch64le \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_LIST=core,improc,imgcodecs \
-DBUILD_PNG=ON \
-DBUILD_TIFF=OFF \
-DBUILD_TBB=OFF \
-DBUILD_WEBP=OFF \
-DBUILD_JPEG=OFF \
-DWITH_JPEG=ON \
-DBUILD_JASPER=OFF \
-DBUILD_ZLIB=ON \
-DBUILD_EXAMPLES=OFF \
-DBUILD_FFMPEG=ON \
-DBUILD_opencv_java=OFF \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=OFF \
-DENABLE_NEON=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_PTHREADS_PF=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENMP=OFF \
-DWITH_FFMPEG=OFF \
-DWITH_GSTREAMER=OFF \
-DWITH_GSTREAMER_0_10=OFF \
-DWITH_CUDA=OFF \
-DWITH_GTK=OFF \
-DWITH_VTK=OFF \
-DWITH_TBB=OFF \
-DWITH_1394=OFF \
-DWITH_OPENEXR=OFF \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_TESTS=OFF \
-DVIBRANTE=TRUE \
VERBOSE=1 ../ && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /opencv-${OPENCV_VERSION}
VOLUME /dali
WORKDIR /dali
ENV PATH=/usr/local/cuda-10.0/bin:$PATH
ARG DALI_BUILD_DIR=build_aarch64_qnx
WORKDIR /dali/${DALI_BUILD_DIR}
CMD cmake \
-DWERROR=ON \
-DCMAKE_TOOLCHAIN_FILE:STRING="$PWD/../platforms/qnx/aarch64-qnx.toolchain.cmake" \
-DCMAKE_COLOR_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX=./install \
-DARCH=aarch64-qnx \
-DCUDA_HOST=/usr/local/cuda-10.0 \
-DCUDA_TARGET=/usr/local/cuda-10.0/targets/aarch64-qnx \
-DBUILD_TEST=ON \
-DBUILD_BENCHMARK=OFF \
-DBUILD_NVTX=OFF \
-DBUILD_PYTHON=OFF \
-DBUILD_LMDB=OFF \
-DBUILD_TENSORFLOW=OFF \
-DBUILD_JPEG_TURBO=ON \
-DBUILD_NVJPEG=OFF \
-DBUILD_NVOF=OFF \
-DBUILD_NVDEC=OFF \
-DBUILD_NVML=OFF \
.. && \
make install -j"$(grep ^processor /proc/cpuinfo | wc -l)"