meta-browser icon indicating copy to clipboard operation
meta-browser copied to clipboard

chromium-x11 build error with Rust enabled

Open MaxIhlenfeldt opened this issue 11 months ago • 52 comments

Original: https://lists.openembedded.org/g/openembedded-devel/message/109009


Hi,

since commit 0438fba4e773824fd2b41ded2728076deeeedeb1 ("chromium: Enable Rust") in meta-browser, I get this error on several different chromium-x11 builds (i.e. Fedora 33 and Fedora 39 hosts, mickledore and nanbield Yocto versions):

| FAILED: obj/build/rust/std/target.json obj/build/rust/std/lib/libstd.rlib obj/build/rust/std/lib/liballoc.rlib obj/build/rust/std/lib/libcfg_if.rlib obj/build/rust/std/lib/libcompiler_builtins.rlib obj/build/rust/std/lib/libcore.rlib obj/build/rust/std/lib/libgetopts.rlib obj/build/rust/std/lib/libhashbrown.rlib obj/build/rust/std/lib/liblibc.rlib obj/build/rust/std/lib/libpanic_abort.rlib obj/build/rust/std/lib/libpanic_unwind.rlib obj/build/rust/std/lib/librustc_demangle.rlib obj/build/rust/std/lib/libstd_detect.rlib obj/build/rust/std/lib/libtest.rlib obj/build/rust/std/lib/libunicode_width.rlib obj/build/rust/std/lib/libunwind.rlib obj/build/rust/std/lib/libaddr2line.rlib obj/build/rust/std/lib/libadler.rlib obj/build/rust/std/lib/libgimli.rlib obj/build/rust/std/lib/libmemchr.rlib obj/build/rust/std/lib/libminiz_oxide.rlib obj/build/rust/std/lib/libobject.rlib obj/build/rust/std/lib/libprofiler_builtins.rlib obj/build/rust/std/lib/librustc_std_workspace_alloc.rlib obj/build/rust/std/lib/librustc_std_workspace_core.rlib obj/build/rust/std/lib/librustc_std_workspace_std.rlib
| python3 ../../build/rust/std/find_std_rlibs.py --rust-bin-dir ../../../recipe-sysroot-native/usr/bin --output obj/build/rust/std --depfile obj/build/rust/std/stdlib.d --depfile-target std --rustc-revision custom --target x86_64-oe-linux-gnu
| Traceback (most recent call last):
|   File "/home/zozo/test-yocto-4.2-gh/tmp-sicom-glibc/work/corei7-64-oe-linux/chromium-x11/120.0.6099.224-r0/chromium-120.0.6099.224/out/Release/../../build/rust/std/find_std_rlibs.py", line 139, in <module>
|     sys.exit(main())
|              ^^^^^^
|   File "/home/zozo/test-yocto-4.2-gh/tmp-sicom-glibc/work/corei7-64-oe-linux/chromium-x11/120.0.6099.224-r0/chromium-120.0.6099.224/out/Release/../../build/rust/std/find_std_rlibs.py", line 104, in main
|     (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 2)
|                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| AttributeError: 'NoneType' object has no attribute 'group'

Obviously, using the previous commit works.

Best regards, Zoltán Böszörményi

MaxIhlenfeldt avatar Feb 28 '24 14:02 MaxIhlenfeldt

Hm, this should be avoided by this part of our changes to the Rust recipe.

Can you please run recipe-sysroot-native/usr/bin/rustc --print target-libdir --target x86_64-oe-linux-gnu and paste the output here? It should be a directory path. Please also paste the contents of that directory, it should contain some .rlib files (maybe other files as well).

MaxIhlenfeldt avatar Feb 28 '24 14:02 MaxIhlenfeldt

Sorry for the belated response.

Here's what you asked for:

$ bitbake -c configure chromium-x11
$ bitbake -c devshell chromium-x11
# cd ..
#
# recipe-sysroot-native/usr/bin/rustc --print target-libdir --target x86_64-oe-linux-gnu | sed "s:$(pwd)/::"
couldn't allocate absolute path for 'null'.
recipe-sysroot-native/usr/lib/rustlib/x86_64-oe-linux-gnu/lib
#
# ls -l recipe-sysroot-native/usr/lib/rustlib/x86_64-oe-linux-gnu/lib
total 344884
-rw-r--r--. 1 1000 1001   485554 Feb 23 07:51 libaddr2line-be0c663ce75d21b3.rlib
-rw-r--r--. 1 1000 1001   420614 Feb 23 07:51 libaddr2line-be0c663ce75d21b3.rmeta
-rw-r--r--. 1 1000 1001   482642 Feb 23 07:51 libaddr2line-da7edd4b0fb2f538.rlib
-rw-r--r--. 1 1000 1001    64110 Feb 23 07:51 libadler-2193210a0e3dc701.rlib
-rw-r--r--. 1 1000 1001    63294 Feb 23 07:51 libadler-fa3352091a24c57c.rlib
-rw-r--r--. 1 1000 1001    25667 Feb 23 07:51 libadler-fa3352091a24c57c.rmeta
-rw-r--r--. 1 1000 1001  6853834 Feb 23 07:51 liballoc-a17efbbf320010bd.rlib
-rw-r--r--. 1 1000 1001  6451658 Feb 23 07:51 liballoc-a17efbbf320010bd.rmeta
-rw-r--r--. 1 1000 1001  6854214 Feb 23 07:51 liballoc-a608e601203ab652.rlib
-rw-r--r--. 1 1000 1001     9358 Feb 23 07:51 libcfg_if-4843d3f6775c0073.rlib
-rw-r--r--. 1 1000 1001     6333 Feb 23 07:51 libcfg_if-4843d3f6775c0073.rmeta
-rw-r--r--. 1 1000 1001     9582 Feb 23 07:51 libcfg_if-4e6b07cdbeb0df31.rlib
-rw-r--r--. 1 1000 1001  1863820 Feb 23 07:51 libcompiler_builtins-a02735b1346e2f24.rlib
-rw-r--r--. 1 1000 1001  1549882 Feb 23 07:51 libcompiler_builtins-d102db5c0fcf1e8b.rlib
-rw-r--r--. 1 1000 1001   813239 Feb 23 07:51 libcompiler_builtins-d102db5c0fcf1e8b.rmeta
-rw-r--r--. 1 1000 1001 62227814 Feb 23 07:51 libcore-b7401c14f096a3aa.rlib
-rw-r--r--. 1 1000 1001 59980565 Feb 23 07:51 libcore-b7401c14f096a3aa.rmeta
-rw-r--r--. 1 1000 1001 62225718 Feb 23 07:51 libcore-f5f014003c697bc2.rlib
-rw-r--r--. 1 1000 1001   665932 Feb 23 07:51 libgetopts-606aca4c2c7df2df.rlib
-rw-r--r--. 1 1000 1001   662438 Feb 23 07:51 libgetopts-b00b6b8ac91e0c9d.rlib
-rw-r--r--. 1 1000 1001   221573 Feb 23 07:51 libgetopts-b00b6b8ac91e0c9d.rmeta
-rw-r--r--. 1 1000 1001  7924538 Feb 23 07:51 libgimli-76b1b03e119df45f.rlib
-rw-r--r--. 1 1000 1001  7823948 Feb 23 07:51 libgimli-daac806e2961b0e6.rlib
-rw-r--r--. 1 1000 1001  6505843 Feb 23 07:51 libgimli-daac806e2961b0e6.rmeta
-rw-r--r--. 1 1000 1001  1596512 Feb 23 07:51 libhashbrown-228fb2f117043106.rlib
-rw-r--r--. 1 1000 1001  1578590 Feb 23 07:51 libhashbrown-228fb2f117043106.rmeta
-rw-r--r--. 1 1000 1001  1617576 Feb 23 07:51 libhashbrown-6a082f942cc46845.rlib
-rw-r--r--. 1 1000 1001  3437658 Feb 23 07:51 liblibc-420faeb0913adfda.rlib
-rw-r--r--. 1 1000 1001  3329618 Feb 23 07:51 liblibc-db9329a966947adb.rlib
-rw-r--r--. 1 1000 1001  3156727 Feb 23 07:51 liblibc-db9329a966947adb.rmeta
-rw-r--r--. 1 1000 1001  1380728 Feb 23 07:51 libmemchr-36971b5e7d224c20.rlib
-rw-r--r--. 1 1000 1001  1371082 Feb 23 07:51 libmemchr-c7f9a3b1fcf752be.rlib
-rw-r--r--. 1 1000 1001  1061153 Feb 23 07:51 libmemchr-c7f9a3b1fcf752be.rmeta
-rw-r--r--. 1 1000 1001  1026184 Feb 23 07:51 libminiz_oxide-0a5886c379b738c4.rlib
-rw-r--r--. 1 1000 1001   552365 Feb 23 07:51 libminiz_oxide-0a5886c379b738c4.rmeta
-rw-r--r--. 1 1000 1001  1038398 Feb 23 07:51 libminiz_oxide-50cc4c2c2f6a52d7.rlib
-rw-r--r--. 1 1000 1001  9325320 Feb 23 07:51 libobject-ab0a9ca01b7647bc.rlib
-rw-r--r--. 1 1000 1001  8325350 Feb 23 07:51 libobject-ab0a9ca01b7647bc.rmeta
-rw-r--r--. 1 1000 1001  9497756 Feb 23 07:51 libobject-daa305bc52ad7031.rlib
-rw-r--r--. 1 1000 1001     9924 Feb 23 07:51 libpanic_abort-0f6f463943ee2ff4.rlib
-rw-r--r--. 1 1000 1001    11164 Feb 23 07:51 libpanic_abort-ea4ad6e88ebebb32.rlib
-rw-r--r--. 1 1000 1001     3806 Feb 23 07:51 libpanic_abort-ea4ad6e88ebebb32.rmeta
-rw-r--r--. 1 1000 1001    33306 Feb 23 07:51 libpanic_unwind-8d3e1ae6c5d7411d.rlib
-rw-r--r--. 1 1000 1001    33094 Feb 23 07:51 libpanic_unwind-fda7bb45ddc631c4.rlib
-rw-r--r--. 1 1000 1001    10540 Feb 23 07:51 libpanic_unwind-fda7bb45ddc631c4.rmeta
-rw-r--r--. 1 1000 1001  4194712 Feb 23 07:51 libproc_macro-18e01331508bf76e.rlib
-rw-r--r--. 1 1000 1001  2035619 Feb 23 07:51 libproc_macro-18e01331508bf76e.rmeta
-rw-r--r--. 1 1000 1001  4196046 Feb 23 07:51 libproc_macro-fb0cd9df737071e6.rlib
-rw-r--r--. 1 1000 1001   412312 Feb 23 07:51 libprofiler_builtins-2343b69abf0721ce.rlib
-rw-r--r--. 1 1000 1001   582734 Feb 23 07:51 librustc_demangle-1aa2102130837de6.rlib
-rw-r--r--. 1 1000 1001   252427 Feb 23 07:51 librustc_demangle-1aa2102130837de6.rmeta
-rw-r--r--. 1 1000 1001   585434 Feb 23 07:51 librustc_demangle-fde8bc8ef3271329.rlib
-rw-r--r--. 1 1000 1001     4924 Feb 23 07:51 librustc_std_workspace_alloc-2585aa3810aa2c06.rlib
-rw-r--r--. 1 1000 1001     1799 Feb 23 07:51 librustc_std_workspace_alloc-2585aa3810aa2c06.rmeta
-rw-r--r--. 1 1000 1001     5132 Feb 23 07:51 librustc_std_workspace_alloc-ebedea0f3fa3631e.rlib
-rw-r--r--. 1 1000 1001     6458 Feb 23 07:51 librustc_std_workspace_core-81b145b7a9d5f231.rlib
-rw-r--r--. 1 1000 1001     3346 Feb 23 07:51 librustc_std_workspace_core-81b145b7a9d5f231.rmeta
-rw-r--r--. 1 1000 1001     6642 Feb 23 07:51 librustc_std_workspace_core-98a56c211caacfca.rlib
-rw-r--r--. 1 1000 1001     8288 Feb 23 07:51 librustc_std_workspace_std-21e332a12682ae31.rlib
-rw-r--r--. 1 1000 1001     8080 Feb 23 07:51 librustc_std_workspace_std-2cd73d2033dc872a.rlib
-rw-r--r--. 1 1000 1001     4970 Feb 23 07:51 librustc_std_workspace_std-2cd73d2033dc872a.rmeta
-rw-r--r--. 1 1000 1001 14938972 Feb 23 07:51 libstd-8081e30d4b010b76.rlib
-rwxr-xr-x. 1 1000 1001  6234640 Feb 23 07:51 libstd-8081e30d4b010b76.so
-rw-r--r--. 1 1000 1001   492760 Feb 23 07:51 libstd_detect-e53a043760204932.rlib
-rw-r--r--. 1 1000 1001   492680 Feb 23 07:51 libstd_detect-e7b1257019f45248.rlib
-rw-r--r--. 1 1000 1001   448698 Feb 23 07:51 libstd_detect-e7b1257019f45248.rmeta
-rw-r--r--. 1 1000 1001 14943928 Feb 23 07:51 libstd.rlib
-rwxr-xr-x. 1 1000 1001  6233496 Feb 23 07:51 libstd.so
-rw-r--r--. 1 1000 1001  4752710 Feb 23 07:51 libtest-115063b9d157dd31.rlib
-rwxr-xr-x. 1 1000 1001  1208720 Feb 23 07:51 libtest-115063b9d157dd31.so
-rw-r--r--. 1 1000 1001  4751712 Feb 23 07:51 libtest.rlib
-rwxr-xr-x. 1 1000 1001  3040120 Feb 23 07:51 libtest.so
-rw-r--r--. 1 1000 1001   146520 Feb 23 07:51 libunicode_width-14fa0c191df006c7.rlib
-rw-r--r--. 1 1000 1001   145944 Feb 23 07:51 libunicode_width-ce20be7323b234fd.rlib
-rw-r--r--. 1 1000 1001   128614 Feb 23 07:51 libunicode_width-ce20be7323b234fd.rmeta
-rw-r--r--. 1 1000 1001    46672 Feb 23 07:51 libunwind-26f0ecf2ae276e3d.rlib
-rw-r--r--. 1 1000 1001    46496 Feb 23 07:51 libunwind-6d9f4c74674870f7.rlib
-rw-r--r--. 1 1000 1001    37212 Feb 23 07:51 libunwind-6d9f4c74674870f7.rmeta
drwxr-xr-x. 2 1000 1001     4096 Feb 23 07:51 self-contained

zboszor avatar Mar 08 '24 08:03 zboszor

Hm, I think I know what the problem might be. Are you building for x64 on an x64 machine, i.e. not cross-compiling?

MaxIhlenfeldt avatar Mar 13 '24 10:03 MaxIhlenfeldt

Hm, I think I know what the problem might be. Are you building for x64 on an x64 machine, i.e. not cross-compiling?

Correct. But it should still be cross-compiling.

zboszor avatar Mar 13 '24 11:03 zboszor

How is it cross-compiling when host and target architecture are the same?

In any case, can you please check if applying the following diff fixes the error:

diff --git a/meta-chromium/recipes-browser/chromium/rust_%.bbappend b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
index d103e69..1e139f3 100644
--- a/meta-chromium/recipes-browser/chromium/rust_%.bbappend
+++ b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
@@ -16,6 +16,12 @@ rust_do_install:class-target:append() {
     tar -C _dist -xf build/dist/rust-std-${PV}-${RUST_TARGET_SYS}.tar.xz $rlib_path

     target_dir=${D}${libdir}/rustlib
+
+    # If we're not cross-compiling, target_dir might already be populated, but
+    # not with the contents we want. See
+    # https://github.com/OSSystems/meta-browser/issues/792.
+    rm -rf $target_dir
+
     install -d $target_dir
     cp -r _dist/$rlib_path/${RUST_TARGET_SYS} $target_dir
     rm -rf _dist

MaxIhlenfeldt avatar Mar 14 '24 14:03 MaxIhlenfeldt

How is it cross-compiling when host and target architecture are the same?

Cross-compiling in Yocto is not just about a different CPU architecture, it's also about targetting a different OS altogether, that uses a different GLIBC version.

In any case, can you please check if applying the following diff fixes the error:

I will test it, thanks.

zboszor avatar Mar 14 '24 14:03 zboszor

It didn't help under mickledore. The same error occurred.

I am trying under nanbield now.

zboszor avatar Mar 14 '24 14:03 zboszor

Did you do a full, clean build? I noticed when working on the patch to enable Rust that changes to the .bbappend file don't always get picked up and applied.

MaxIhlenfeldt avatar Mar 14 '24 14:03 MaxIhlenfeldt

I will try a clean build then.

zboszor avatar Mar 14 '24 14:03 zboszor

It didn't help. I tried this:

bitbake -c cleanall rust-native rust-llvm-native rust rust-llvm gn-native chromium-x11
bitbake -c compile chromium-x11

Same error.

zboszor avatar Mar 14 '24 18:03 zboszor

Does ls -l recipe-sysroot-native/usr/lib/rustlib/x86_64-oe-linux-gnu/lib still show the same directory contents?

MaxIhlenfeldt avatar Mar 20 '24 11:03 MaxIhlenfeldt

FWIW, I have run repo sync for a fresh test, so it's chromium-x11 version 121.0.6167.184 now.

The directory contents are not the same.

Also, for some reason, there is no --target x86_64-oe-linux-gnu now. Instead, there is --target x86_64-unknown-linux-gnu.

Here's the directory contents for mickledore:

# ls -l recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib
total 126832
-rw-r--r--. 5 1000 1001   483058 Mar 21 10:35 libaddr2line-b3ba246e740afe80.rlib
-rw-r--r--. 5 1000 1001    64974 Mar 21 10:35 libadler-bbf256bbe8778f92.rlib
-rw-r--r--. 5 1000 1001  6860366 Mar 21 10:35 liballoc-936aae53ec78ce79.rlib
-rw-r--r--. 5 1000 1001     9622 Mar 21 10:35 libcfg_if-849248fcbfb57d4a.rlib
-rw-r--r--. 5 1000 1001  1665468 Mar 21 10:35 libcompiler_builtins-2ec5c0ed3ef2fbac.rlib
-rw-r--r--. 5 1000 1001 62217482 Mar 21 10:35 libcore-4901270800bec6ad.rlib
-rw-r--r--. 5 1000 1001   668370 Mar 21 10:35 libgetopts-68c9df900475ed2b.rlib
-rw-r--r--. 5 1000 1001  7928192 Mar 21 10:35 libgimli-8b9ee3164736aa23.rlib
-rw-r--r--. 5 1000 1001  1617760 Mar 21 10:35 libhashbrown-e2d51c07b00b8a6b.rlib
-rw-r--r--. 5 1000 1001  3438354 Mar 21 10:35 liblibc-6ab72c92dff0db9b.rlib
-rw-r--r--. 5 1000 1001  1380362 Mar 21 10:35 libmemchr-49babf59ca6c80c4.rlib
-rw-r--r--. 5 1000 1001  1040632 Mar 21 10:35 libminiz_oxide-3496e818e531c81a.rlib
-rw-r--r--. 5 1000 1001  9497586 Mar 21 10:35 libobject-baf4671979453700.rlib
-rw-r--r--. 5 1000 1001     9980 Mar 21 10:35 libpanic_abort-85ccf61f7c5639c2.rlib
-rw-r--r--. 5 1000 1001    33562 Mar 21 10:35 libpanic_unwind-be905a9fdaf2d1ca.rlib
-rw-r--r--. 5 1000 1001  4189476 Mar 21 10:35 libproc_macro-a0f26b1220a72e6c.rlib
-rw-r--r--. 5 1000 1001   170232 Mar 21 10:35 libprofiler_builtins-245de444f85f5d6e.rlib
-rw-r--r--. 5 1000 1001   586512 Mar 21 10:35 librustc_demangle-3a59bbe48597eb4b.rlib
-rw-r--r--. 5 1000 1001     5164 Mar 21 10:35 librustc_std_workspace_alloc-b8efbf379069eaee.rlib
-rw-r--r--. 5 1000 1001     6690 Mar 21 10:35 librustc_std_workspace_core-5ff24a720ddda7b7.rlib
-rw-r--r--. 5 1000 1001     8328 Mar 21 10:35 librustc_std_workspace_std-fb9b2a6c67b674cf.rlib
-rw-r--r--. 5 1000 1001 14955032 Mar 21 10:35 libstd-38f48d758f4bd9f6.rlib
-rwxr-xr-x. 4 1000 1001  6243944 Mar 21 10:38 libstd-38f48d758f4bd9f6.so
-rw-r--r--. 5 1000 1001   493224 Mar 21 10:35 libstd_detect-010a824ab5df37a9.rlib
-rw-r--r--. 5 1000 1001  4787096 Mar 21 10:35 libtest-9b338978aecf41d8.rlib
-rwxr-xr-x. 4 1000 1001  1219584 Mar 21 10:38 libtest-9b338978aecf41d8.so
-rw-r--r--. 5 1000 1001   146560 Mar 21 10:35 libunicode_width-40b981f8b3d8094b.rlib
-rw-r--r--. 5 1000 1001    46736 Mar 21 10:35 libunwind-a0cbc63432f5c459.rlib

and for nanbield:

# ls -l recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib
total 119932
-rw-r--r--. 10 1000 1001   450960 Mar 21 13:54 libaddr2line-a2daade9081ae32a.rlib
-rw-r--r--. 10 1000 1001    64310 Mar 21 13:54 libadler-5b40c1d3762bf105.rlib
-rw-r--r--. 10 1000 1001  6680610 Mar 21 13:54 liballoc-d94e076697df6707.rlib
-rw-r--r--. 10 1000 1001     9598 Mar 21 13:54 libcfg_if-a13ba189ceabc5aa.rlib
-rw-r--r--. 10 1000 1001  1624834 Mar 21 13:54 libcompiler_builtins-a37d447ff9f43d61.rlib
-rw-r--r--. 10 1000 1001 58499200 Mar 21 13:54 libcore-08ada002d7296ae8.rlib
-rw-r--r--. 10 1000 1001   699320 Mar 21 13:54 libgetopts-89cd8d18b706659a.rlib
-rw-r--r--. 10 1000 1001  7122206 Mar 21 13:54 libgimli-0512ccbd2a7499d2.rlib
-rw-r--r--. 10 1000 1001  1615848 Mar 21 13:54 libhashbrown-6c124f38fcef1b87.rlib
-rw-r--r--. 10 1000 1001  3685490 Mar 21 13:54 liblibc-56e8a7f73f069ebe.rlib
-rw-r--r--. 10 1000 1001  1336470 Mar 21 13:54 libmemchr-66f5f463b5c23ed1.rlib
-rw-r--r--. 10 1000 1001   989898 Mar 21 13:54 libminiz_oxide-fbd292a712fa5921.rlib
-rw-r--r--. 10 1000 1001  8680044 Mar 21 13:54 libobject-9e334401310bf334.rlib
-rw-r--r--. 10 1000 1001     9684 Mar 21 13:54 libpanic_abort-b771eec9b0feb126.rlib
-rw-r--r--. 10 1000 1001    32882 Mar 21 13:54 libpanic_unwind-d1e19a1d9f4389d9.rlib
-rw-r--r--. 10 1000 1001  4073672 Mar 21 13:54 libproc_macro-1e61973162cf383f.rlib
-rw-r--r--. 10 1000 1001   171042 Mar 21 13:54 libprofiler_builtins-78773e035e3dc74d.rlib
-rw-r--r--. 10 1000 1001   559138 Mar 21 13:54 librustc_demangle-45e5578ce5ccb358.rlib
-rw-r--r--. 10 1000 1001     5204 Mar 21 13:54 librustc_std_workspace_alloc-d8b204e0bc283f8d.rlib
-rw-r--r--. 10 1000 1001     7026 Mar 21 13:54 librustc_std_workspace_core-c8c41820f8669080.rlib
-rw-r--r--. 10 1000 1001     8592 Mar 21 13:54 librustc_std_workspace_std-4b2a06f87e622cae.rlib
-rw-r--r--. 10 1000 1001   512464 Mar 21 13:54 libstd_detect-9960905b690242e4.rlib
-rw-r--r--. 10 1000 1001 13806534 Mar 21 13:54 libstd-f1077750b2cf6857.rlib
-rwxr-xr-x.  9 1000 1001  5768264 Mar 21 14:01 libstd-f1077750b2cf6857.so
-rw-r--r--. 10 1000 1001  4868416 Mar 21 13:54 libtest-314aab89245a6e5d.rlib
-rwxr-xr-x.  9 1000 1001  1219832 Mar 21 14:01 libtest-314aab89245a6e5d.so
-rw-r--r--. 10 1000 1001   144336 Mar 21 13:54 libunicode_width-18ebe4533666ca29.rlib
-rw-r--r--. 10 1000 1001    45264 Mar 21 13:54 libunwind-99b2ce68a0487c6a.rlib

The error is still the same for bitbake -c compile chromium-x11, but the failing command used --target x86_64-oe-linux-gnu:

| [41/63844] python3 ../../build/rust/std/find_std_rlibs.py --rust-bin-dir ../../../recipe-sysroot-native/usr/bin --output obj/build/rust/std --depfile obj/build/rust/std/stdlib.d --depfile-target std --rustc-revision custom --target x86_64-oe-linux-gnu
| FAILED: obj/build/rust/std/target.json obj/build/rust/std/lib/libstd.rlib obj/build/rust/std/lib/liballoc.rlib obj/build/rust/std/lib/libcfg_if.rlib obj/build/rust/std/lib/libcompiler_builtins.rlib obj/build/rust/std/lib/libcore.rlib obj/build/rust/std/lib/libgetopts.rlib obj/build/rust/std/lib/libhashbrown.rlib obj/build/rust/std/lib/liblibc.rlib obj/build/rust/std/lib/libpanic_abort.rlib obj/build/rust/std/lib/libpanic_unwind.rlib obj/build/rust/std/lib/librustc_demangle.rlib obj/build/rust/std/lib/libstd_detect.rlib obj/build/rust/std/lib/libtest.rlib obj/build/rust/std/lib/libunicode_width.rlib obj/build/rust/std/lib/libunwind.rlib obj/build/rust/std/lib/libaddr2line.rlib obj/build/rust/std/lib/libadler.rlib obj/build/rust/std/lib/libgimli.rlib obj/build/rust/std/lib/libmemchr.rlib obj/build/rust/std/lib/libminiz_oxide.rlib obj/build/rust/std/lib/libobject.rlib obj/build/rust/std/lib/librustc_std_workspace_alloc.rlib obj/build/rust/std/lib/librustc_std_workspace_core.rlib obj/build/rust/std/lib/librustc_std_workspace_std.rlib
| python3 ../../build/rust/std/find_std_rlibs.py --rust-bin-dir ../../../recipe-sysroot-native/usr/bin --output obj/build/rust/std --depfile obj/build/rust/std/stdlib.d --depfile-target std --rustc-revision custom --target x86_64-oe-linux-gnu
| Traceback (most recent call last):
|   File "/home/zozo/test-yocto-4.3-gh/tmp-sicom-glibc/work/corei7-64-oe-linux/chromium-x11/121.0.6167.184/chromium-121.0.6167.184/out/Release/../../build/rust/std/find_std_rlibs.py", line 139, in <module>
|     sys.exit(main())
|              ^^^^^^
|   File "/home/zozo/test-yocto-4.3-gh/tmp-sicom-glibc/work/corei7-64-oe-linux/chromium-x11/121.0.6167.184/chromium-121.0.6167.184/out/Release/../../build/rust/std/find_std_rlibs.py", line 104, in main
|     (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 2)
|                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| AttributeError: 'NoneType' object has no attribute 'group'

Now, there is x86_64-oe-linux-gnu but under recipe-sysroot, not under recipe-sysroot-native.

There (only quoting for nanbield now), the directory contents are:

# ls -l recipe-sysroot/usr/lib/rustlib/x86_64-oe-linux-gnu/lib/
total 325600
-rw-r--r--. 7 1000 1001   447568 Mar 21 14:14 libaddr2line-8ee04509bdfa6c32.rlib
-rw-r--r--. 7 1000 1001   388553 Mar 21 14:14 libaddr2line-8ee04509bdfa6c32.rmeta
-rw-r--r--. 4 1000 1001   453950 Mar 21 15:04 libaddr2line-b8d38b5ca6d623bc.rlib
-rw-r--r--. 7 1000 1001    62662 Mar 21 14:14 libadler-25833250bd0fb87d.rlib
-rw-r--r--. 7 1000 1001    24424 Mar 21 14:14 libadler-25833250bd0fb87d.rmeta
-rw-r--r--. 4 1000 1001    63478 Mar 21 15:04 libadler-abf4cc27738d91f2.rlib
-rw-r--r--. 7 1000 1001  6677676 Mar 21 14:14 liballoc-962ed5c419e54757.rlib
-rw-r--r--. 7 1000 1001  6282573 Mar 21 14:14 liballoc-962ed5c419e54757.rmeta
-rw-r--r--. 4 1000 1001  6677654 Mar 21 15:04 liballoc-eac0374294c89096.rlib
-rw-r--r--. 4 1000 1001     9574 Mar 21 15:04 libcfg_if-1d962b866acc8146.rlib
-rw-r--r--. 7 1000 1001     9350 Mar 21 14:14 libcfg_if-97fdae058a5fc559.rlib
-rw-r--r--. 7 1000 1001     6260 Mar 21 14:14 libcfg_if-97fdae058a5fc559.rmeta
-rw-r--r--. 4 1000 1001  1826322 Mar 21 15:04 libcompiler_builtins-1652bf19f06e0dbc.rlib
-rw-r--r--. 7 1000 1001  1511162 Mar 21 14:14 libcompiler_builtins-682708efb490797e.rlib
-rw-r--r--. 7 1000 1001   773825 Mar 21 14:14 libcompiler_builtins-682708efb490797e.rmeta
-rw-r--r--. 4 1000 1001 58509462 Mar 21 15:04 libcore-b7dcf9cb4b640a62.rlib
-rw-r--r--. 7 1000 1001 58514932 Mar 21 14:14 libcore-fb2a57c37364b509.rlib
-rw-r--r--. 7 1000 1001 56092401 Mar 21 14:14 libcore-fb2a57c37364b509.rmeta
-rw-r--r--. 7 1000 1001   694154 Mar 21 14:14 libgetopts-b46ba0786ad8776a.rlib
-rw-r--r--. 7 1000 1001   248473 Mar 21 14:14 libgetopts-b46ba0786ad8776a.rmeta
-rw-r--r--. 4 1000 1001   697642 Mar 21 15:04 libgetopts-bbd1d9088a5338d6.rlib
-rw-r--r--. 7 1000 1001  7019134 Mar 21 14:14 libgimli-506b3c36d5272748.rlib
-rw-r--r--. 7 1000 1001  5708075 Mar 21 14:14 libgimli-506b3c36d5272748.rmeta
-rw-r--r--. 4 1000 1001  7120042 Mar 21 15:04 libgimli-d773cf3bbafa5abd.rlib
-rw-r--r--. 7 1000 1001  1594568 Mar 21 14:14 libhashbrown-9801db76c7781ecb.rlib
-rw-r--r--. 7 1000 1001  1576452 Mar 21 14:14 libhashbrown-9801db76c7781ecb.rmeta
-rw-r--r--. 4 1000 1001  1615608 Mar 21 15:04 libhashbrown-c43ac0a3d6e50df6.rlib
-rw-r--r--. 7 1000 1001  3573594 Mar 21 14:14 liblibc-9a1a414be11f8ae9.rlib
-rw-r--r--. 7 1000 1001  3393925 Mar 21 14:14 liblibc-9a1a414be11f8ae9.rmeta
-rw-r--r--. 4 1000 1001  3685178 Mar 21 15:04 liblibc-bcca942e5c6d70a2.rlib
-rw-r--r--. 7 1000 1001  1326742 Mar 21 14:14 libmemchr-74466a117676db54.rlib
-rw-r--r--. 7 1000 1001  1014972 Mar 21 14:14 libmemchr-74466a117676db54.rmeta
-rw-r--r--. 4 1000 1001  1336300 Mar 21 15:04 libmemchr-d71ac377996c943b.rlib
-rw-r--r--. 4 1000 1001   990578 Mar 21 15:04 libminiz_oxide-10e5dad160a37250.rlib
-rw-r--r--. 7 1000 1001   978294 Mar 21 14:14 libminiz_oxide-9e2e83cdfe2b4e72.rlib
-rw-r--r--. 7 1000 1001   527498 Mar 21 14:14 libminiz_oxide-9e2e83cdfe2b4e72.rmeta
-rw-r--r--. 4 1000 1001  8683598 Mar 21 15:04 libobject-b38ca6f256c35b09.rlib
-rw-r--r--. 7 1000 1001  8511116 Mar 21 14:14 libobject-e737b1e4c83e68e1.rlib
-rw-r--r--. 7 1000 1001  7522503 Mar 21 14:14 libobject-e737b1e4c83e68e1.rmeta
-rw-r--r--. 7 1000 1001    10892 Mar 21 14:14 libpanic_abort-451cc9721852ada2.rlib
-rw-r--r--. 7 1000 1001     3435 Mar 21 14:14 libpanic_abort-451cc9721852ada2.rmeta
-rw-r--r--. 4 1000 1001     9644 Mar 21 15:04 libpanic_abort-6853e81de14016c1.rlib
-rw-r--r--. 7 1000 1001    32606 Mar 21 14:14 libpanic_unwind-13ccdf590a74e577.rlib
-rw-r--r--. 7 1000 1001     9992 Mar 21 14:14 libpanic_unwind-13ccdf590a74e577.rmeta
-rw-r--r--. 4 1000 1001    32782 Mar 21 15:04 libpanic_unwind-b66b170ab6351f0f.rlib
-rw-r--r--. 7 1000 1001  4039194 Mar 21 14:14 libproc_macro-0913d3aa763f0f83.rlib
-rw-r--r--. 7 1000 1001  1862261 Mar 21 14:14 libproc_macro-0913d3aa763f0f83.rmeta
-rw-r--r--. 4 1000 1001  4039340 Mar 21 15:04 libproc_macro-fddbb7cd547a33e1.rlib
-rw-r--r--. 4 1000 1001   414394 Mar 21 15:04 libprofiler_builtins-79512a76a864e69b.rlib
-rw-r--r--. 4 1000 1001   558720 Mar 21 15:04 librustc_demangle-2787b685e2edbabf.rlib
-rw-r--r--. 7 1000 1001   556022 Mar 21 14:14 librustc_demangle-dc0006e2db1b804a.rlib
-rw-r--r--. 7 1000 1001   227544 Mar 21 14:14 librustc_demangle-dc0006e2db1b804a.rmeta
-rw-r--r--. 7 1000 1001     4980 Mar 21 14:14 librustc_std_workspace_alloc-593585fda9cf113e.rlib
-rw-r--r--. 7 1000 1001     1789 Mar 21 14:14 librustc_std_workspace_alloc-593585fda9cf113e.rmeta
-rw-r--r--. 4 1000 1001     5172 Mar 21 15:04 librustc_std_workspace_alloc-a9ea4f89594bc4ad.rlib
-rw-r--r--. 7 1000 1001     6794 Mar 21 14:14 librustc_std_workspace_core-3c6e23a841933792.rlib
-rw-r--r--. 7 1000 1001     3621 Mar 21 14:14 librustc_std_workspace_core-3c6e23a841933792.rmeta
-rw-r--r--. 4 1000 1001     6986 Mar 21 15:04 librustc_std_workspace_core-8a8ed05c8a58baf0.rlib
-rw-r--r--. 4 1000 1001     8568 Mar 21 15:04 librustc_std_workspace_std-afcb3739af0fbd90.rlib
-rw-r--r--. 7 1000 1001     8360 Mar 21 14:14 librustc_std_workspace_std-d61a050d2873a6cf.rlib
-rw-r--r--. 7 1000 1001     5187 Mar 21 14:14 librustc_std_workspace_std-d61a050d2873a6cf.rmeta
-rw-r--r--. 4 1000 1001 13855786 Mar 21 15:04 libstd-7524cbe83be95dda.rlib
-rwxr-xr-x. 3 1000 1001  5772160 Mar 21 15:04 libstd-7524cbe83be95dda.so
-rw-r--r--. 7 1000 1001   512168 Mar 21 14:14 libstd_detect-03ce12b1636a0262.rlib
-rw-r--r--. 7 1000 1001   467177 Mar 21 14:14 libstd_detect-03ce12b1636a0262.rmeta
-rw-r--r--. 4 1000 1001   512280 Mar 21 15:04 libstd_detect-43851b7c19b5d4f8.rlib
-rw-r--r--. 7 1000 1001 13855272 Mar 21 14:14 libstd.rlib
-rwxr-xr-x. 6 1000 1001  5771112 Mar 21 14:14 libstd.so
-rw-r--r--. 4 1000 1001  4838534 Mar 21 15:04 libtest-78cdce7a40db8da5.rlib
-rwxr-xr-x. 3 1000 1001  1215888 Mar 21 15:04 libtest-78cdce7a40db8da5.so
-rw-r--r--. 7 1000 1001  4840234 Mar 21 14:14 libtest.rlib
-rwxr-xr-x. 6 1000 1001  3018848 Mar 21 14:14 libtest.so
-rw-r--r--. 7 1000 1001   143720 Mar 21 14:14 libunicode_width-94c2df26c937531a.rlib
-rw-r--r--. 7 1000 1001   126325 Mar 21 14:14 libunicode_width-94c2df26c937531a.rmeta
-rw-r--r--. 4 1000 1001   144296 Mar 21 15:04 libunicode_width-a6178fb168c0a0d7.rlib
-rw-r--r--. 4 1000 1001    45208 Mar 21 15:04 libunwind-74d673a682db49a1.rlib
-rw-r--r--. 7 1000 1001    45040 Mar 21 14:14 libunwind-78f011020e29e916.rlib
-rw-r--r--. 7 1000 1001    35695 Mar 21 14:14 libunwind-78f011020e29e916.rmeta
drwxr-xr-x. 2 1000 1001     4096 Mar 21 16:34 self-contained

EDIT: All of the above was done with the proposed patch added manually:

zozo@localhost:~/test-yocto-4.3-gh/layers/meta-browser$ git diff
diff --git a/meta-chromium/recipes-browser/chromium/rust_%.bbappend b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
index d103e69..1e139f3 100644
--- a/meta-chromium/recipes-browser/chromium/rust_%.bbappend
+++ b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
@@ -16,6 +16,12 @@ rust_do_install:class-target:append() {
     tar -C _dist -xf build/dist/rust-std-${PV}-${RUST_TARGET_SYS}.tar.xz $rlib_path
 
     target_dir=${D}${libdir}/rustlib
+
+    # If we're not cross-compiling, target_dir might already be populated, but
+    # not with the contents we want. See
+    # https://github.com/OSSystems/meta-browser/issues/792.
+    rm -rf $target_dir
+
     install -d $target_dir
     cp -r _dist/$rlib_path/${RUST_TARGET_SYS} $target_dir
     rm -rf _dist

zboszor avatar Mar 22 '24 05:03 zboszor

@MaxIhlenfeldt , I am getting build issue for internal master branch (branch having the latest meta-browser master branch all the commits), sharing the build log for reference

ERROR: chromium-x11-121.0.6167.184-r0 do_copy_target_rustlibs: ExecutionError('lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/temp/run.do_copy_target_rustlibs.710741', 1, None, None) ERROR: Logfile of failure stored in: /lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/temp/log.do_copy_target_rustlibs.710741 Log data follows: | DEBUG: Executing shell function do_copy_target_rustlibs | cp: cannot stat '/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/recipe-sysroot/usr/lib/rustlib/x86_64': No such file or directory* | WARNING:/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/temp/run.do_copy_target_rustlibs.710741:149 exit 1 from 'cp -r $rustlib_src_dir "/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/recipe-sysroot-native/usr/lib/rustlib"' | WARNING: Backtrace (BB generated script): | #1: do_copy_target_rustlibs, /lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/temp/run.do_copy_target_rustlibs.710741, line 149 | #2: main,/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/temp/run.do_copy_target_rustlibs.710741, line 152

sharing the recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/ contents too, could you please suggest how to resolve the issue ls -l recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/ total 105604 -rw-r--r-- 5 users 457828 Mar 26 13:01 libaddr2line-13b90ddabcfcdff7.rlib -rw-r--r-- 5 users 34612 Mar 26 13:01 libadler-c41e85cdd0e0dfff.rlib -rw-r--r-- 5 users 6289116 Mar 26 13:01 liballoc-bc9174b398261284.rlib -rw-r--r-- 5 users 10478 Mar 26 13:01 libcfg_if-6771b1ae9cbfc2c9.rlib -rw-r--r-- 5 users 1394422 Mar 26 13:01 libcompiler_builtins-e8cdafc9faa29ecd.rlib -rw-r--r-- 5 users 47318932 Mar 26 13:01 libcore-baa5449bbf3e5ae7.rlib -rw-r--r-- 5 users 474364 Mar 26 13:01 libgetopts-b24eeb95e8a36a72.rlib -rw-r--r-- 5 users 6120184 Mar 26 13:01 libgimli-d24d3e21c4b6d183.rlib -rw-r--r-- 5 users 1614906 Mar 26 13:01 libhashbrown-67ad1ad36ffec836.rlib -rw-r--r-- 5 users 3409146 Mar 26 13:01 liblibc-84992ee57e15ddc0.rlib -rw-r--r-- 5 users 872422 Mar 26 13:01 libmemchr-4ff2a73349a27351.rlib -rw-r--r-- 5 users 327174 Mar 26 13:01 libminiz_oxide-0f5ce74ab0128e5b.rlib -rw-r--r-- 5 users 7999318 Mar 26 13:01 libobject-45b585256bbdad6f.rlib -rw-r--r-- 5 users 10020 Mar 26 13:01 libpanic_abort-a818357d2c99a5c1.rlib -rw-r--r-- 5 users 23150 Mar 26 13:01 libpanic_unwind-56ffc7344a3fa9ec.rlib -rw-r--r-- 5 users 3393222 Mar 26 13:01 libproc_macro-897be83c186b3211.rlib -rw-r--r-- 5 users 379940 Mar 26 13:01 librustc_demangle-09fdf503f250d6a7.rlib -rw-r--r-- 5 users 5900 Mar 26 13:01 librustc_std_workspace_alloc-ab6e54dadf25bfd1.rlib -rw-r--r-- 5 users 8658 Mar 26 13:01 librustc_std_workspace_core-ce683bfa6346b7ff.rlib -rw-r--r-- 5 users 10432 Mar 26 13:01 librustc_std_workspace_std-e165636351474423.rlib -rw-r--r-- 5 users 12502812 Mar 26 13:01 libstd-64729a5a222c378b.rlib -rwxr-xr-x 4 users 9211704 Mar 26 13:01 libstd-64729a5a222c378b.so -rw-r--r-- 5 users 433536 Mar 26 13:01 libstd_detect-4c6d792e86d76f74.rlib -rw-r--r-- 5 users 5808 Mar 26 13:01 libsysroot-5e30f112053f646e.rlib -rw-r--r-- 5 users 4093024 Mar 26 13:01 libtest-2571735223127832.rlib -rwxr-xr-x 4 users 1493224 Mar 26 13:01 libtest-2571735223127832.so -rw-r--r-- 5 users 150344 Mar 26 13:01 libunicode_width-a4de7578f009194a.rlib -rw-r--r-- 5 users 41702 Mar 26 13:01 libunwind-b9b23c28f438e60f.rlib

rjanani-p avatar Mar 26 '24 13:03 rjanani-p

Could both of you please upload the output of bitbake -e chromium-x11 to e.g. https://pastebin.com/ and paste the link here?

MaxIhlenfeldt avatar Mar 27 '24 09:03 MaxIhlenfeldt

Pastebin limit is 512KB, the bitbake -e output is over 2MB in my case. Attached as gzipped here instead. chromium-x11-vars.txt.gz

zboszor avatar Mar 27 '24 11:03 zboszor

Thanks! That's helpful, but I'm still not fully sure what's going on. Could you please also attach the output of bitbake -e rust as well as the contents of temp/run.do_install for the rust recipe?

MaxIhlenfeldt avatar Mar 28 '24 10:03 MaxIhlenfeldt

Here they are. rust-vars.txt.gz log.do_install.gz

zboszor avatar Mar 28 '24 15:03 zboszor

Could both of you please upload the output of bitbake -e chromium-x11 to e.g. https://pastebin.com/ and paste the link here?

chromium-x11.txt could you please share your inputs, I have observed issue with qemux86-64,qemuarm64 targets , not facing with qemuarm.

rjanani-p avatar Apr 04 '24 03:04 rjanani-p

Thank you both! I'm still not really sure what the problem is. Do you maybe have a repo manifest you can share with me, together with all your local .conf files, so I can replicate your setup as close as possible?

MaxIhlenfeldt avatar Apr 04 '24 12:04 MaxIhlenfeldt

Not sure if this influences anything, but I also have this bbappend:

$ cat chromium-x11_%.bbappend 
PACKAGECONFIG:remove = "use-egl"
PACKAGECONFIG:append:class-target = " gtk4 proprietary-codecs cups use-vaapi "

DEPENDS:append = " wayland-protocols wayland"

RDEPENDS:${PN}:append = " gtk4-printbackend-cups "

zboszor avatar Apr 11 '24 14:04 zboszor

FWIW, the same issue occurs with Yocto 5.0 Scarthgap for us.

I can't share the whole set of layers from our manifest, as some of them are internal layers. In our internal layers, there is no bbappend against llvm, clang, rust or rust-llvm. Here's the public part of default.xml:

<manifest>
  <remote fetch="https://github.com" name="github"/>
  <remote fetch="http://git.linaro.org" name="linaro"/>
  <remote fetch="git://git.openembedded.org" name="oe"/>
  <remote fetch="http://git.yoctoproject.org/git" name="yocto"/>
  
  <default revision="scarthgap" sync-j="4"/>
  
  <project name="OSSystems/meta-browser" path="layers/meta-browser" remote="github" revision="master" />
  <project name="zboszor/meta-parallel-php" path="layers/meta-parallel-php" remote="github" />
  <project name="agherzan/meta-raspberrypi" path="layers/meta-raspberrypi" remote="github" revision="master" />
  <project name="kraj/meta-clang" path="layers/meta-clang" remote="github" revision="master" />
  <project name="meta-intel" path="layers/meta-intel" remote="yocto" />
  <project name="meta-security" path="layers/meta-security" remote="yocto" revision="master" />
  <project name="meta-yocto" path="layers/meta-yocto" remote="yocto"  />
  <project name="lucimber/meta-openjdk-temurin" path="layers/meta-openjdk-temurin" remote="github" revision="main" />
  <project name="meta-virtualization" path="layers/meta-virtualization" remote="yocto" />
  <project name="meta-cloud-services" path="layers/meta-cloud-services" remote="yocto" />
  <project name="openembedded/bitbake" path="bitbake" remote="github" revision="2.8"/>
  <project name="openembedded/meta-openembedded" path="layers/meta-openembedded" remote="github"/>
  <project name="openembedded/openembedded-core" path="layers/openembedded-core" remote="github"/>
  <project name="DynamicDevices/meta-mono" path="layers/meta-mono" remote="github" revision="master" />
  <project name="dimtass/meta-elastic-beats" path="layers/meta-elastic-beats" remote="github" revision="master"/>
  <project name="zboszor/meta-python-ai" path="layers/meta-python-ai" remote="github" />
</manifest>

Some of these layers are not officially scarthgap compatible yet. For them, the layer compatibility setting in conf/layer.conf is manually changed and nothing else.

zboszor avatar Apr 15 '24 13:04 zboszor

Thanks, I've kicked off a build that should be as close as possible as yours. Let's see whether I'll now get the error as well :crossed_fingers:

fyi, I'll be ooo for the rest of the week, but I'll get back to this next week.

MaxIhlenfeldt avatar Apr 16 '24 10:04 MaxIhlenfeldt

Hm, I get this error:

ERROR: chromium-x11-122.0.6261.128-r0 do_prepare_recipe_sysroot: The file /usr/bin/llvm-split is installed by both llvm-native and clang-native, aborting

Any idea what the difference between your setup and mine could be that leads to this, @zboszor?

MaxIhlenfeldt avatar Apr 16 '24 15:04 MaxIhlenfeldt

Hm, I get this error:

ERROR: chromium-x11-122.0.6261.128-r0 do_prepare_recipe_sysroot: The file /usr/bin/llvm-split is installed by both llvm-native and clang-native, aborting

Any idea what the difference between your setup and mine could be that leads to this, @zboszor?

It's documented in meta-clang. To replace llvm with clang, you must have these in your local configuration:

PREFERRED_PROVIDER_llvm = "clang"
PREFERRED_PROVIDER_llvm-native = "clang-native"
PREFERRED_PROVIDER_nativesdk-llvm = "nativesdk-clang"
PROVIDES:pn-clang = "llvm"
PROVIDES:pn-clang-native = "llvm-native"
PROVIDES:pn-nativesdk-clang = "nativesdk-llvm"

zboszor avatar Apr 17 '24 04:04 zboszor

Ok, I've finally been able to reproduce it. I suspect that due to the gtk4 config in your chromium-x11_%.bbappend:

PACKAGECONFIG:append:class-target = " gtk4 proprietary-codecs cups use-vaapi "

Chromium gets a new (transitive) dependency on librsvg, which uses Rust and depends on libstd-rs. Thus, we get the files from that in our sysroot even though we try to avoid it in our rust_%.bbappend.

i.e. our approach breaks as soon as we have anything inheriting the rust class (which inherits the rust-common class, which contains RUSTLIB_DEP ?= "libstd-rs"). Didn't think of that when writing that PR :sweat_smile:

I think we might be able to drop our custom rust_do_install logic, since we've decided in #791 to not require libprofiler_builtins. We could instead just patch Chromium to accept .rlib files without a metadata hash in the filename and should then be able to use the regular libstd-rs dependency.

I'll give the approach outlined above a try and will report back here.

MaxIhlenfeldt avatar Apr 22 '24 15:04 MaxIhlenfeldt

hi @MaxIhlenfeldt , above changes will fix my issue? DEBUG: Executing shell function do_copy_target_rustlibs | cp: cannot stat '/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/recipe-sysroot/usr/lib/rustlib/x86_64': No such file or directory*

rjanani-p avatar Apr 23 '24 09:04 rjanani-p

@rjanani-p I'm still working on the fix, the PACKAGECONFIG changes I mentioned in my last comment were only needed for me to reproduce the issue.

MaxIhlenfeldt avatar Apr 23 '24 11:04 MaxIhlenfeldt

@MaxIhlenfeldt , regarding DEBUG: Executing shell function do_copy_target_rustlibs | cp: cannot stat '/lincd_chromium_121/tmp-glibc/work/core2-64-wrs-linux/chromium-x11/121.0.6167.184/recipe-sysroot/usr/lib/rustlib/x86_64': No such file or directory*

I am getting above issue for 122.0.6261.128 version also for qemux86-64, intel-x86-64, qemuarm64 machines. Here I am sharing the config files, could you please share your input to reproduce the issue files are sufficient? need to provide any files? bblayers.txt local.txt

rjanani-p avatar Apr 25 '24 06:04 rjanani-p

Sorry for the delay, but I think I've finally come up with a patch that should fix this issue.

Can you please apply the following patch to meta-chromium and try if it works for you as well?

Note: please make sure the patch from https://github.com/OSSystems/meta-browser/issues/792#issuecomment-1997533575 is not applied, I don't think it's actually needed.

From 1de92536897fd90f54b0f264340426e0f5b8de29 Mon Sep 17 00:00:00 2001
From: Max Ihlenfeldt <[email protected]>
Date: Tue, 7 May 2024 14:10:26 +0000
Subject: [PATCH] chromium: Depend on libstd-rs instead of rust

---
 .../recipes-browser/chromium/chromium-gn.inc  |  2 +-
 ...9-Adjust-the-Rust-build-to-our-needs.patch | 30 +++++++++++++++----
 .../chromium/libstd-rs_%.bbappend             |  9 ++++++
 .../recipes-browser/chromium/rust_%.bbappend  | 19 ------------
 4 files changed, 34 insertions(+), 26 deletions(-)
 create mode 100644 meta-chromium/recipes-browser/chromium/libstd-rs_%.bbappend

diff --git a/meta-chromium/recipes-browser/chromium/chromium-gn.inc b/meta-chromium/recipes-browser/chromium/chromium-gn.inc
index f88140c0..82248d6c 100644
--- a/meta-chromium/recipes-browser/chromium/chromium-gn.inc
+++ b/meta-chromium/recipes-browser/chromium/chromium-gn.inc
@@ -72,6 +72,7 @@ DEPENDS += " \
     jpeg \
     libdrm \
     libffi \
+    libstd-rs \
     libwebp \
     libxkbcommon \
     libxslt \
@@ -86,7 +87,6 @@ DEPENDS += " \
     pkgconfig-native \
     ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)} \
     qemu-native \
-    rust \
     rust-native \
     virtual/libgl \
 "
diff --git a/meta-chromium/recipes-browser/chromium/files/0009-Adjust-the-Rust-build-to-our-needs.patch b/meta-chromium/recipes-browser/chromium/files/0009-Adjust-the-Rust-build-to-our-needs.patch
index c730de22..6a39defa 100644
--- a/meta-chromium/recipes-browser/chromium/files/0009-Adjust-the-Rust-build-to-our-needs.patch
+++ b/meta-chromium/recipes-browser/chromium/files/0009-Adjust-the-Rust-build-to-our-needs.patch
@@ -19,11 +19,11 @@ Signed-off-by: Max Ihlenfeldt <[email protected]>
  build/config/rust.gni            | 24 +++++++++++++++++------
  build/rust/rustc_wrapper.py      |  1 +
  build/rust/std/BUILD.gn          | 33 ++++++++++++++++++++++++--------
- build/rust/std/find_std_rlibs.py | 13 ++++++++++---
- 4 files changed, 54 insertions(+), 17 deletions(-)
+ build/rust/std/find_std_rlibs.py | 17 +++++++++++-----
+ 4 files changed, 56 insertions(+), 19 deletions(-)
 
 diff --git a/build/config/rust.gni b/build/config/rust.gni
-index e98d913..6213b72 100644
+index e98d9139f65a9..6213b728e6d70 100644
 --- a/build/config/rust.gni
 +++ b/build/config/rust.gni
 @@ -87,6 +87,11 @@ declare_args() {
@@ -79,7 +79,7 @@ index e98d913..6213b72 100644
  } else if (is_android) {
    import("//build/config/android/abi.gni")
 diff --git a/build/rust/rustc_wrapper.py b/build/rust/rustc_wrapper.py
-index b8e490d..d22cf08 100755
+index b8e490da27f2d..d22cf08aadf1d 100755
 --- a/build/rust/rustc_wrapper.py
 +++ b/build/rust/rustc_wrapper.py
 @@ -160,6 +160,7 @@ def main():
@@ -91,7 +91,7 @@ index b8e490d..d22cf08 100755
    abs_build_root = os.getcwd().replace('\\', '/') + '/'
    is_windows = sys.platform == 'win32' or args.target_windows
 diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn
-index 77f4b8c..8a25798 100644
+index 77f4b8c38d76f..8a25798f9158d 100644
 --- a/build/rust/std/BUILD.gn
 +++ b/build/rust/std/BUILD.gn
 @@ -188,7 +188,8 @@ if (toolchain_has_rust) {
@@ -166,9 +166,18 @@ index 77f4b8c..8a25798 100644
        # The host builds tools toolchain supports Rust only and does not use
        # the allocator remapping to point it to PartitionAlloc.
 diff --git a/build/rust/std/find_std_rlibs.py b/build/rust/std/find_std_rlibs.py
-index 386258f..25fdedc 100755
+index 386258f890c01..3bb6a41a40c56 100755
 --- a/build/rust/std/find_std_rlibs.py
 +++ b/build/rust/std/find_std_rlibs.py
+@@ -17,7 +17,7 @@ import re
+ from collections import defaultdict
+
+ EXPECTED_STDLIB_INPUT_REGEX = re.compile(r"([0-9a-z_]+)(?:-([0-9]+))?$")
+-RLIB_NAME_REGEX = re.compile(r"lib([0-9a-z_]+)-([0-9a-f]+)\.rlib$")
++RLIB_NAME_REGEX = re.compile(r"lib([0-9a-z_]+)(-([0-9a-f]+))?\.rlib$")
+
+
+ def main():
 @@ -52,6 +52,8 @@ def main():
      rustc_args.extend(["--target", args.target])
    rustlib_dir = subprocess.check_output(rustc_args).rstrip().decode()
@@ -187,6 +196,15 @@ index 386258f..25fdedc 100755
 
      def copy_file(infile, outfile):
        depfile.write(f" {infile}")
+@@ -99,7 +101,7 @@ def main():
+       # the correct file path to our linker invocations, we don't need
+       # that, and it would prevent us having the predictable filenames
+       # which we need for statically computable gn dependency rules.
+-      (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 2)
++      (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 3)
+
+       # Use the number of times we've seen this name to disambiguate the output
+       # filenames. Since we sort the input filenames including the metadata,
 @@ -117,14 +119,19 @@ def main():
        output_filename = f"lib{concise_name}.rlib"
 
diff --git a/meta-chromium/recipes-browser/chromium/libstd-rs_%.bbappend b/meta-chromium/recipes-browser/chromium/libstd-rs_%.bbappend
new file mode 100644
index 00000000..0e23118c
--- /dev/null
+++ b/meta-chromium/recipes-browser/chromium/libstd-rs_%.bbappend
@@ -0,0 +1,9 @@
+FILES:${PN} += "${libdir}/rustlib/*/target.json"
+
+# Without this, rustc fails with "could not find specification for target ...".
+do_install:append() {
+    target_dir=`realpath ${D}${rustlibdir}/..`
+    target_triple=`basename ${target_dir}`
+    target_json="${target_dir}/target.json"
+    RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --print target-spec-json --target "${target_triple}" > "${target_json}"
+}
diff --git a/meta-chromium/recipes-browser/chromium/rust_%.bbappend b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
index d103e69b..ec07b30d 100644
--- a/meta-chromium/recipes-browser/chromium/rust_%.bbappend
+++ b/meta-chromium/recipes-browser/chromium/rust_%.bbappend
@@ -5,22 +5,3 @@
 rust_do_install:append() {
     install -m 0644 ${WORKDIR}/rust-targets/${RUST_TARGET_SYS}.json ${D}${libdir}/rustlib/${RUST_TARGET_SYS}/target.json
 }
-
-# This makes sure that all .rlib files that Chromium needs get installed. The
-# libraries installed by libstd-rs don't include e.g. libprofiler_builtins.
-# Additionally, libstd and libtest installed by libstd-rs don't follow the usual
-# naming scheme, which would trip up Chromium.
-rust_do_install:class-target:append() {
-    mkdir -p _dist
-    rlib_path="rust-std-${PV}-${RUST_TARGET_SYS}/rust-std-${RUST_TARGET_SYS}/lib/rustlib"
-    tar -C _dist -xf build/dist/rust-std-${PV}-${RUST_TARGET_SYS}.tar.xz $rlib_path
-
-    target_dir=${D}${libdir}/rustlib
-    install -d $target_dir
-    cp -r _dist/$rlib_path/${RUST_TARGET_SYS} $target_dir
-    rm -rf _dist
-}
-
-# Override the default dependency on libstd-rs, as we copy the libraries
-# manually above.
-RUSTLIB_DEP = ""

MaxIhlenfeldt avatar May 07 '24 15:05 MaxIhlenfeldt

Also, depending on how recent your checkout is, you might see a ninja error on Yocto master. If that occurs, backporting https://chromium-review.googlesource.com/c/chromium/src/+/5522398 should fix it. I'll upload a separate PR for that tomorrow.

MaxIhlenfeldt avatar May 07 '24 15:05 MaxIhlenfeldt