mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-5603 build aarch64 Linux from arm64v8/centos:7 and check glibc to be not higher 2.17
This commit is contained in:
@@ -5,44 +5,42 @@
|
||||
# image creation reproducible.
|
||||
# NB: this also means there may be no security-related fixes there, need to
|
||||
# move the version to the next manually.
|
||||
FROM arm64v8/ubuntu:focal-20211006
|
||||
|
||||
# jetbrains/runtime:jbr17env_aarch64
|
||||
FROM arm64v8/centos:7
|
||||
|
||||
# Install the necessary build tools
|
||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||
export DEBCONF_NONINTERACTIVE_SEEN=true && \
|
||||
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
|
||||
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
|
||||
apt-get update -qy && \
|
||||
apt-get install -qy \
|
||||
autoconf \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
file \
|
||||
g++-10=10.3.0-1ubuntu1~20.04 \
|
||||
gcc-10=10.3.0-1ubuntu1~20.04 \
|
||||
git \
|
||||
libasound2-dev \
|
||||
libcups2-dev \
|
||||
libfontconfig1-dev \
|
||||
libx11-dev \
|
||||
libxext-dev \
|
||||
libxrandr-dev \
|
||||
libxrender-dev \
|
||||
libxt-dev \
|
||||
libxtst-dev \
|
||||
make \
|
||||
rsync \
|
||||
tar \
|
||||
unzip \
|
||||
zip && \
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
|
||||
apt-get clean -qy && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
RUN yum -y update; \
|
||||
yum -y install centos-release-scl; \
|
||||
yum -y install devtoolset-10-10.1-0.el7; \
|
||||
yum -y install \
|
||||
alsa-lib-devel-1.1.8-1.el7.aarch64 \
|
||||
autoconf-2.69-11.el7.noarch \
|
||||
automake-1.13.4-3.el7.noarch \
|
||||
bzip2-1.0.6-13.el7.aarch64 \
|
||||
cups-devel-1.6.3-51.el7.aarch64 \
|
||||
file-5.11-37.el7.aarch64 \
|
||||
fontconfig-devel-2.13.0-4.3.el7.aarch64 \
|
||||
freetype-devel-2.8-14.el7_9.1.aarch64 \
|
||||
giflib-devel-4.1.6-9.el7.aarch64 \
|
||||
git-1.8.3.1-24.el7_9.aarch64 \
|
||||
libtool-2.4.2-22.el7_3.aarch64 \
|
||||
libXi-devel-1.7.9-1.el7.aarch64 \
|
||||
libXrandr-devel-1.5.1-2.el7.aarch64 \
|
||||
libXrender-devel-0.9.10-1.el7.aarch64 \
|
||||
libXt-devel-1.1.5-3.el7.aarch64 \
|
||||
libXtst-devel-1.2.3-1.el7.aarch64 \
|
||||
make-3.82-24.el7.aarch64 \
|
||||
rsync-3.1.2-12.el7_9.aarch64 \
|
||||
tar-1.26-35.el7.aarch64 \
|
||||
unzip-6.0-24.el7_9.aarch64 \
|
||||
wayland-devel-1.15.0-1.el7 \
|
||||
zip-3.0-11.el7.aarch64; \
|
||||
yum -y clean all
|
||||
|
||||
# Set up boot JDK for building
|
||||
COPY boot_jdk.tar.gz /jdk17/
|
||||
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk.tar.gz && rm /jdk17/boot_jdk.tar.gz
|
||||
ENV BOOT_JDK=/jdk17
|
||||
ENV PATH="/opt/rh/devtoolset-10/root/usr/bin:${PATH}"
|
||||
ENV LD_LIBRARY_PATH="/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib"
|
||||
ENV PKG_CONFIG_PATH="/opt/rh/devtoolset-10/root/usr/lib64/pkgconfig"
|
||||
|
||||
RUN git config --global user.email "teamcity@jetbrains.com" && \
|
||||
git config --global user.name "builduser"
|
||||
|
||||
130
test/jdk/jb/build/VerifyDependencies.java
Normal file
130
test/jdk/jb/build/VerifyDependencies.java
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2000-2022 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary VerifyDependencies checks readability verifies that a Linux shared
|
||||
* library has no dependency on symbols from glibc version higher than 2.17
|
||||
* @run main VerifyDependencies
|
||||
* @requires (os.family == "linux")
|
||||
*/
|
||||
|
||||
public class VerifyDependencies {
|
||||
|
||||
public static void verifyLibrary(String libraryPath) throws IOException {
|
||||
Process process;
|
||||
BufferedReader reader;
|
||||
String line;
|
||||
|
||||
System.out.println("checking " + libraryPath);
|
||||
System.out.println("=========================");
|
||||
|
||||
process = Runtime.getRuntime().exec("readelf -Ws " + libraryPath);
|
||||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
if (line.contains("GLIBC_")) {
|
||||
String version = extractVersion(line);
|
||||
if (compareVersions(version, "2.17") > 0) {
|
||||
throw new RuntimeException(libraryPath + " has a dependency on glibc version " + version);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(libraryPath + " has no dependency on glibc version higher than 2.17");
|
||||
}
|
||||
|
||||
private static String extractVersion(String line) {
|
||||
int glibcIndex = line.indexOf("GLIBC_");
|
||||
int versionDelimiter = line.indexOf(" ", glibcIndex);
|
||||
if ( versionDelimiter >= 0 && versionDelimiter < line.length())
|
||||
return line.substring(glibcIndex + 6, versionDelimiter);
|
||||
|
||||
return line.substring(line.indexOf("GLIBC_") + 6);
|
||||
}
|
||||
|
||||
private static int compareVersions(String version1, String version2) {
|
||||
String[] parts1 = version1.split("\\.");
|
||||
String[] parts2 = version2.split("\\.");
|
||||
|
||||
int major1 = Integer.parseInt(parts1[0]);
|
||||
int minor1 = parts1.length > 1 ? Integer.parseInt(parts1[1]) : 0;
|
||||
|
||||
int major2 = Integer.parseInt(parts2[0]);
|
||||
int minor2 = parts2.length > 1 ? Integer.parseInt(parts2[1]) : 0;
|
||||
|
||||
if (major1 == major2) {
|
||||
System.out.printf("\tcomparing %s with %s\n", minor1, minor2);
|
||||
return Integer.compare(minor1, minor2);
|
||||
}
|
||||
|
||||
return Integer.compare(major1, major2);
|
||||
}
|
||||
|
||||
private static void findFiles(File directory, FilenameFilter filter) throws IOException {
|
||||
File[] files = directory.listFiles(filter);
|
||||
|
||||
if (files.length == 0) {
|
||||
return;
|
||||
} else {
|
||||
for (File file : files) {
|
||||
System.out.println(file.getAbsolutePath());
|
||||
verifyLibrary(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
for (File subDirectory : directory.listFiles(File::isDirectory)) {
|
||||
findFiles(subDirectory, filter);
|
||||
}
|
||||
}
|
||||
|
||||
private static void findInDirectory(String directoryPath, boolean findLibs) throws IOException {
|
||||
String libPattern = ".so";
|
||||
|
||||
File directory = new File(directoryPath);
|
||||
|
||||
if (!directory.isDirectory()) {
|
||||
System.out.println(directoryPath + " is not a directory.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
FilenameFilter filter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return findLibs ? name.endsWith(libPattern) : true;
|
||||
}
|
||||
};
|
||||
|
||||
findFiles(directory, filter);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String javaHome = System.getProperty("java.home");
|
||||
findInDirectory(javaHome + "/bin", false);
|
||||
findInDirectory(javaHome + "/lib", true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user