Skip to content

Commit efc1fe2

Browse files
Reproducible jdk21u linux build fixes and updates for debug symbols (adoptium#3691)
* Reproducible jdk21u linux build fixes and updates for debug symbols Signed-off-by: Andrew Leonard <[email protected]> * Trigger CI checks * Reproducible jdk21u linux build fixes and updates for debug symbols Signed-off-by: Andrew Leonard <[email protected]> * Reproducible jdk21u linux build fixes and updates for debug symbols Signed-off-by: Andrew Leonard <[email protected]> * Reproducible jdk21u linux build fixes and updates for debug symbols Signed-off-by: Andrew Leonard <[email protected]> * Build using a linux devkit Signed-off-by: Andrew Leonard <[email protected]> * Build using a linux devkit Signed-off-by: Andrew Leonard <[email protected]> * Build using a linux devkit Signed-off-by: Andrew Leonard <[email protected]> --------- Signed-off-by: Andrew Leonard <[email protected]>
1 parent e282be5 commit efc1fe2

File tree

5 files changed

+58
-100
lines changed

5 files changed

+58
-100
lines changed

.github/workflows/build.yml

+5
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,19 @@ jobs:
131131
run: |
132132
rm /usr/local/bin/2to3 || true
133133
rm /usr/local/bin/2to3-3.11 || true
134+
rm /usr/local/bin/2to3-3.12 || true
134135
rm /usr/local/bin/idle3 || true
135136
rm /usr/local/bin/idle3.11 || true
137+
rm /usr/local/bin/idle3.12 || true
136138
rm /usr/local/bin/pydoc3 || true
137139
rm /usr/local/bin/pydoc3.11 || true
140+
rm /usr/local/bin/pydoc3.12 || true
138141
rm /usr/local/bin/python3 || true
139142
rm /usr/local/bin/python3.11 || true
143+
rm /usr/local/bin/python3.12 || true
140144
rm /usr/local/bin/python3-config || true
141145
rm /usr/local/bin/python3.11-config || true
146+
rm /usr/local/bin/python3.12-config || true
142147
143148
- name: Install Dependencies
144149
run: |

build-farm/platform-specific-configurations/linux.sh

+38-34
Original file line numberDiff line numberDiff line change
@@ -332,40 +332,44 @@ if [ $executedJavaVersion -ne 0 ]; then
332332
exit 1
333333
fi
334334

335-
if [ "${VARIANT}" == "${BUILD_VARIANT_DRAGONWELL}" ] && [ "$JAVA_FEATURE_VERSION" -eq 11 ] && [ -r /usr/local/gcc9/ ] && [ "${ARCHITECTURE}" == "aarch64" ]; then
336-
# GCC9 rather than 10 requested by Alibaba for now
337-
# Ref https://github.com/adoptium/temurin-build/issues/2250#issuecomment-732958466
338-
export PATH=/usr/local/gcc9/bin:$PATH
339-
export CC=/usr/local/gcc9/bin/gcc-9.3
340-
export CXX=/usr/local/gcc9/bin/g++-9.3
341-
# Enable GCC 10 for Java 17+ for repeatable builds, but not for our supported releases
342-
# Ref https://github.com/adoptium/temurin-build/issues/2787
343-
elif [ "${ARCHITECTURE}" == "riscv64" ] && [ -r /usr/bin/gcc-10 ]; then
344-
# Enable GCC 10 for RISC-V, given the rapid evolution of RISC-V, the newer the GCC toolchain, the better
345-
[ -r /usr/bin/gcc-10 ] && export CC=/usr/bin/gcc-10
346-
[ -r /usr/bin/g++-10 ] && export CXX=/usr/bin/g++-10
347-
elif [ "$JAVA_FEATURE_VERSION" -ge 19 ] && [ -r /usr/local/gcc11/bin/gcc-11.2 ]; then
348-
export PATH=/usr/local/gcc11/bin:$PATH
349-
[ -r /usr/local/gcc11/bin/gcc-11.2 ] && export CC=/usr/local/gcc11/bin/gcc-11.2
350-
[ -r /usr/local/gcc11/bin/g++-11.2 ] && export CXX=/usr/local/gcc11/bin/g++-11.2
351-
export LD_LIBRARY_PATH=/usr/local/gcc11/lib64:/usr/local/gcc11/lib
352-
elif [ "$JAVA_FEATURE_VERSION" -ge 17 ] && [ -r /usr/local/gcc10/bin/gcc-10.3 ]; then
353-
export PATH=/usr/local/gcc10/bin:$PATH
354-
[ -r /usr/local/gcc10/bin/gcc-10.3 ] && export CC=/usr/local/gcc10/bin/gcc-10.3
355-
[ -r /usr/local/gcc10/bin/g++-10.3 ] && export CXX=/usr/local/gcc10/bin/g++-10.3
356-
export LD_LIBRARY_PATH=/usr/local/gcc10/lib64:/usr/local/gcc10/lib
357-
elif [ "$JAVA_FEATURE_VERSION" -gt 17 ] && [ -r /usr/bin/gcc-10 ]; then
358-
[ -r /usr/bin/gcc-10 ] && export CC=/usr/bin/gcc-10
359-
[ -r /usr/bin/g++-10 ] && export CXX=/usr/bin/g++-10
360-
# Continue to use GCC 7 if present for JDK<=17 and where 10 does not exist
361-
elif [ -r /usr/local/gcc/bin/gcc-7.5 ]; then
362-
export PATH=/usr/local/gcc/bin:$PATH
363-
[ -r /usr/local/gcc/bin/gcc-7.5 ] && export CC=/usr/local/gcc/bin/gcc-7.5
364-
[ -r /usr/local/gcc/bin/g++-7.5 ] && export CXX=/usr/local/gcc/bin/g++-7.5
365-
export LD_LIBRARY_PATH=/usr/local/gcc/lib64:/usr/local/gcc/lib
366-
elif [ -r /usr/bin/gcc-7 ]; then
367-
[ -r /usr/bin/gcc-7 ] && export CC=/usr/bin/gcc-7
368-
[ -r /usr/bin/g++-7 ] && export CXX=/usr/bin/g++-7
335+
if [[ "${CONFIGURE_ARGS}" =~ .*"--with-devkit=".* ]]; then
336+
echo "Using gcc from DevKit toolchain specified in configure args"
337+
else
338+
if [ "${VARIANT}" == "${BUILD_VARIANT_DRAGONWELL}" ] && [ "$JAVA_FEATURE_VERSION" -eq 11 ] && [ -r /usr/local/gcc9/ ] && [ "${ARCHITECTURE}" == "aarch64" ]; then
339+
# GCC9 rather than 10 requested by Alibaba for now
340+
# Ref https://github.com/adoptium/temurin-build/issues/2250#issuecomment-732958466
341+
export PATH=/usr/local/gcc9/bin:$PATH
342+
export CC=/usr/local/gcc9/bin/gcc-9.3
343+
export CXX=/usr/local/gcc9/bin/g++-9.3
344+
# Enable GCC 10 for Java 17+ for repeatable builds, but not for our supported releases
345+
# Ref https://github.com/adoptium/temurin-build/issues/2787
346+
elif [ "${ARCHITECTURE}" == "riscv64" ] && [ -r /usr/bin/gcc-10 ]; then
347+
# Enable GCC 10 for RISC-V, given the rapid evolution of RISC-V, the newer the GCC toolchain, the better
348+
[ -r /usr/bin/gcc-10 ] && export CC=/usr/bin/gcc-10
349+
[ -r /usr/bin/g++-10 ] && export CXX=/usr/bin/g++-10
350+
elif [ "$JAVA_FEATURE_VERSION" -ge 19 ] && [ -r /usr/local/gcc11/bin/gcc-11.2 ]; then
351+
export PATH=/usr/local/gcc11/bin:$PATH
352+
[ -r /usr/local/gcc11/bin/gcc-11.2 ] && export CC=/usr/local/gcc11/bin/gcc-11.2
353+
[ -r /usr/local/gcc11/bin/g++-11.2 ] && export CXX=/usr/local/gcc11/bin/g++-11.2
354+
export LD_LIBRARY_PATH=/usr/local/gcc11/lib64:/usr/local/gcc11/lib
355+
elif [ "$JAVA_FEATURE_VERSION" -ge 17 ] && [ -r /usr/local/gcc10/bin/gcc-10.3 ]; then
356+
export PATH=/usr/local/gcc10/bin:$PATH
357+
[ -r /usr/local/gcc10/bin/gcc-10.3 ] && export CC=/usr/local/gcc10/bin/gcc-10.3
358+
[ -r /usr/local/gcc10/bin/g++-10.3 ] && export CXX=/usr/local/gcc10/bin/g++-10.3
359+
export LD_LIBRARY_PATH=/usr/local/gcc10/lib64:/usr/local/gcc10/lib
360+
elif [ "$JAVA_FEATURE_VERSION" -gt 17 ] && [ -r /usr/bin/gcc-10 ]; then
361+
[ -r /usr/bin/gcc-10 ] && export CC=/usr/bin/gcc-10
362+
[ -r /usr/bin/g++-10 ] && export CXX=/usr/bin/g++-10
363+
# Continue to use GCC 7 if present for JDK<=17 and where 10 does not exist
364+
elif [ -r /usr/local/gcc/bin/gcc-7.5 ]; then
365+
export PATH=/usr/local/gcc/bin:$PATH
366+
[ -r /usr/local/gcc/bin/gcc-7.5 ] && export CC=/usr/local/gcc/bin/gcc-7.5
367+
[ -r /usr/local/gcc/bin/g++-7.5 ] && export CXX=/usr/local/gcc/bin/g++-7.5
368+
export LD_LIBRARY_PATH=/usr/local/gcc/lib64:/usr/local/gcc/lib
369+
elif [ -r /usr/bin/gcc-7 ]; then
370+
[ -r /usr/bin/gcc-7 ] && export CC=/usr/bin/gcc-7
371+
[ -r /usr/bin/g++-7 ] && export CXX=/usr/bin/g++-7
372+
fi
369373
fi
370374

371375
if [ "${VARIANT}" == "${BUILD_VARIANT_BISHENG}" ]; then

sbin/build.sh

-58
Original file line numberDiff line numberDiff line change
@@ -131,64 +131,6 @@ configureReproducibleBuildParameter() {
131131
addConfigureArg "--with-extra-cflags=" "-qnotimestamps"
132132
addConfigureArg "--with-extra-cxxflags=" "-qnotimestamps"
133133
fi
134-
135-
configureReproducibleBuildDebugMapping
136-
fi
137-
}
138-
139-
# For reproducible builds we need to add debug mappings for the system header paths,
140-
# so that debug symbol files (and thus libraries) are deterministic
141-
configureReproducibleBuildDebugMapping() {
142-
# For Linux add -fdebug-prefix-map'ings for root and gcc include paths,
143-
# pointing to a common set of folders so that the debug binaries are deterministic:
144-
#
145-
# root include : /usr/include
146-
# gcc include : /usr/local/gcc_include
147-
# g++ include : /usr/local/gxx_include
148-
#
149-
if [ "${BUILD_CONFIG[OS_KERNEL_NAME]}" == "linux" ]; then
150-
# Add debug prefix map for root /usr/include, allowing for a SYSROOT
151-
sysroot="$(echo "${BUILD_CONFIG[USER_SUPPLIED_CONFIGURE_ARGS]}" | sed -nE 's/.*\-\-with\-sysroot=([^[:space:]]+).*/\1/p')"
152-
if [ "x$sysroot" != "x" ]; then
153-
root_include=${sysroot%/}"/usr/include"
154-
gcc_sysroot="--sysroot=${sysroot%/}"
155-
else
156-
root_include="/usr/include"
157-
gcc_sysroot=""
158-
fi
159-
echo "Adding -fdebug-prefix-map for root include: ${root_include}=/usr/include"
160-
fdebug_flags="-fdebug-prefix-map=${root_include}/=/usr/include/"
161-
162-
# Add debug prefix map for gcc include, allowing for SYSROOT
163-
if [ -n "${CC-}" ]; then
164-
gcc_include="$(dirname "$(echo "#include <stddef.h>" | $CC $gcc_sysroot -v -E - 2>&1 | grep stddef | tail -1 | tr -s " " | cut -d'"' -f2)")"
165-
elif [ "$(which gcc)" != "" ]; then
166-
gcc_include="$(dirname "$(echo "#include <stddef.h>" | gcc $gcc_sysroot -v -E - 2>&1 | grep stddef | tail -1 | tr -s " " | cut -d'"' -f2)")"
167-
else
168-
# Can't find gcc..
169-
gcc_include=""
170-
fi
171-
if [ "x$gcc_include" != "x" ]; then
172-
echo "Adding -fdebug-prefix-map for gcc include: ${gcc_include}=/usr/local/gcc_include"
173-
fdebug_flags+=" -fdebug-prefix-map=${gcc_include}/=/usr/local/gcc_include/"
174-
fi
175-
176-
# Add debug prefix map for g++ include, allowing for SYSROOT
177-
if [ -n "${CXX-}" ]; then
178-
gxx_include="$(dirname "$(echo "#include <cstddef>" | $CXX $gcc_sysroot -v -E -x c++ - 2>&1 | grep cstddef | tail -1 | tr -s " " | cut -d'"' -f2)")"
179-
elif [ "$(which g++)" != "" ]; then
180-
gxx_include="$(dirname "$(echo "#include <cstddef>" | g++ $gcc_sysroot -v -E -x c++ - 2>&1 | grep cstddef | tail -1 | tr -s " " | cut -d'"' -f2)")"
181-
else
182-
# Can't find g++..
183-
gxx_include=""
184-
fi
185-
if [ "x$gxx_include" != "x" ]; then
186-
echo "Adding -fdebug-prefix-map for g++ include: ${gxx_include}=/usr/local/gxx_include"
187-
fdebug_flags+=" -fdebug-prefix-map=${gxx_include}/=/usr/local/gxx_include/"
188-
fi
189-
190-
addConfigureArg "--with-extra-cflags=" "'${fdebug_flags}'"
191-
addConfigureArg "--with-extra-cxxflags=" "'${fdebug_flags}'"
192134
fi
193135
}
194136

tooling/reproducible/comparable_patch.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ echo " PATCH_VS_VERSION_INFO=$PATCH_VS_VERSION_INFO"
8686
# Remove excluded files known to differ
8787
# NOTICE - Vendor specfic notice text file
8888
# cacerts - Vendors use different cacerts
89+
# classlist - Used to generate CDS archives, can vary due to different build machine environment
8990
# classes.jsa, classes_nocoops.jsa - CDS archive caches will differ due to Vendor string differences
9091
function removeExcludedFiles() {
91-
excluded="NOTICE cacerts classes.jsa classes_nocoops.jsa"
92+
excluded="NOTICE cacerts classlist classes.jsa classes_nocoops.jsa"
9293

9394
echo "Removing excluded files known to differ: ${excluded}"
9495
for exclude in $excluded
@@ -97,7 +98,7 @@ function removeExcludedFiles() {
9798
for f in $FILES
9899
do
99100
echo "Removing $f"
100-
rm "$f"
101+
rm -f "$f"
101102
done
102103
done
103104

@@ -109,9 +110,8 @@ function removeExcludedFiles() {
109110
# - ModuleResolution:
110111
# - ModuleTarget:
111112
# java.base also requires the dependent module "hash:" values to be excluded
112-
# as they differ due to the Signatures
113+
# as they differ due to the Signatures and Vendor string differences
113114
function processModuleInfo() {
114-
if [[ "$OS" =~ CYGWIN* ]] || [[ "$OS" =~ Darwin* ]]; then
115115
echo "Normalizing ModuleAttributes order in module-info.class, converting to javap"
116116

117117
moduleAttr="ModuleResolution ModuleTarget"
@@ -180,7 +180,6 @@ function processModuleInfo() {
180180
rm -f "$f.javap.$attr"
181181
done
182182
done
183-
fi
184183
}
185184

186185
# Process SystemModules classes to remove ModuleHashes$Builder differences due to Signatures
@@ -531,11 +530,11 @@ processModuleInfo
531530
if [[ "$OS" =~ CYGWIN* ]] && [[ "$PATCH_VS_VERSION_INFO" = true ]]; then
532531
# Neutralise COMPANY_NAME
533532
neutraliseVsVersionInfo
534-
535-
# SystemModules$*.class's differ due to hash differences from COMPANY_NAME
536-
removeSystemModulesHashBuilderParams
537533
fi
538534

535+
# SystemModules$*.class's differ due to hash differences from COMPANY_NAME
536+
removeSystemModulesHashBuilderParams
537+
539538
if [[ "$OS" =~ CYGWIN* ]]; then
540539
removeWindowsNonComparableData
541540
fi

tooling/reproducible/repro_common.sh

+8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ function expandJDK() {
6565
unzip -d "${JDK_DIR}/jmods/expanded_java.base.jmod/lib/jrt-fs-expanded" "${JDK_DIR}/jmods/expanded_java.base.jmod/lib/jrt-fs.jar" 1> /dev/null
6666
rm "${JDK_DIR}/jmods/expanded_java.base.jmod/lib/jrt-fs.jar"
6767

68+
echo "Expanding 'ct.sym' to workaround zip timestamp differences (https://bugs.openjdk.org/browse/JDK-8327466)"
69+
mkdir "${JDK_DIR}/lib/ct-sym-expanded"
70+
unzip -d "${JDK_DIR}/lib/ct-sym-expanded" "${JDK_DIR}/lib/ct.sym" 1> /dev/null
71+
rm "${JDK_DIR}/lib/ct.sym"
72+
mkdir -p "${JDK_DIR}/jmods/expanded_jdk.compiler.jmod/lib/ct-sym-expanded"
73+
unzip -d "${JDK_DIR}/jmods/expanded_jdk.compiler.jmod/lib/ct-sym-expanded" "${JDK_DIR}/jmods/expanded_jdk.compiler.jmod/lib/ct.sym" 1> /dev/null
74+
rm "${JDK_DIR}/jmods/expanded_jdk.compiler.jmod/lib/ct.sym"
75+
6876
rm -rf "${JDK_ROOT}_CP"
6977
}
7078

0 commit comments

Comments
 (0)