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

Can't install webtorrent-cli in npm #313

Open
asimovc opened this issue Jun 15, 2024 · 10 comments
Open

Can't install webtorrent-cli in npm #313

asimovc opened this issue Jun 15, 2024 · 10 comments

Comments

@asimovc
Copy link

asimovc commented Jun 15, 2024

What version of this package are you using?
npm version

What operating system, Node.js, and npm version?
OS: Kiss Linux (musl and busybox based distro)
Node.js: v22.3.0
Npm: v10.8.1

What happened?
Can't install webtorrent-cli with `npm install webtorrent-cli -g

`What did you expect to happen?
Installation complete of webtorrent-cli

Are you willing to submit a pull request to fix this bug?
No

@asimovc
Copy link
Author

asimovc commented Jun 15, 2024

Here some logs

@SilentBot1
Copy link
Member

Hey @asimovc,

WebTorrent >= 2.3.0 now has WebRTC support, provided by the dependency node-datachannel.

node-datachannel provides prebuilds of libdatachannel (the underlying native library) for all officially supported versions of NodeJS, but the musl version of NodeJS is considered unofficial, and is not currently provided.

If you wish to use webtorrent>=2.3.0 or webtorrent-cli>=5.0.0 on musl, you must install the build requirements for libdatachannel, which can be done by running the following command: apk add build-base cmake git openssl-libs-static openssl-dev.

Alternatively, you can downgrade webtorrent to <2.3.0 or webtorrent-cli to <5.0.0, though from my little testing, the utp-native dependency also appears to cause issues and is segfaulting currently.

We're investigating whether we can help node-datachannel provide a pre-built version of libdatachannel for musl so you do not need to install and build this locally and also fix any outstanding issues with utp-native, though as we don't officially support musl, this is not a priority from our side unfortunately.

@asimovc
Copy link
Author

asimovc commented Jun 16, 2024

I have cmake 3.29.5-1, openssl 3.3.1-1 and git 2.45.2-1

@SilentBot1
Copy link
Member

SilentBot1 commented Jun 16, 2024

Hi @asimovc,

The error specifically in your build appears to be:

1623 error /home/hellboy/.npm/lib/node_modules/webtorrent-cli/node_modules/node-datachannel/build/_deps/libdatachannel-src/src/h264rtpdepacketizer.cpp: In member function 'virtual void rtc::H264RtpDepacketizer::incoming(rtc::message_vector&, const rtc::message_callback&)':
1623 error /home/hellboy/.npm/lib/node_modules/webtorrent-cli/node_modules/node-datachannel/build/_deps/libdatachannel-src/src/h264rtpdepacketizer.cpp:116:29: error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'?
1623 error   116 |         messages.erase(std::remove_if(messages.begin(), messages.end(),
1623 error       |                             ^~~~~~~~~
1623 error       |                             remove_cv

This appears to relate to the issue paullouisageneau/libdatachannel#1173 on libdatachannel, but this was fixed in May in this PR: paullouisageneau/libdatachannel#1183

From a fresh alpine container, I can successfully install webtorrent-cli as seen below, with the exact above dependencies:
image

Can you clear out anything you have cached, and try this again?

Note: Even outside of libdatachannel not building successfully, utp-native appears to cause a segfault on musl, so will almost always crash webtorrent-cli, this is due to utp-native installing the glibc native dependency (as there is no musl build). I have created a PR here which adds musl support to utp-native, and should prevent the wrong libc from being used.

@asimovc
Copy link
Author

asimovc commented Jun 17, 2024

I cleared my _ccache in node install dir and still not build

@SilentBot1
Copy link
Member

SilentBot1 commented Jun 18, 2024

I've made a PR here (along with @funniray) which adds musl prebuilds for libdatachannel to node-datachannel, which should remove the requirement for you to need to build this locally once implemented.

@asimovc
Copy link
Author

asimovc commented Jun 18, 2024

@SilentBot1 Thanks i also made a issue about the version, i seems node-datachannel is not in the latest version of libdatachannel that's why i get these failed build

@asimovc
Copy link
Author

asimovc commented Jun 30, 2024

@SilentBot1 node-datachannel already made a PR that builds fine in musl, please update the dependencies version

@SilentBot1
Copy link
Member

I'm aware @asimovc, It was my PR murat-dogan/node-datachannel#264.

I will update the dependency once they fix OSX builds, which are currently not building.

@SilentBot1
Copy link
Member

Just to provide an update, you should now be able to install this app on Alpine / musl-based systems, but utp-native will still throw a segfault due to not having musl builds as this pr has not been merged/reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants