Skip to content

Commit 68d56d5

Browse files
chromium: Fix incremental build error after meta-clang update (#814)
Fixes #794. Build and patch changes: ------------------------ We previously created a symlink pointing to the subdirectory of the latest version under $STAGING_LIBDIR_NATIVE/clang, and then copied the libclang_rt.builtins library from $STAGING_LIBDIR/clang to the same directory as the native library. This is necessary because we need to point Chromium to a single clang directory for building both native and target code, and we need its path to be independent of the specific clang version used. However, the chosen approach leads to an error when doing a build, updating meta-clang to a revision containing a new version of clang, and then doing an incremental build. This commit replaces the previous approach with a more safe one that does a full copy of the $STAGING_LIBDIR_NATIVE/clang subdirectory that we want to point Chromium to, and then copies the libclang_rt.builtins library for the target architecture to this copied directory. License changes: ---------------- Added licenses: none. Removed licenses: none. Updated licenses: none. Test-built: ----------- * chromium-x11: - master, clang, MACHINE=qemuarm64 Signed-off-by: Max Ihlenfeldt <[email protected]>
1 parent d8bcd04 commit 68d56d5

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

meta-chromium/recipes-browser/chromium/chromium-gn.inc

+18-15
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ GN_ARGS += ' \
289289
'
290290

291291
# Make sure Chromium is able to find clang libraries. See
292-
# 0023-Use-the-correct-path-to-libclang_rt.builtins.a.patch and the
293-
# add_clang_symlink and copy_clang_library tasks for more context.
292+
# 0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch and the
293+
# add_clang_latest and copy_clang_library tasks for more context.
294294
GN_ARGS += ' \
295295
clang_base_path="${@clang_install_path(d)}" \
296296
clang_version="latest" \
@@ -436,33 +436,36 @@ do_add_nodejs_symlink () {
436436
}
437437
addtask add_nodejs_symlink after do_configure before do_compile
438438

439-
do_add_clang_symlink () {
440-
# Creates a `latest` symlink in the native sysroot's /usr/lib/clang
441-
# directory that points to /usr/lib/clang/$CLANG_VERSION. Chromium manually
442-
# links against libclang_rt.builtins.a and uses the `clang_version` GN
443-
# variable to find it. This allows us to set it to the same value for all
439+
do_add_clang_latest () {
440+
# Creates a `latest` directory in the native sysroot's /usr/lib/clang
441+
# directory that is a copy of /usr/lib/clang/$CLANG_VERSION. Chromium
442+
# manually links against libclang_rt.builtins.a and uses the `clang_version`
443+
# GN variable to find it. This allows us to set it to the same value for all
444444
# Yocto releases.
445445
cd "${STAGING_LIBDIR_NATIVE}/clang"
446+
rm -rf latest
446447
# find the directory containing the library
447448
for dir in *; do
448449
if [ -n "$(find $dir -name 'libclang_rt.builtins*')" ] ; then
449-
ln -sf "$dir" latest
450+
cp -r "$dir" latest
450451
break
451452
fi
452453
done
453454
}
454-
addtask add_clang_symlink after do_configure before do_compile
455+
addtask add_clang_latest after do_configure before do_compile
455456

456457
do_copy_clang_library () {
457458
# Chromium needs to link against libclang_rt.builtins.a for both host and
458459
# target code, and expects to find both libraries in the same directory
459-
# (thanks to 0023-Use-the-correct-path-to-libclang_rt.builtins.a.patch).
460-
cd "${STAGING_LIBDIR}"
461-
lib_file="$(find clang -name 'libclang_rt.builtins*')"
462-
lib_dir="$(dirname $lib_file)"
463-
cp "$lib_file" "${STAGING_LIBDIR_NATIVE}/$lib_dir"
460+
# (thanks to 0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch).
461+
cd "${STAGING_LIBDIR}/clang"
462+
# lib_file = "./$CLANG_VERSION/lib/linux/libclang_rt.builtins-$ARCH.a"
463+
lib_file="$(find . -name 'libclang_rt.builtins*')"
464+
# stripped_lib_file = "lib/linux/libclang_rt.builtins-$ARCH.a"
465+
stripped_lib_file="${lib_file#*/*/}"
466+
cp "$lib_file" "${STAGING_LIBDIR_NATIVE}/clang/latest/${stripped_lib_file}"
464467
}
465-
addtask copy_clang_library after do_configure before do_compile
468+
addtask copy_clang_library after do_add_clang_latest before do_compile
466469

467470
do_copy_target_rustlibs () {
468471
# Chromium needs a single Rust sysroot that contains the rustlibs for both

0 commit comments

Comments
 (0)