On Mon, 2024-09-23 at 13:53 +1000, David Gibson wrote:On Wed, Sep 18, 2024 at 12:12:57PM +0200, Lukasz Gut wrote:I would like `ld-linux.so` to be copied to the exact same location as in host. Without this change, it was copied to `/usr/lib64` directory. There is no such a directory on the host, but there is a link `lib64 -> lib` inside of `/usr` directory. I thought to: 1. Copy things to exactly the same locations as they are on the host. 2. Recreate necessary links.Place ld in exact physical location as on host, not being confused by links. Use realpath, that was already on the list of default PROGS.It's not clear to me why this change is necessary.-- LukaszSigned-off-by: Lukasz Gut <lgut(a)lgut.eu> --- mbuto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mbuto b/mbuto index 1c3b347..1f92bd9 100755 --- a/mbuto +++ b/mbuto @@ -644,12 +644,13 @@ libs_path_add() { # libs_copy_ld_so() - Copy run-time linker program, mimic location from host # $1: Path to run-time linker libs_copy_ld_so() { - [ -f "${wd}/${1}" ] && return + __srcfile="$("${REALPATH}" "${1}")" + __destfile="${wd}""${__srcfile}" + [ -f "${__destfile}" ] && return - __destdir="$("${DIRNAME}" "${wd}/${1}")" + __destdir="$("${DIRNAME}" "${__destfile}")" "${MKDIR}" -p "${__destdir}" - - "${CP}" --parents --preserve=all "${1}" "${wd}" + "${CP}" --parents --preserve=all "${__srcfile}" "${wd}" } # libs_dlopen_copy() - Recursively copy matching libraries from LIBS_DLOPEN