Skip to content

Commit

Permalink
chore(release) install Python 3.8+ in older distributions
Browse files Browse the repository at this point in the history
Fixing V8 build issues, see NVIDIA/DeepLearningExamples#1016

Fixes #430
  • Loading branch information
thibaultcha committed Oct 29, 2023
1 parent 0f00725 commit ae27df2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions assets/release/Dockerfiles/Dockerfile.amd64.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ RUN yum install -y epel-release && \
perl-IPC-Cmd \
perl-Test-Simple

# Install Python 3.8+ (required by V8's GN build system)
RUN yum -y install centos-release-scl-rh centos-release-scl && \
yum --enablerepo=centos-sclo-rh -y install rh-python38 && \
echo 'source /opt/rh/rh-python38/enable; export X_SCLS="`scl enable rh-python38 'echo $X_SCLS'`"' >> /etc/profile.d/python38.sh && \
echo 'source /opt/rh/rh-python38/enable; export X_SCLS="`scl enable rh-python38 'echo $X_SCLS'`"' >> ~/.bashrc && \
echo "scl enable rh-python38" >> ~/.bashrc

ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo
ENV PATH $CARGO_HOME/bin:$PATH
RUN ln -nfs $(which cmake3) /usr/bin/cmake
Expand All @@ -31,3 +38,5 @@ RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \
# https://github.com/WebAssembly/wasm-c-api/blob/master/include/wasm.h#L29
# and ensure a more recent libstdc++ is found
ENV LD_FLAGS="-Wl,--allow-multiple-definition -L/opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8"

SHELL ["/bin/bash", "-l", "-c"]
2 changes: 1 addition & 1 deletion assets/release/Dockerfiles/Dockerfile.amd64.centos8
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \
libstdc++-devel \
libatomic \
perl \
python3 \
python39 \
git \
glib2-devel

Expand Down
9 changes: 9 additions & 0 deletions assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ RUN apt-get install -y --no-install-recommends \
pip3 install scikit-build && \
pip3 install cmake

# Install Python 3.8+ (required by V8's GN build system)
RUN apt-get install -y software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y python3.8 && \
echo 'alias python3="python3.8"' >> ~/.bashrc

ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo
ENV PATH $CARGO_HOME/bin:$PATH
RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
chmod -R a=rwX $CARGO_HOME $RUSTUP_HOME

SHELL ["/bin/bash", "-l", "-c"]
13 changes: 13 additions & 0 deletions util/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,19 @@ release_bin() {

notice "Building $arch binary..."

notice "Debug"
ps -p $$
if [ -x "$(command -v python)" ]; then
python -V
else
echo "no python"
fi
if [ -x "$(command -v python3)" ]; then
python3 -V
else
echo "no python3"
fi

if [ "$(get_distro)" = "centos7" ]; then
notice "Enabling devtoolset-8 for CentOS..."
source /opt/rh/devtoolset-8/enable
Expand Down

0 comments on commit ae27df2

Please sign in to comment.