Skip to content

Commit fd0abf8

Browse files
authored
chore: misc sysroot updates (#44)
* 6198526: [Sysroot] Fix missing libgcc.a on i386 https://chromium-review.googlesource.com/c/chromium/src/+/6198526 * 6200895: [Sysroot] Fix circular symlink https://chromium-review.googlesource.com/c/chromium/src/+/6200895 * 6218214: Remove ppc64le localentry element in glibc reversion script https://chromium-review.googlesource.com/c/chromium/src/+/6218214 * 6260961: Fix build/linux/sysroot_scripts/update-archive-timestamp.sh https://chromium-review.googlesource.com/c/chromium/src/+/6260961 * 6263052: [Sysroot] Preserve files need to pass basic compiler sanity check https://chromium-review.googlesource.com/c/chromium/src/+/6263052 * 6190511: [Sysroot] Add packages for building Mutter https://chromium-review.googlesource.com/c/chromium/src/+/6190511
1 parent 381c55e commit fd0abf8

File tree

10 files changed

+3868
-2410
lines changed

10 files changed

+3868
-2410
lines changed

build/linux/sysroot_scripts/generated_package_lists/bullseye.amd64

Lines changed: 643 additions & 637 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.arm64

Lines changed: 642 additions & 343 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.armhf

Lines changed: 637 additions & 365 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.i386

Lines changed: 640 additions & 344 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.mips64el

Lines changed: 634 additions & 343 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.mipsel

Lines changed: 634 additions & 372 deletions
Large diffs are not rendered by default.

build/linux/sysroot_scripts/generated_package_lists/bullseye.ppc64el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/a/acl/libacl1_2.2.53-10_ppc64el.deb
32
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/a/adduser/adduser_3.118+deb11u1_all.deb
43
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/a/adwaita-icon-theme/adwaita-icon-theme_3.38.0-1_all.deb
@@ -278,6 +277,9 @@ https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libj/libjp
278277
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libj/libjsoncpp/libjsoncpp-dev_1.9.4-4_ppc64el.deb
279278
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libj/libjsoncpp/libjsoncpp24_1.9.4-4_ppc64el.deb
280279
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libm/libmd/libmd0_1.0.3-3_ppc64el.deb
280+
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libn/libnotify/gir1.2-notify-0.7_0.7.9-3_ppc64el.deb
281+
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libn/libnotify/libnotify-dev_0.7.9-3_ppc64el.deb
282+
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libn/libnotify/libnotify4_0.7.9-3_ppc64el.deb
281283
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libn/libnsl/libnsl-dev_1.3.0-2_ppc64el.deb
282284
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libn/libnsl/libnsl2_1.3.0-2_ppc64el.deb
283285
https://snapshot.debian.org/archive/debian/20250129T203412Z/pool/main/libo/libogg/libogg-dev_1.3.4-0.1_ppc64el.deb

build/linux/sysroot_scripts/reversion_glibc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ def reversion_glibc(bin_file: str) -> None:
3939
["readelf", "--dyn-syms", "--wide", bin_file])
4040
for line in stdout.decode("utf-8").split("\n"):
4141
cols = re.split("\s+", line)
42+
# Remove localentry and next element which appears only in ppc64le
43+
# readelf output. Keeping them causes incorrect symbol parsing
44+
# leading to improper GLIBC version restrictions.
45+
if len(cols) > 7 and cols[7] == "[<localentry>:":
46+
cols.pop(7)
47+
cols.pop(7)
4248
# Skip the preamble.
4349
if len(cols) < 9:
4450
continue

build/linux/sysroot_scripts/sysroot_creator.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# gpg keyring file generated using generate_keyring.sh
3737
KEYRING_FILE = os.path.join(SCRIPT_DIR, "keyring.gpg")
3838

39-
ARCHIVE_TIMESTAMP = "20230611T210420Z"
39+
ARCHIVE_TIMESTAMP = "20250129T203412Z"
4040

4141
ARCHIVE_URL = f"https://snapshot.debian.org/archive/debian/{ARCHIVE_TIMESTAMP}/"
4242
APT_SOURCES_LIST = [
@@ -81,6 +81,7 @@
8181
"libbluetooth-dev",
8282
"libc6-dev",
8383
"libcap-dev",
84+
"libcolord-dev",
8485
"libcups2-dev",
8586
"libcupsimage2-dev",
8687
"libcurl4-gnutls-dev",
@@ -98,8 +99,10 @@
9899
"libjpeg-dev",
99100
"libjsoncpp-dev",
100101
"libkrb5-dev",
102+
"liblcms2-dev",
101103
"liblzma-dev",
102104
"libminizip-dev",
105+
"libmtdev-dev",
103106
"libncurses-dev",
104107
"libnss3-dev",
105108
"libopus-dev",
@@ -434,6 +437,9 @@ def hacks_and_patches(install_root: str, script_dir: str, arch: str) -> None:
434437
replace_in_file(gtk4_pc, r"pango [>=0-9. ]*", "pango")
435438
replace_in_file(gtk4_pc, r"pangocairo [>=0-9. ]*", "pangocairo")
436439

440+
# Remove a cyclic symlink: /usr/bin/X11 -> /usr/bin
441+
os.remove(os.path.join(install_root, "usr/bin/X11"))
442+
437443

438444
def replace_in_file(file_path: str, search_pattern: str,
439445
replace_pattern: str) -> None:
@@ -560,13 +566,17 @@ def removing_unnecessary_files(install_root, arch):
560566
Minimizes the sysroot by removing unnecessary files.
561567
"""
562568
# Preserve these files.
569+
gcc_triple = "i686-linux-gnu" if arch == "i386" else TRIPLES[arch]
563570
ALLOWLIST = {
564571
"usr/bin/cups-config",
565-
f"usr/lib/gcc/{TRIPLES[arch]}/10/libgcc.a",
572+
f"usr/lib/gcc/{gcc_triple}/10/libgcc.a",
566573
f"usr/lib/{TRIPLES[arch]}/libc_nonshared.a",
567574
f"usr/lib/{TRIPLES[arch]}/libffi_pic.a",
568575
}
569576

577+
for file in ALLOWLIST:
578+
assert os.path.exists(os.path.join(install_root, file))
579+
570580
# Remove all executables and static libraries, and any symlinks that
571581
# were pointing to them.
572582
reverse_links = collections.defaultdict(list)
@@ -594,8 +604,15 @@ def removing_unnecessary_files(install_root, arch):
594604
def strip_sections(install_root: str, arch: str):
595605
"""
596606
Strips all sections from ELF files except for dynamic linking and
597-
essential sections. Skips static libraries (.a) and object files (.o).
607+
essential sections. Skips static libraries (.a), object files (.o), and a
608+
few files used by other Chromium-related projects.
598609
"""
610+
PRESERVED_FILES = (
611+
'libc-2.31.so',
612+
'libm-2.31.so',
613+
'ld-2.31.so',
614+
)
615+
599616
PRESERVED_SECTIONS = {
600617
".dynamic",
601618
".dynstr",
@@ -608,9 +625,14 @@ def strip_sections(install_root: str, arch: str):
608625
".note.gnu.build-id",
609626
}
610627

628+
preserved_files_count = 0
629+
lib_arch_path = os.path.join(install_root, "lib", TRIPLES[arch])
611630
for root, _, files in os.walk(install_root):
612631
for file in files:
613632
file_path = os.path.join(root, file)
633+
if file_path.startswith(lib_arch_path) and file in PRESERVED_FILES:
634+
preserved_files_count += 1
635+
continue
614636

615637
if (os.access(file, os.X_OK) or file.endswith((".a", ".o"))
616638
or os.path.islink(file_path)):
@@ -646,6 +668,8 @@ def strip_sections(install_root: str, arch: str):
646668
for section in sections_to_remove
647669
] + [file_path])
648670
subprocess.run(objcopy_cmd, check=True, stderr=subprocess.PIPE)
671+
if preserved_files_count != len(PRESERVED_FILES):
672+
raise Exception("Expected file to preserve missing")
649673

650674

651675
def record_metadata(install_root: str) -> dict[str, tuple[float, float]]:

build/linux/sysroot_scripts/update-archive-timestamp.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ARCHIVE_URL="http://snapshot.debian.org/archive/debian"
1212
# Use 9999-01-01 as the date so that we get a redirect to the page with the
1313
# latest timestamp.
1414
TIMESTAMP=$(curl -s "${ARCHIVE_URL}/99990101T000000Z/pool/" | \
15-
sed -n "s|.*${ARCHIVE_URL}/\([[:digit:]TZ]\+\)/pool/.*|\1|p" | head -n 1)
15+
sed -n "s|.*/archive/debian/\([[:digit:]TZ]\+\)/pool/.*|\1|p" | head -n 1)
1616

17-
sed -i "s/ARCHIVE_TIMESTAMP=.*$/ARCHIVE_TIMESTAMP=${TIMESTAMP}/" \
17+
sed -i "s/ARCHIVE_TIMESTAMP = .*$/ARCHIVE_TIMESTAMP = \"${TIMESTAMP}\"/" \
1818
"${SCRIPT_DIR}"/sysroot_creator.py

0 commit comments

Comments
 (0)