diff mbox series

[meta-oe] nodejs: fix do_install failure with 'shared' PACKAGECONFIG

Message ID 20230215211239.3250814-1-Martin.Jansa@gmail.com
State Under Review
Headers show
Series [meta-oe] nodejs: fix do_install failure with 'shared' PACKAGECONFIG | expand

Commit Message

Martin Jansa Feb. 15, 2023, 9:12 p.m. UTC
* 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>
---
 meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb
index 6ff9ef083a..9e274c5a2d 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb
@@ -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}
 }