Skip to content

The solution of lacking libudev.so.0

edi9999 edited this page · 17 revisions
Clone this wiki locally
Clone in Desktop

Due to the removal of `libudev0` and its associated library `libudev.so.0`, node-webkit isn’t able to run on newer distributions such as:

  • Ubuntu 13.04+
  • Fedora 18+
  • Arch
  • Gentoo
  • Derivatives of the above

…and possibly others. Until node-webkit is updated to depend on the currently shipped version `libudev.so.1`, the following solutions should provide a stopgap measure for packaging your applications.

1. Create a local symlink to `libudev.so.1` [NOT RECOMMENDED]

Same as above install `libudev1` if needed. Now create a local symlink to `libudev.so.1`. On Ubuntu for example, run from the directory where nw files are extracted:

# ln -s /lib/x86_64-linux-gnu/libudev.so.1 ./libudev.so.0

Then create a shell script to run nw:

#!/bin/sh
LD_LIBRARY_PATH=/home/omi/nw:$LD_LIBRARY_PATH ./nw $*

As you are only modifying local contents of node-webkit directory, this option should not have an impact on the overall stability of your system.

2. Use a wrapper shell script for your application.
In this method, we rename the binary executable file as `myapp-bin`, and then create a shell script named `myapp` as the following. Users will then run the `myapp` file to launch your application.

#!/bin/bash
MYAPP_WRAPPER="`readlink -f "$0"`"
HERE="`dirname "$MYAPP_WRAPPER"`"

# Always use our versions of ffmpeg libs.
# This also makes RPMs find our library symlinks.
export LD_LIBRARY_PATH=$([ -n "$LD_LIBRARY_PATH" ] && echo "$HERE:$HERE/lib:$LD_LIBRARY_PATH" || echo "$HERE:$HERE/lib")

exec -a "$0" "$HERE/myapp-bin"  "$@"

Creating a symlink for your package in the postinstall script

In the postinstall script of your DEB or RPM package, run the following script to create a local symlink. Use this together with the previous wrapper script.

#!/bin/bash
paths=(
  "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
  "/usr/lib64/libudev.so.1" # SUSE, Fedora
  "/usr/lib/libudev.so.1" # Arch, Fedora 32bit
  "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
)
for i in "${paths[@]}"
do
  if [ -f $i ]
  then
    ln -sf "$i" /opt/myapp/libudev.so.0
    break
  fi
done

3. Modify the nw binary itself

In this method, we navigate (via command line) to the directory containing the nw binary and run the following:

sed -i 's/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x30/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x31/g' nw

As should be obvious, this method comes with increased risk of damaging the nw executable and should only be attempted by skilled users which understand what the command is doing.

Something went wrong with that request. Please try again.