nodejs: fix do_install failure with 'shared' PACKAGECONFIG

* tools/install.py uses:
  output_lib = 'libnode.' + variables.get('shlib_suffix')
  action([output_prefix + output_lib], variables.get('libdir') + '/'+ output_lib)

  and when libdir is absolute path (either ${D}${libdir} before:
  https://git.openembedded.org/meta-openembedded/commit/?id=42c0f0120ad1caf25118d079314c988d4633a437
  or just ${libdir} "/usr/lib") it doesn't respect prefix nor ${D}
  and fails to write to host's directory when "shared" PACKAGECONFIG
  is enabled:
  http://errors.yoctoproject.org/Errors/Details/689959/

if [ ! -r node ] || [ ! -L node ]; then \
  ln -fs out/Release/node node; fi
TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/recipe-sysroot-native/usr/bin/python3-native/python3 tools/install.py install 'TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/image' '/usr'
installing TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/image/usr/bin/node
installing /usr/lib/libnode.so.108
Traceback (most recent call last):
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/node-v18.12.1/tools/install.py", line 351, in <module>
    run(sys.argv[:])
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/node-v18.12.1/tools/install.py", line 342, in run
    files(install)
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/node-v18.12.1/tools/install.py", line 179, in files
    action([output_prefix + output_lib], variables.get('libdir') + '/' + output_lib)
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/node-v18.12.1/tools/install.py", line 77, in install
    try_copy(path, dst)
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/node-v18.12.1/tools/install.py", line 67, in try_copy
    return shutil.copy2(source_path, target_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/recipe-sysroot-native/usr/lib/python3.11/shutil.py", line 436, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "TOPDIR/tmp-glibc/work/core2-64-oe-linux/nodejs/18.12.1-r0/recipe-sysroot-native/usr/lib/python3.11/shutil.py", line 258, in copyfile
    with open(dst, 'wb') as fdst:
         ^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/usr/lib/libnode.so.108'
make: *** [Makefile:189: install] Error 1

* use just baselib "lib" so that it respects ${D} as well as ${prefix}
  while using e.g. lib32 or lib64 when multilib is enabled

* similarly as 'node' binary is installed to relative hardcoded path "bin" with:
  action([output_prefix + output_file], 'bin/' + output_file)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Martin Jansa
2023-02-15 22:12:39 +01:00
committed by Khem Raj
parent 55740758c3
commit 4efcbfbcbf

View File

@@ -148,7 +148,7 @@ do_configure () {
--without-etw \
--dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
--dest-os=linux \
--libdir=${libdir} \
--libdir=${baselib} \
${ARCHFLAGS} \
${PACKAGECONFIG_CONFARGS}
}