And the winner is
makeinstall_target() {
make INSTALL_PREFIX=$INSTALL install_sw
LD_LIBRARY_PATH= make INSTALL_PREFIX=$SYSROOT_PREFIX install_sw
chmod 755 $INSTALL/usr/lib/*.so*
chmod 755 $INSTALL/usr/lib/engines/*.so
}
After closer examination I noticed that LD_LIBRARY_PATH is set to
/home/le/LibreELEC.tv.8.2.5/build.LibreELEC-Generic.x86_64-8.2.5/toolchain/lib:
and (seems) it means current folder is also set because nothing exists after ":" separator. And make and every other command fails in the folder where libraries are stored
/home/le/LibreELEC.tv.8.2.5/build.LibreELEC-Generic.x86_64-8.2.5/toolchain/x86_64-libreelec-linux-gnu/sysroot/usr/lib
cd /home/le/LibreELEC.tv.8.2.5/build.LibreELEC-Generic.x86_64-8.2.5
le@here:/home/le/LibreELEC.tv.8.2.5/build.LibreELEC-Generic.x86_64-8.2.5/toolchain/x86_64-libreelec-linux-gnu/sysroot/usr/lib$ LD_LIBRARY_PATH="/dummy" which make
/usr/bin/make
le@here:/home/le/LibreELEC.tv.8.2.5/build.LibreELEC-Generic.x86_64-8.2.5/toolchain/x86_64-libreelec-linux-gnu/sysroot/usr/lib$ LD_LIBRARY_PATH="/dummy:" which make
Segmentation fault (core dumped)