Vencord / Vesktop

Vesktop is a custom Discord App aiming to give you better performance and improve linux support
GNU General Public License v3.0
4.29k stars 192 forks source link

Steam Deck cannot find venmic module #249

Closed unkn0wncode closed 11 months ago

unkn0wncode commented 11 months ago

So, I built from source in the hope of achieving streaming audio on Steam Deck, but Vesktop says it cannot find pipewire, which Steam Deck has by default. Since flatpak isn't available, I'm running AppImage through AppImageLauncher. I ran Vesktop in the console to see if it outputs anything and that's the result:

Failed to initialise venmic. Make sure you're using pipewire Error: Cannot find module '/tmp/.mount_VesktoDO4Ekq/resources/app.asar/static/dist/venmic-x64.node'
Require stack:
- /tmp/.mount_VesktoDO4Ekq/resources/app.asar/dist/js/main.js
- 
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/browser_init:2:116646)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at xa (VCDMain:28:4710)
    at VCDMain:28:5102
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:88656)
    at WebContents.emit (node:events:514:28) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/tmp/.mount_VesktoDO4Ekq/resources/app.asar/dist/js/main.js',
    undefined
  ]
}

Any idea what could be the cause? Thank you all for continuous development!

Curve commented 11 months ago

It seems you have not installed the module - The problem is not that pipewire isn't found but that the node module is not found.

Curve commented 11 months ago

Maybe @D3SOX can give some insights on how to properly build Vesktop for the Deck, I think he tested the venmic support on steam deck

D3SOX commented 11 months ago

Just download the AppImage from the latest release right-click it in Dolphin, select Add to Steam and you're done. I have personally created an Applications folder in my home directory, moved it in there as Vesktop.AppImage and customized the Steam entry afterwards using Decky's SteamGridDB plugin. Note that you might have to add executable permissions to the AppImage (just launching it once from Desktop mode first is the easiest way to do that)

As for building, I didn't build Vesktop on the Deck itself but on my Linux PC Rough instructions for this:

git clone https://github.com/Vencord/Vesktop
cd Vesktop
pnpm i
pnpm package --linux appimage

then copy the AppImage from the dist folder to the Deck and use the same procedure mentioned above

unkn0wncode commented 11 months ago

Just download the AppImage from the latest release right-click it in Dolphin, select Add to Steam and you're done. I have personally created an Applications folder in my home directory, moved it in there as Vesktop.AppImage and customized the Steam entry afterwards using Decky's SteamGridDB plugin.

As for building, I didn't build Vesktop on the Deck itself but on my PC Rough instructions for this:

git clone https://github.com/Vencord/Vesktop
cd Vesktop
pnpm i
pnpm package --linux appimage

then copy the AppImage from the dist folder to the Deck and use the same procedure mentioned above

Exactly thats how I built, but seems to not exactly cooperate. I'm trying to build it on m1 mac and then moving appimage to deck. Didn't try release build, but will look into it. Unsure though why building from source would fail.

D3SOX commented 11 months ago

I'm trying to build it on m1 mac

That could be the culprit. Might wanna spin up a quick Docker container or VM to build it (not sure what's the best way to compile x86 Linux on M1 Mac)

Curve commented 11 months ago

Not sure how electron/npm handle this but you might be facing issues due to architecture differences, namely, the issue could be that for some reason only the arm build of venmic is included in the target build

unkn0wncode commented 11 months ago

I removed venmic from optional to see some more output and you might be right, guess VM it is then


node_modules/@vencord/venmic: Running install script, failed in 16.7s
node_modules/@vencord/venmic install$ pkg-prebuilds-verify ./lib/options.js || cmake-js compile --CDvenmic_ad…
│ info TOOL Using Ninja generator, because ninja is available.
│ info CMD BUILD
│ info RUN [
│ info RUN   'cmake',
│ info RUN   '--build',
│ info RUN   '/Users/xxxxx/Documents/Vesktop/node_modules/@vencord/venmic/build',
│ info RUN   '--config',
│ info RUN   'Release'
│ info RUN ]
│ ninja: error: loading 'build.ninja': No such file or directory
│ info REP Build has been failed, trying to do a full rebuild.
│ info CMD CLEAN
│ info RUN [
│ info RUN   'cmake',
│ info RUN   '-E',
│ info RUN   'remove_directory',
│ info RUN   '/Users/xxxxx/Documents/Vesktop/node_modules/@vencord/venmic/build'
│ info RUN ]
│ info CMD CONFIGURE
│ info RUN [
│ info RUN   'cmake',
│ info RUN   '/Users/xxxxx/Documents/Vesktop/node_modules/@vencord/venmic',
│ info RUN   '--no-warn-unused-cli',
│ info RUN   '-G',
│ info RUN   'Ninja',
│ info RUN   '-DCMAKE_JS_VERSION=7.2.1',
│ info RUN   '-DCMAKE_BUILD_TYPE=Release',
│ info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/xxxxx/Documents/Vesktop/node_modules/@vencord/venmic/bui…
│ info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
│ info RUN   '-DCMAKE_JS_INC=/Users/xxxxx/Documents/Vesktop/node_modules/node-api-headers/include;/Users/xxxxx/…
│ info RUN   '-DCMAKE_JS_SRC=',
│ info RUN   '-DNODE_RUNTIME=node',
│ info RUN   '-DNODE_RUNTIMEVERSION=21.1.0',
│ info RUN   '-DNODE_ARCH=arm64',
│ info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
│ info RUN   '-Dvenmic_addon=ON',
│ info RUN   '-DCMAKE_JS_LIB=',
│ info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUI…
│ info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
│ info RUN ]
│ Not searching for unused variables given on the command line.
│ -- The CXX compiler identification is AppleClang 15.0.0.15000040
│ -- Detecting CXX compiler ABI info
│ -- Detecting CXX compiler ABI info - done
│ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoo…
│ -- Detecting CXX compile features
│ -- Detecting CXX compile features - done
│ -- [venmic] Avoiding local packages as 'venmic_prefer_remote' is ON
│ -- CPM: Adding package rohrkabel@2.5 (v2.5)
│ -- [rohrkabel] Avoiding local packages as 'rohrkabel_prefer_remote' is ON
│ -- CPM: rohrkabel: Adding package tl-expected@1.1.0 (v1.1.0)
│ -- CPM: rohrkabel: Adding package ereignis@2.2 (v2.2)
│ -- CPM: rohrkabel: Adding package boost_callable_traits@2 (2a56a3a)
│ -- CPM: rohrkabel: Adding package channel@2.2 (v2.2)
│ CMake Error at /opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:23…
│   Could NOT find PipeWire (missing: PIPEWIRE_LIBRARIES PIPEWIRE_INCLUDE_DIRS
│   SPA_INCLUDE_DIRS) (found version "")
│ Call Stack (most recent call first):
│   /opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAI…
│   build/_deps/rohrkabel-src/cmake/FindPipeWire.cmake:79 (find_package_handle_standard_args)
│   build/_deps/rohrkabel-src/CMakeLists.txt:116 (find_package)
│ -- Configuring incomplete, errors occurred!
│ ERR! OMG Process terminated: 1
└─ Failed in 16.7s at /Users/xxxxx/Documents/Vesktop/node_modules/@vencord/venmic
 ELIFECYCLE  Command failed with exit code 1.```
Curve commented 11 months ago

Can you please put this in triple backticks?

```

unkn0wncode commented 11 months ago

Can you please put this in triple backticks?

```

fixed, noticed it only after sending :D

Curve commented 11 months ago

You're missing the system dependencies to even compile venmic, please install base-devel (or your systems equivalent, in case you don't have already) and the pipewire development packages

Curve commented 11 months ago

I'm just realizing, this won't work unless you compile this in a linux vm / docker container with said dependencies installed

Curve commented 11 months ago

You don't need to compile venmic from source though, simply installing the node package should usually be enough as it contains arm as well as x86 builds already

unkn0wncode commented 11 months ago

You don't need to compile venmic from source though, simply installing the node package should usually be enough as it contains arm as well as x86 builds already

Won't it try to build it anyway and fail? I'm not exactly sure how to install it without compilation 🤔

Curve commented 11 months ago

You don't need to compile venmic from source though, simply installing the node package should usually be enough as it contains arm as well as x86 builds already

Won't it try to build it anyway and fail? I'm not exactly sure how to install it without compilation 🤔

The npm package already contains pre-builts which normally shouldn't be rebuilt - However I suspect the recompilation may occur because of this:

│ ninja: error: loading 'build.ninja': No such file or directory
│ info REP Build has been failed, trying to do a full rebuild.

Not sure why that is.

D3SOX commented 11 months ago

I think (p)npm refuses to install the pre-built when there's a platform mismatch

Curve commented 11 months ago

I think (p)npm refuses to install the pre-built when there's a platform mismatch

But both arm and x86 builds are available - thus no mismatch? (Also this is handled by pkg-prebuilds I believe)

D3SOX commented 11 months ago

platform meaning darwin instead of linux, not architecture

image

Maybe there's a way to force/trick it into installing the linux variant

Curve commented 11 months ago

platform meaning darwin instead of linux, not architecture

image

Looks like it - I guess we can't do anything about that then - I'd advise to just run pnpm package --linux appimage inside of a linux docker container then

unkn0wncode commented 11 months ago

I can confirm at least that appimage from releases works for audio streaming. Sadly didn't manage to install prebuilt, but hey at least something works :D

D3SOX commented 11 months ago

Maybe there's a way to force/trick it into installing the linux variant

Saw this inside the README for pkg-prebuilds image

Maybe try

export npm_config_platform=linux
export npm_config_arch=x64

before building

unkn0wncode commented 11 months ago

Maybe there's a way to force/trick it into installing the linux variant

Saw this inside the README for pkg-prebuilds image

Maybe try

export npm_config_platform=linux
export npm_config_arch=x64

before building

Weird, it didn't show compilation errors but it still doesn't work with audio, module not found.

Curve commented 11 months ago

You can use our docker container used by venmic (here) to build the whole appimage in docker and then deploy that build to your deck

lewisakura commented 11 months ago

Since we now have a Flatpak, please try it instead and see if the issue still persists: https://flathub.org/apps/dev.vencord.Vesktop

unkn0wncode commented 11 months ago

Since we now have a Flatpak, please try it instead and see if the issue still persists: https://flathub.org/apps/dev.vencord.Vesktop

Flatpak works great, the issue seems to be rather when compiling from unsupported architecture, like arm m1. I tested both compiling flatpak right on steam deck and flathub version and these work. I'm guessing that compiling from some linux container would also work.

Weird thing is that even when supplying arch flags posted few comments above, it still didn't work. Might be that just pnpm is picky and we need to accept that and live with workaround :D

Curve commented 11 months ago

Compiling this on a MacOS Machine will not work (in the sense that it will not include venmic) because that will try to compile venmic as well which obviously fails due to a missing pipewire installation.

I'm not sure if we should even support this since cross-compiling is a giant headache anyways.

If one want's to build Vesktop with venmic support they should use a docker container instead :)