Skip to content

Commit f37e917

Browse files
committed
dev box riscv64
1 parent 2bdd9e2 commit f37e917

File tree

7 files changed

+213
-17
lines changed

7 files changed

+213
-17
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Dockerfile for installing the necessary dependencies for building Hadoop.
18+
# See BUILDING.txt.
19+
20+
FROM ubuntu:noble
21+
22+
WORKDIR /root
23+
24+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
25+
26+
#####
27+
# Disable suggests/recommends
28+
#####
29+
RUN echo APT::Install-Recommends "0"\; > /etc/apt/apt.conf.d/10disableextras
30+
RUN echo APT::Install-Suggests "0"\; >> /etc/apt/apt.conf.d/10disableextras
31+
32+
ENV DEBIAN_FRONTEND=noninteractive
33+
ENV DEBCONF_TERSE=true
34+
35+
######
36+
# Platform package dependency resolver
37+
######
38+
COPY pkg-resolver pkg-resolver
39+
RUN chmod a+x pkg-resolver/*.sh pkg-resolver/*.py \
40+
&& chmod a+r pkg-resolver/*.json
41+
42+
######
43+
# Install packages from apt
44+
######
45+
# hadolint ignore=DL3008,SC2046
46+
RUN apt-get -q update \
47+
&& apt-get -q install -y --no-install-recommends wget apt-transport-https gpg gpg-agent gawk ca-certificates \
48+
&& apt-get -q install -y --no-install-recommends python3 \
49+
&& apt-get -q install -y --no-install-recommends $(pkg-resolver/resolve.py ubuntu:noble::riscv64) \
50+
&& apt-get clean \
51+
&& update-java-alternatives -s java-1.17.0-openjdk-riscv64 \
52+
&& rm -rf /var/lib/apt/lists/*
53+
54+
RUN locale-gen en_US.UTF-8
55+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
56+
ENV PYTHONIOENCODING=utf-8
57+
58+
######
59+
# Set env vars required to build Hadoop
60+
######
61+
ENV MAVEN_HOME /usr
62+
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
63+
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-riscv64
64+
65+
#######
66+
# Set env vars for SpotBugs 4.2.2
67+
#######
68+
ENV SPOTBUGS_HOME=/opt/spotbugs
69+
70+
#######
71+
# Set env vars for Google Protobuf 3.25.5
72+
#######
73+
ENV PROTOBUF_HOME=/opt/protobuf
74+
ENV PATH="${PATH}:/opt/protobuf/bin"
75+
76+
###
77+
# Avoid out of memory errors in builds
78+
###
79+
ENV MAVEN_OPTS="-Xms256m -Xmx3072m"
80+
81+
# Skip gpg verification when downloading Yetus via yetus-wrapper
82+
ENV HADOOP_SKIP_YETUS_VERIFICATION=true
83+
84+
####
85+
# Install packages
86+
####
87+
RUN pkg-resolver/install-maven.sh ubuntu:noble::riscv64
88+
RUN pkg-resolver/install-spotbugs.sh ubuntu:noble::riscv64
89+
RUN pkg-resolver/install-boost.sh ubuntu:noble::riscv64
90+
RUN pkg-resolver/install-protobuf.sh ubuntu:noble::riscv64
91+
RUN pkg-resolver/install-hadolint.sh ubuntu:noble::riscv64
92+
93+
###
94+
# Everything past this point is either not needed for testing or breaks Yetus.
95+
# So tell Yetus not to read the rest of the file:
96+
# YETUS CUT HERE
97+
###
98+
99+
# Add a welcome message and environment checks.
100+
COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
101+
RUN chmod 755 /root/hadoop_env_checks.sh
102+
# hadolint ignore=SC2016
103+
RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc

dev-support/docker/hadoop_env_checks.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,31 @@ End-of-message
110110

111111
# -------------------------------------------------------
112112

113+
function tips {
114+
CPU_ARCH=$(echo "$MACHTYPE" | cut -d- -f1)
115+
if [[ "$CPU_ARCH" == "riscv64" ]]; then
116+
cat <<End-of-message
117+
118+
You must install 'com.google.protobuf:protoc:exe:linux-riscv64:3.25.5'
119+
into maven local repository (~/.m2) manually on riscv64 platform.
120+
121+
mvn install:install-file \\
122+
-DgroupId=com.google.protobuf \\
123+
-DartifactId=protoc \\
124+
-Dversion=3.25.5 \\
125+
-Dclassifier=linux-riscv64 \\
126+
-Dpackaging=exe \\
127+
-Dfile=${PROTOBUF_HOME}/bin/protoc
128+
129+
End-of-message
130+
fi
131+
}
132+
133+
# -------------------------------------------------------
134+
113135
showWelcome
114136
warnIfLowMemory
115137
failIfUserIsRoot
138+
tips
116139

117140
# -------------------------------------------------------

dev-support/docker/pkg-resolver/install-protobuf.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,33 @@ if [ $? -eq 1 ]; then
2727
exit 1
2828
fi
2929

30-
default_version="3.21.12"
30+
default_version="3.25.5"
3131
version_to_install=$default_version
3232
if [ -n "$2" ]; then
3333
version_to_install="$2"
3434
fi
3535

36-
if [ "$version_to_install" != "3.21.12" ]; then
36+
if [ "$version_to_install" != "3.25.5" ]; then
3737
echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
3838
version_to_install=$default_version
3939
fi
4040

41-
if [ "$version_to_install" == "3.21.12" ]; then
41+
if [ "$version_to_install" == "3.25.5" ]; then
4242
# hadolint ignore=DL3003
4343
mkdir -p /opt/protobuf-src &&
4444
curl -L -s -S \
45-
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.tar.gz \
45+
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.25.5.tar.gz \
4646
-o /opt/protobuf.tar.gz &&
4747
tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src &&
48+
mkdir -p /opt/abseil-cpp-src &&
49+
curl -L -s -S \
50+
https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz \
51+
-o /opt/abseil-cpp.tar.gz &&
52+
tar xzf /opt/abseil-cpp.tar.gz --strip-components 1 -C /opt/protobuf-src/third_party/abseil-cpp &&
4853
cd /opt/protobuf-src &&
49-
./autogen.sh &&
50-
./configure --prefix=/opt/protobuf &&
51-
make "-j$(nproc)" &&
52-
make install &&
54+
cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF &&
55+
cmake --build build --parallel $(nproc) &&
56+
cmake --install build --prefix /opt/protobuf &&
5357
cd /root &&
5458
rm -rf /opt/protobuf-src
5559
else

0 commit comments

Comments
 (0)