Discord.js: sodium doesn't work as of the latest version, so proposing a changeover to libsodium, which already has a JS port anyway

Created on 15 Feb 2019  路  16Comments  路  Source: discordjs/discord.js

The sodium package discord.js is using doesn't compile anymore due to a missing file error on the repo's part, so I'm proposing that discord.js switches over to libsodium instead, which we're already using the wrappers for, and won't be an issue with the current codebase. PR #3094 dictates what this change will do to discord.js as a whole (which isn't very much at all).

dependencies

All 16 comments

The sodium package still compiles fine for me on Windows 10 so maybe you're just missing tools required for compilation? (there's also no issues on the repo indicating that the repo is at fault for missing files)

In your PR #3094 I really don't see the point of adding libsodium - it shares the same codebase as libsodium-wrappers (from what I can tell they're basically the same thing) so if you're able to install one you're able to install the other -- there's no need in supporting both if they have no discerning features and have the same installation requirements.

sodium on the other hand is a native library and should offer better performance than both of these libraries, so I think you'd be better making an issue at their repo if you're having troubles compiling it on your system.

Multiple people have had the same trouble as I have and no one ever replies to them on their repo. What exactly do you have that allows the compilation to go through that I don't?

That is pretty unfortunate, on Windows I've installed windows-build-tools (you need the 2015 MSVS version so run npm install --vs2015 --global windows-build-tools.

If you're still unable to install it, I'd maybe open a new issue or directly mention the sodium maintainer in an existing issue to try and get it fixed.

I've tried your command, but that just gets me an EBADPLATFORM error. I'm trying to compile the errant library in WSL.

Sorry, I don't have any more ideas, you'll have to try sodium's issue tracker.

What exactly even is your issue when compiling sodium? You have been very vague so far.

Packages needed to compile sodium, on WSL included: build-essential libtool-bin autoconf.

Install these with your package manager, followed by npm i sodium or yarn add sodium. Any missing packages will be said in the error message that gets thrown by sodium.

Per https://github.com/paixaop/node-sodium#install

EDIT: Currently compiling on WSL, Ubuntu 18.04 with no issues after installing those three packages

What exactly even is your issue when compiling sodium? You have been very vague so far.

The issue is that when you get to the third .o file when compiling, it throws a g++ error: libsodium.a: No such file or directory. I'll attempt to install them and the recommended packages for them via the command: apt-get install --install-recommends build-essential libtool-bin autoconf, then following up with sudo npm i -g libsodium-wrappers and see if that fixes the issue.

@amishshah Is discord.js exclusively a Windows project?

@Monbrey @SpaceEEC @GamesProSeif @didinele The issue was closed because it compiles on Windows 10. That would imply that Windows is the only officially supported platform.

There's no statement that proves Discord.js is only supported on Windows.
Sodium and such packages are optional, as you might've seen in the docs. Discord.js works on multiple platforms in a stable manner. Approved by a lot of users.

The mentioned alternative package (libsodium-wrappers) is even listed now in the in the master documentation landing page, in the optional packages section.
optional packages

Also note that this issue is pretty out-dated. It was opened on Feb 15, and it's Oct 6 now. So, there has to be a lot of changes that took place in both Discord.js and Sodium's libraries since that time. Hence why this issue was closed and not discussed afterwards.

@GamesProSeif If you look back through the thread, the issue was closed on Feb 15. It being Oct 6 today did not really impact that decision.

I am aware it is an optional package and removing it was the convenient solution for encountering similar issues. Simply removing things when they don't work on their own may work for you, but I prefer to at least attempt to investigate further when they suddenly stop working after years.

What I was trying to find out was whether or not this was the best option as a Mac user, since Windows might be the only basis for testing. I could not find any specific statement about it, but there also didn't seem to be much concern that the issue impacted Linux, Raspberry Pi, and Mac

Anyway, thanks for your time. I think I have learned everything I need to make a decision.

Ubuntu 18.04 LTS (w/ build-essential) / Node v12.11.1:
sudo apt install libtool-bin
yarn/npm add/install sodium

No issues.

macOS High Sierra (w/ xcode) / Node v12.11.1:
brew install libtool autoconf automake
yarn/npm add/install sodium

No issues.

Windows 10 (w/ MSVC buildchain) / Node v12.11.1:
yarn/npm add/install sodium

No issues.

Installation requirements found on here: https://github.com/paixaop/node-sodium#install, this was also posted by Vlad above.

Considering this compiles fine on all 3, this would imply this project is officially multi-platform supported.

@iCrawl So only older linux-based operating systems with the newest Node. Got it. It was a simple question that was already answered. At this point, it just comes off as hostility.

The "Linux-based" operating system does not matter at all here. And "older" is not even a truthy statement considering Mojave is just one version above High Sierra and Ubuntu 18.04 is only one below 18.10 and LTS, what are you trying to say here?

It also works fine with Node 10 (which is LTS) on all those systems.

It was not already answered because he did not go through all that testing, which I did simply to assure you this works fine on all systems and not "just windows".

@iCrawl Older doesn't mean archaic. It simply means that it is not the current version. LTS versions are not necessarily current even when it is the newest, either. They are milestone versions that will be supported for a longer period than the regular releases.

You do not need a passing build to support a platform, much like you do not necessarily support a platform just because it can be built. "Discord.js works on multiple platforms in a stable manner. Approved by a lot of users." answered the question because it was "approved".

I'll just close this issue up, this discussion is pointless, considering I just told you it works fine on the "latest" (as of posting this) too.

If you want to coin and mince words, you can do that, but please don't fill the issue tracker with it.
If there still is a genuine problem, open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dmitry221060 picture Dmitry221060  路  3Comments

PassTheMayo picture PassTheMayo  路  3Comments

iCrawl picture iCrawl  路  3Comments

LLamaFTL picture LLamaFTL  路  3Comments

smchase picture smchase  路  3Comments