You are not logged in.

#1 2021-06-20 08:05:50

simonzack
Member
Registered: 2014-01-18
Posts: 22

Help on fixing `ERR_DLOPEN_FAILED` when creating an npm package

I'm trying to update the AUR (en) - ijavascript package.

This depends on the Node.js package https://github.com/zeromq/zeromq.js/tree/v5.2.8, which appears to be built using node-gyp.

However I always get the following error when running my package:

Error: /usr/lib/node_modules/ijavascript/node_modules/zeromq/build/Release/zmq.node: undefined symbol: _ULx86_64_init_local

This error also shows up when I run the following test JavaScript file in Node.js, in the package's build directory pkg/ijavascript/usr/lib/node_modules/ijavascript:

require('zeromq')

However if I locally do:

$ npm install ijavascript

I can run the above test file fine.

My PKGBUILD is as follows:

pkgname=ijavascript
pkgver=5.2.0
pkgrel=1
pkgdesc="IJavascript is a JavaScript kernel for the Jupyter notebook"
arch=(any)
url="https://github.com/n-riesco/ijavascript"
license=('BSD-3-Clause')
depends=(
  'nodejs'
  'jupyter'
  'jupyter-notebook'
)
makedepends=('npm')

_npmdir="/usr/lib/node_modules/ijavascript"

package() {
  npm install -g --cache "${srcdir}/npm-cache" --prefix "${pkgdir}/usr" ${pkgname}@${pkgver}

  # Can't run `ijsinstall --install=global` as we have permission errors. Do things manually.
  mkdir -p "${srcdir}/kernel/javascript"
  cd "${srcdir}/kernel/javascript"
  cp ../../../kernel.json kernel.json
  cp "${pkgdir}${_npmdir}/images/nodejs/js-green-32x32.png" logo-32x32.png
  cp "${pkgdir}${_npmdir}/images/nodejs/js-green-64x64.png" logo-64x64.png

  cd "${srcdir}/kernel"
  jupyter-kernelspec install --prefix="${pkgdir}/usr" javascript
}

Any help appreciated. I'm guessing this is some sort of a path issue, but no idea on how to fix it.

Last edited by simonzack (2021-06-20 08:07:09)

Offline

#2 2021-06-20 11:32:30

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Help on fixing `ERR_DLOPEN_FAILED` when creating an npm package

# Can't run `ijsinstall --install=global` as we have permission errors. Do things manually.

install=global seems to be the equivalent of running make install as root and that's not suitable for makepkg .

I suggest to run ijsinstall without parameters instead, that should put the files in the prefix set by npm , $pkgdir/usr .

You will probably have to correct permissions after that, [1] has some tips how to deal with those.


[1] https://wiki.archlinux.org/title/Node.j … #Using_npm


P.S.

  cd "${srcdir}/kernel/javascript"
  cp ../../../kernel.json kernel.json

If I read this correctly it would get it's input from the folder above $srcdir .
While that is often the folder where people start from, there's no guarantee where $srcdir (and $pkgdir) are located.

PKGBUILDs should only access things under $srcdir or $pkgdir  .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2021-06-20 13:20:46

simonzack
Member
Registered: 2014-01-18
Posts: 22

Re: Help on fixing `ERR_DLOPEN_FAILED` when creating an npm package

Thanks for the suggestion to not use ../, fixed.

I tried running ijsinstall by itself, but it doesn't quite do what it's supposed to, as it didn't put any files in /usr/share/. It should put files in /usr/share/jupyter/kernels/javascript/.

And I also managed to get a working hacky fix for the undefined symbol issue. The fix just adds -lunwind to the build options.

The fix isn't too ideal, as I had to replace /usr/lib/node_modules/ijavascript/node_modules/zeromq/binding.gyp file with my own version.

Ideally would love to know why installing this works outside of makepkg but doesn't work inside of it, and get a proper fix.

Last edited by simonzack (2021-06-20 13:21:59)

Offline

Board footer

Powered by FluxBB