This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile.centos7-gcc7
54 lines (48 loc) · 1.89 KB
/
Dockerfile.centos7-gcc7
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
ARG FROM_IMAGE=nvidia/cuda
ARG CUDA_VER=10.1
ARG CUDA_TYPE=devel
ARG LINUX_VER=centos7
FROM ${FROM_IMAGE}:${CUDA_VER}-${CUDA_TYPE}-${LINUX_VER}
# Define arguments
ARG GCC7_DIR=/usr/local/gcc7
ARG GCC7_VER=7.5.0
ARG GCC9_DIR=/usr/local/gcc9
ARG GCC9_VER=9.4.0
ARG NUM_BUILD_CPUS=16
# Add /usr/local/cuda/* temporarily to LD_LIBRARY_PATH to support various build steps
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH_POSTBUILD:/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs
RUN yum upgrade -y \
&& yum install -y --setopt=install_weak_deps=False \
bzip2 \
curl \
git \
screen \
vim \
wget \
which \
clang \
make \
gmp-devel mpfr-devel libmpc-devel file
# Build gcc 7 and set the environment to use it
# NOTE: this step requires packages gmp-devel, mpfr-devel,
# libmpc-devel, and file (see above)
RUN mkdir -p ${GCC7_DIR} \
&& cd ${GCC7_DIR} && wget -q http://ftp.gnu.org/gnu/gcc/gcc-${GCC7_VER}/gcc-${GCC7_VER}.tar.gz \
&& cd ${GCC7_DIR} && tar zxf gcc-${GCC7_VER}.tar.gz \
&& cd ${GCC7_DIR}/gcc-${GCC7_VER} \
&& ./configure --prefix=${GCC7_DIR} --disable-multilib \
&& make -j${NUM_BUILD_CPUS} && make install \
&& rm -r ${GCC7_DIR}/gcc-${GCC7_VER} ${GCC7_DIR}/gcc-${GCC7_VER}.tar.gz
# Build gcc 9
RUN mkdir -p ${GCC9_DIR} \
&& cd ${GCC9_DIR} && wget -q http://ftp.gnu.org/gnu/gcc/gcc-${GCC9_VER}/gcc-${GCC9_VER}.tar.gz \
&& cd ${GCC9_DIR} && tar zxf gcc-${GCC9_VER}.tar.gz \
&& cd ${GCC9_DIR}/gcc-${GCC9_VER} \
&& ./configure --prefix=${GCC9_DIR} --disable-multilib \
&& make -j${NUM_BUILD_CPUS} && make install \
&& rm -r ${GCC9_DIR}/gcc-${GCC9_VER} ${GCC9_DIR}/gcc-${GCC9_VER}.tar.gz
# Pull gcc9's libstdc++ into gcc7's lib64
RUN rm -rfv ${GCC7_DIR}/lib64/libstdc++.* \
&& ls -la ${GCC9_DIR}/lib64/libstdc++.* \
&& cp -av ${GCC9_DIR}/lib64/libstdc++.* ${GCC7_DIR}/lib64 \
&& ls -la ${GCC7_DIR}/lib64/libstdc++.*