site  contact  subhomenews

Hack to fix OE cross-compile paths

February 01, 2022 — BarryK

This topic is somewhat esoteric, of interest to developers only. The OpenEmbedded cross-compile environment can cause some unexpected side-effects when the executables are run in the target system.

I hit this problem when testing Pitivi video editor. At startup, it runs /usr/libexec/gstreamer1.0/gst-plugin-scanner, which fails as it looks for this non-existent file:


The file is actually at:


In some cases, these incorrect paths are in text configuration files, so can be corrected. However, gst-plugin-scanner is a compiled binary file, and the above path is actually baked into it.

I have my OE project on /mnt/build, as per the above path. I use an external SSD mounted on /mnt/build.

gst-plugin-scanner works if I have that SSD mounted, but fails if don't.

It isn't usually a problem; however, to fix the rare cases in which it is, like running gst-plugin-scanner, the '3buildeasydistro' script in woofQ now has this code:

 #20220201 create a hierarchy under /mnt/build ...
echo "Creating folder hierarchy under /mnt/build ..."
# -h do not print filename, -o print matching text, -a so will also give output for binary files
OES="$(grep -rhoa '/mnt/build/oe-builds/oe-quirky/[a-zA-Z0-9/._-]*/recipe\-sysroot' ../packages-${DISTRO_FILE_PREFIX})"
#ex: /mnt/build/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/gobject-introspection/1.62.0-r7/recipe-sysroot
for aOES in ${OES}
[ "$aOES" == "" ] && continue
[ "${aOES/*recipe-sysroot/}" != "" ] && continue
[ "${aOES:0:10}" != "/mnt/build" ] && continue
upOES="$(dirname ${aOES})"
if [ ! -d rootfs-complete${upOES} ];then
mkdir -p rootfs-complete${upOES}
ln -sr rootfs-complete/ rootfs-complete${upOES}/recipe-sysroot

...what that does is reconstruct all of those paths, with the final folder, 'recipe-sysroot' a symlink to '/'. Hence, in theory, apps like gst-plugin-scanner will work.

I will still be able to mount the SSD on /mnt/build, it will just hide all of that stuff underneath.   

Tags: easy