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

chromium: Enable crabbyavif

Open MaxIhlenfeldt opened this issue 6 months ago • 3 comments

In #828, we had to disable crabbyavif from being built, because the bindgen invocations for it created build errors (see https://github.com/OSSystems/meta-browser/issues/827#issuecomment-2263051027).

I've been able to fix the unsupported option '-mbranch-protection=' for target 'x86_64-unknown-linux-gnu' part, but I'm stuck on the $HEADER file not found part.

My current solution is to get all the flags set in our toolchain BUILD.gn file and pass them through to bindgen, so it can pass them to clang. These two are new in our args.gn:

rust_bindgen_extra_host_args = [
  "-isystem/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot-native/usr/include",
  "-isysroot=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot-native",
  "-stdlib=libc++",
  "-O2",
  "-pipe",
]
rust_bindgen_extra_target_args = [
  "-target",
  "arm-oe-linux-gnueabi",
  "-mfpu=neon",
  "-mfloat-abi=hard",
  "-mcpu=cortex-a15",
  "-mlittle-endian",
  "-Qunused-arguments",
  "-D_TIME_BITS=64",
  "-D_FILE_OFFSET_BITS=64",
  "--sysroot=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot",
  "-O2",
  "-g",
  "-fmacro-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/chromium-127.0.6533.99=/usr/src/debug/chromium-x11/127.0.6533.99",
  "-fdebug-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/chromium-127.0.6533.99=/usr/src/debug/chromium-x11/127.0.6533.99",
  "-fmacro-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/chromium-127.0.6533.99/out/Release=/usr/src/debug/chromium-x11/127.0.6533.99",
  "-fdebug-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/chromium-127.0.6533.99/out/Release=/usr/src/debug/chromium-x11/127.0.6533.99",
  "-fdebug-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot=",
  "-fmacro-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot=",
  "-fdebug-prefix-map=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot-native=",
  "-pipe",
]

I've also manually added these two to the extra target args:

  "-isysroot=/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot",
  "-isystem/home/gitlab-runner/yocto-chromium/builds/ci-chromium-x11-qemuarm-master/tmp-glibc/work/cortexa15t2hf-neon-oe-linux-gnueabi/chromium-x11/127.0.6533.99/recipe-sysroot/usr/include",

but that didn't fix the issue.

I've searched for the header files in question in the sysroot, and this is where they seem to be located:

> fdfind stddef.h
usr/include/c++/v1/stddef.h
usr/include/linux/stddef.h

> fdfind stdarg.h
usr/include/c++/14.2.0/tr1/stdarg.h

Adding these directories using -isystem might work, but seems hacky; also, the usr/include/c++/14.2.0/tr1/stdarg.h path looks like it might not be the same across all clang versions / Yocto releases.

I've also tried using bindgen from meta-clang instead of Chromium's by adding a dependency on bindgen-cli-native and setting rust_bindgen_root=".../recipe-sysroot-native/usr" in args.gn, but that didn't seem to change anything.

@kraj do you maybe have suggestions what else I could try?

MaxIhlenfeldt avatar Aug 12 '24 14:08 MaxIhlenfeldt