Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Executables: error while loading shared libraries: libffmpeg.so: cannot open shared object file: No such file or directory #3274

Open
3 tasks done
SiegeSailor opened this issue Jul 12, 2023 · 1 comment
Labels
blocked/needs-info Issues lacking information for resolution bug wsl

Comments

@SiegeSailor
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.2.1

Electron version

v25.2.0

Operating system

Windows 10 WSL with Ubuntu 22.04.2

Last known working Electron Forge version

None

Expected behavior

Successfully run ./out/<name>-linux-64 file from npm run package.

Actual behavior

Getting ./out/window-linux-x64/window: error while loading shared libraries: libffmpeg.so: cannot open shared object file: No such file or directory when running the following:

./out/window-linux-x64/window

Steps to reproduce

Running with Node 18.16.1, and NPM 9.5.1:

# Use electron-webpack-typescript template
npm install

# Install packages for X Server
apt update
apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 \
libgdk-pixbuf2.0-0  libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 \
x11-xserver-utils

# Setup bus
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
xhost +
service dbus start
export XDG_RUNTIME_DIR=/run/user/$(id -u)
if [ -d "$XDG_RUNTIME_DIR" ]; then
    echo "$XDG_RUNTIME_DIR already exists."
else
    mkdir $XDG_RUNTIME_DIR
fi
chmod 700 $XDG_RUNTIME_DIR
chown $(id -un):$(id -gn) -R $XDG_RUNTIME_DIR
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &

# Have VcsXsrv, a WSL X Server, running

apt install rpm --yes
npm run package
# Switch to a non-root user to avoid getting Running as root without -no-sandbox is not supported error
chmod -R 777 ./out/
sudo adduser guest
su guest
./out/window-linux-x64/window

Additional information

I have tried to install the following:

apt install chromium-codecs-ffmpeg ffmpeg

But no luck. I get usr/bin/ffmpeg when I run which ffmpeg, and I am sure libffmpeg.so is under my bundled app folder. The following is what I get when I run ls -al ./out/window-linux-x64:

drwxrwxrwx 4 root root      4096 Jul 12 10:37 .
drwxrwxrwx 4 root root      4096 Jul 12 10:37 ..
-rwxrwxrwx 1 root root      1096 Jul 12 10:37 LICENSE
-rwxrwxrwx 1 root root   8247912 Jul 12 10:37 LICENSES.chromium.html
-rwxrwxrwx 1 root root     53840 Jul 12 10:37 chrome-sandbox
-rwxrwxrwx 1 root root    136579 Jul 12 10:37 chrome_100_percent.pak
-rwxrwxrwx 1 root root    197691 Jul 12 10:37 chrome_200_percent.pak
-rwxrwxrwx 1 root root   1246464 Jul 12 10:37 chrome_crashpad_handler
-rwxrwxrwx 1 root root  10544880 Jul 12 10:37 icudtl.dat
-rwxrwxrwx 1 root root    251064 Jul 12 10:37 libEGL.so
-rwxrwxrwx 1 root root   6435400 Jul 12 10:37 libGLESv2.so
-rwxrwxrwx 1 root root   2877488 Jul 12 10:37 libffmpeg.so
-rwxrwxrwx 1 root root   4565640 Jul 12 10:37 libvk_swiftshader.so
-rwxrwxrwx 1 root root   6396248 Jul 12 10:37 libvulkan.so.1
drwxrwxrwx 2 root root      4096 Jul 12 10:37 locales
drwxrwxrwx 2 root root      4096 Jul 12 10:37 resources
-rwxrwxrwx 1 root root   5214565 Jul 12 10:37 resources.pak
-rwxrwxrwx 1 root root    259202 Jul 12 10:37 snapshot_blob.bin
-rwxrwxrwx 1 root root    578034 Jul 12 10:37 v8_context_snapshot.bin
-rwxrwxrwx 1 root root         6 Jul 12 10:37 version
-rwxrwxrwx 1 root root       107 Jul 12 10:37 vk_swiftshader_icd.json
-rwxrwxrwx 1 root root 166316624 Jul 12 10:37 window

window is the executable. I define the name in forge.config.ts:

import type { ForgeConfig } from "@electron-forge/shared-types";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { MakerZIP } from "@electron-forge/maker-zip";
import { MakerDeb } from "@electron-forge/maker-deb";
import { MakerRpm } from "@electron-forge/maker-rpm";
import { AutoUnpackNativesPlugin } from "@electron-forge/plugin-auto-unpack-natives";
import { WebpackPlugin } from "@electron-forge/plugin-webpack";

import { mainConfig } from "./webpack/main";
import { rendererConfig } from "./webpack/renderer";

const config: ForgeConfig = {
  packagerConfig: {
    asar: true,
  },
  rebuildConfig: {},
  makers: [
    new MakerSquirrel({}),
    new MakerZIP({}, ["darwin"]),
    new MakerRpm({}),
    new MakerDeb({}),
  ],
  plugins: [
    new AutoUnpackNativesPlugin({}),
    new WebpackPlugin({
      mainConfig,
      renderer: {
        config: rendererConfig,
        entryPoints: [
          {
            html: "./source/asset/index.html",
            js: "./source/renderer.ts",
            name: "window",
            preload: {
              js: "./source/preload.ts",
            },
          },
        ],
      },
    }),
  ],
};

export default config;

My package.json:

"dependencies": {
    "electron-squirrel-startup": "1.0.0"
  },
  "devDependencies": {
    "@electron-forge/cli": "6.2.1",
    "@electron-forge/maker-deb": "6.2.1",
    "@electron-forge/maker-rpm": "6.2.1",
    "@electron-forge/maker-squirrel": "6.2.1",
    "@electron-forge/maker-zip": "6.2.1",
    "@electron-forge/plugin-auto-unpack-natives": "6.2.1",
    "@electron-forge/plugin-webpack": "6.2.1",
    "@types/jest": "29.5.3",
    "@types/node": "20.4.1",
    "@typescript-eslint/eslint-plugin": "5.62.0",
    "@typescript-eslint/parser": "5.62.0",
    "@vercel/webpack-asset-relocator-loader": "1.7.3",
    "css-loader": "6.8.1",
    "dotenv": "16.3.1",
    "electron": "25.2.0",
    "electron-store": "8.1.0",
    "fork-ts-checker-webpack-plugin": "7.3.0",
    "husky": "8.0.3",
    "jest": "29.6.1",
    "jest-environment-node": "29.6.1",
    "jest-junit": "16.0.0",
    "lint-staged": "13.2.3",
    "node-loader": "2.0.0",
    "prettier": "3.0.0",
    "style-loader": "3.3.3",
    "ts-jest": "29.1.1",
    "ts-loader": "9.4.4",
    "ts-node": "10.9.1",
    "typescript": "5.1.6"
  },
@erickzhao
Copy link
Member

Are you able to run Electron without Forge involved in your WSL environment?

I've seen similar issues for Linux users in the Electron Quick Start repo: electron/electron-quick-start#486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/needs-info Issues lacking information for resolution bug wsl
Projects
None yet
Development

No branches or pull requests

2 participants