Rantanen / node-opus

Opus bindings for Node.js
MIT License
78 stars 32 forks source link

Raspberry pi 4 support? #86

Closed GitPaulo closed 4 years ago

GitPaulo commented 5 years ago

I am wondering if the problem I have encountered is to do with node-opus not being compatibile with raspberrypi 4? If that is the case, is this compatibility going to be achieved in the near future?

Thank you for reading this.

All the information about my system, project and error can be encountered below

========== HOST MACHINE INFORMATION ========== Linux raspberrypi 4.19.57-v7+ #1244 SMP armv7l GNU/Linux

========== REQUIRED SOFTWARE VERSIONS ========== Python 2.7.13 NPM 6.10.0 Node v12.7.0 FFMPEG v3.2.14-1~deb9u1+rpt1

========== DEPENDENCIES TREE (DEPTH=0) ========== ├── UNMET PEER DEPENDENCY @discordjs/uws@^11.149.1 ├── archiver@3.0.3 ├── UNMET PEER DEPENDENCY bufferutil@^4.0.1 ├── chalk@2.4.2 ├── cheerio@1.0.0-rc.3 ├── discord.js@12.0.0-dev (github:discordjs/discord.js#e562564123912f09725a6e03ecf4ba44d85de35a) ├── UNMET PEER DEPENDENCY erlpack@discordapp/erlpack ├── eslint@6.1.0 ├── eslint-config-mudamuda@1.0.10 ├── eslint-plugin-security@1.4.0 ├── github-api@3.2.2 ├── got@9.6.0 ├── js-yaml@3.13.1 ├── UNMET PEER DEPENDENCY libsodium-wrappers@^0.7.4 ├── mongoose@5.6.7 ├── node-opus@0.3.2 ├── nodemon@1.19.1 ├── pem@1.14.2 ├── pm2@3.5.1 ├── request@2.88.0 ├── request-promise@4.2.4 ├── snyk@1.200.1 ├── UNMET PEER DEPENDENCY sodium@^3.0.2 ├── ytdl-core@0.29.3 ├── ytdl-core-discord@1.0.3 ├── UNMET PEER DEPENDENCY zlib-sync@^0.1.4 └── UNMET PEER DEPENDENCY zucc@^0.1.0

========== ERROR MESSAGE & STACK TRACE ========== Error originated by using ytdl-core-discord function on a valid youtube url.

    Error message: Could not find an Opus module! Please install node-opus or opusscript.
    Stack: Error: Could not find an Opus module! Please install node-opus or opusscript.
at new OpusStream (/home/pi/Desktop/Vulcan/node_modules/prism-media/src/opus/Opus.js:41:13)
at new Decoder (/home/pi/Desktop/Vulcan/node_modules/prism-media/src/opus/Opus.js:163:1)
at AudioPlayer.playOpusStream (/home/pi/Desktop/Vulcan/node_modules/discord.js/src/client/voice/player/BasePlayer.js:79:23)
at VoiceConnection.play (/home/pi/Desktop/Vulcan/node_modules/discord.js/src/client/voice/util/PlayInterface.js:75:28)
at VoiceConnection.onSessionDescription (/home/pi/Desktop/Vulcan/node_modules/discord.js/src/client/voice/VoiceConnection.js:455:29)
at VoiceWebSocket.emit (events.js:198:13)
at VoiceWebSocket.onPacket (/home/pi/Desktop/Vulcan/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:188:14)
at VoiceWebSocket.onMessage (/home/pi/Desktop/Vulcan/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:139:19)
at WebSocket.onMessage (/home/pi/Desktop/Vulcan/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/pi/Desktop/Vulcan/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:198:13)
at Receiver.dataMessage (/home/pi/Desktop/Vulcan/node_modules/ws/lib/receiver.js:422:14)
at Receiver.getData (/home/pi/Desktop/Vulcan/node_modules/ws/lib/receiver.js:352:17)
at Receiver.startLoop (/home/pi/Desktop/Vulcan/node_modules/ws/lib/receiver.js:138:22)
at Receiver._write (/home/pi/Desktop/Vulcan/node_modules/ws/lib/receiver.js:74:10)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at Receiver.Writable.write (_stream_writable.js:299:11)
at TLSSocket.socketOnData (/home/pi/Desktop/Vulcan/node_modules/ws/lib/websocket.js:864:35)
at TLSSocket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
Rantanen commented 5 years ago

Perhaps.

I don't have a RPi4 myself and I have no idea how it differs from the earlier models on hardware. I would have figured out it had the same architecture - but I guess not? The README.md has instructions on how to compile node-opus for (currently) unsupported architectures.

GitPaulo commented 5 years ago

I have followed the instructions on the .README of the root repo folder. Unfortunately, I still get the same error.

This is the new package.json: https://pastebin.com/raw/4BKksHyd This is the config.h at ~/Desktop/Vulcan/node_modules/node-opus/deps/config/opus/linux/armv7l https://pastebin.com/raw/jtLYuwaE

Perhaps this has nothing to do with node-opus and it is prism-media's problem? The weird thing is, the exact same project works just fine on my Windows machine.

Another thing i've noticed - the newer versions of node v12.x seem to cause this error during the build:

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/pi/.nvm/versions/node/v12.7.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:266:23)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.57-v7+
gyp ERR! command "/home/pi/.nvm/versions/node/v12.7.0/bin/node" "/home/pi/.nvm/versions/node/v12.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/Desktop/Vulcan/node_modules/ref
gyp ERR! node -v v12.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

When I downgraded to v11.x the error was gone.

Rantanen commented 5 years ago

The README could be missing node-gyp requirements for Linux machines. I might have assumed these are most often installed anyway. You might want to try something like sudo apt-get install build-essential if I remember right.

Edit: Changed build-essentials to build-essential according to https://raspberrypi.stackexchange.com/questions/4813/how-to-install-gnu-c-development-tools-on-raspberry-pi-using-apt-get

Rantanen commented 5 years ago

https://github.com/nodejs/node-gyp lists the following:

On Unix

  • python (v2.7 recommended, v3.x.x is not supported)
  • make
  • A proper C/C++ compiler toolchain, like GCC