node-datachannel
node-datachannel copied to clipboard
Need prebuilt for darwin arm64 (Mac M1)
Install on Mac M1, and got error:
npm ERR! [
npm ERR! '/usr/local/bin/node',
npm ERR! '/Users/king/Tests/sctp-to-webrtc/node_modules/node-datachannel/node_modules/.bin/cmake-js',
npm ERR! 'rebuild',
npm ERR! '--runtime-version=16.15.1',
npm ERR! '--arch=arm64',
npm ERR! '--runtime=node'
npm ERR! ]
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=16.15.1 runtime=node arch=arm64 libc= platform=darwin)
It seems like lacking of arm64 darwin prebuilt.
Hi I am using GitHub to build binaries. GitHub does not have Mac arm64 system yet unfortunately.
node-datachannel-v0.3.4-node-v93-darwin-arm64.tar.gz
I've build one at NodeJS 16.15.1, for someone needed.
@murat-dogan
After tested at Win(x64), Linux(arm64), Mac(arm64), I found that it seems only matter the cpu architechture. Any lower node version is compatible for newer.
Sorry for late reply. Thanks for the comments.
Hi @murat-dogan, I think this is possible, and we should open this up again and try to make it work.
I've just had one of my users downstream also open an issue that seems to be caused by this (https://github.com/httptoolkit/mockrtc/issues/2), and this will affect all Mac M1s, which are rapidly becoming very popular computers, so this is going to be a big problem if we don't fix it. It's worth noting that this issue is also the 3rd issue in this repo from users struggling with this (https://github.com/murat-dogan/node-datachannel/issues/63, https://github.com/murat-dogan/node-datachannel/issues/28) and there will only be more of these.
I'm pretty sure this is doable, because there's other projects building M1-compatible 'universal' binaries with prebuild
and GitHub Actions, such as Leveldown. Their code to do exactly this is here: https://github.com/Level/leveldown/commit/26ea71723e1aca5f40c66df40bd3ba69675bb301
It looks like if you upgrade the GitHub Action OS to Mac v11, and pass the extra flags they're using in that commit, then it'll build a universal binary, that works for both ARM & x64 Mac users. Would that work here?
We'll need to find somebody with an M1 Mac to test the output though - maybe @lichstam or @k8w can help us out?
i'm available to help with testing :)
Ok. Good points. Let me check it.
Here is what I found till now.
-
macos-latest
andmacos-11
are same OS - According to this issue https://github.com/actions/virtual-environments/issues/2187 github does not support Mac M1 yet
- XCode compiler supports arm64 compilation
I created a seperate github action to test this. Here is the output of the action. https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.5-dev/node-datachannel-v0.3.5-dev-node-v93-darwin-x64.tar.gz
Could you please download and test the binary @lichstam?
Any news on this @lichstam ?
@murat-dogan i am available to test. But, how am I supposed to test it?
I tried calling it directly via node, but I am quite confused here.
node /Users/quantum/Downloads/build/Release/node_datachannel.node
node:internal/modules/cjs/loader:1204
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: dlopen(/Users/quantum/Downloads/build/Release/node_datachannel.node, 0x0001): tried: '/Users/quantum/Downloads/build/Release/node_datachannel.node' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
at Module._extensions..node (node:internal/modules/cjs/loader:1204:18)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v18.7.0
I have m2 not m1 tho.
@shirshak55 I think you wanted to clone this repo & npm install, and then save node_datachannel.node
as <repo path>/build/Release/node_datachannel.node
(not run it directly) and then run this repo's tests to see if it works.
That error suggests there's already an issue though @murat-dogan - the binary there is x86_64
, it's not an ARM binary at all... I've just extracted it myself to check, and I see the same thing:
$ file <extracted tarball>/build/Release/node_datachannel.node
build/Release/node_datachannel.node: Mach-O 64-bit x86_64 dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|NO_REEXPORTED_DYLIBS>
I think Mach-O 64-bit x86_64
should be Mach-O 64-bit arm64e
or similar? Not sure what's going wrong, but looks like it hasn't been cross-compiled.
That's right @pimterry , thank you for the hint. I have compiled it again, now it seems ok.
@shirshak55
git clone https://github.com/murat-dogan/node-datachannel.git
cd node-datachannel
npm install --ignore-scripts
- download https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
- extract tar.gz
- check file is ok
<repo path>/build/Release/node_datachannel.node
- run
npm test
@murat-dogan done
npm test
> [email protected] test
> jest
PASS test/test.js (12.215 s)
Module Definition
✓ Module Defined (1 ms)
PeerConnection Classes
✓ Create PeerConnection (1 ms)
✓ Create Data Channel (57 ms)
P2P
✓ P2P (12007 ms)
DataChannel streams
✓ can build an echo pipeline (13 ms)
Test Suites: 1 passed, 1 total
Tests: 5 passed, 5 total
Snapshots: 0 total
Time: 12.238 s
Ran all test suites.
Here is the output for future purpose
CLICK ME
git clone https://github.com/murat-dogan/node-datachannel.git
Cloning into 'node-datachannel'...
remote: Enumerating objects: 1763, done.
remote: Counting objects: 100% (371/371), done.
remote: Compressing objects: 100% (191/191), done.
remote: Total 1763 (delta 219), reused 292 (delta 180), pack-reused 1392
Receiving objects: 100% (1763/1763), 773.96 KiB | 4.32 MiB/s, done.
Resolving deltas: 100% (1054/1054), done.
cd node-datachannel
npm install --ignore-scripts
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
added 635 packages, and audited 636 packages in 8s
58 packages are looking for funding
run `npm fund` for details
4 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
wget https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
zsh: command not found: wget
brew install wget
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
burst purescript-language-server rdb ripsecrets
==> New Casks
decentr filen fresh goxel
You have 8 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Downloading https://ghcr.io/v2/homebrew/core/wget/manifests/1.21.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/wget/blobs/sha256:fc83eec77acee50d2d7ce3bb0cca08d80acccc148e909921de42e57dd5fc7f3d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:fc83eec77acee50d2d7ce3bb0cca08d80acccc148e909921de42e57dd5fc7f3d?s
######################################################################## 100.0%
==> Pouring wget--1.21.3.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/wget/1.21.3: 89 files, 4.2MB
==> Running `brew cleanup wget`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
ls
API.md LICENSE examples package-lock.json test
BULDING.md README.md lib package.json
CMakeLists.txt cmake node_modules src
ls
API.md LICENSE examples package-lock.json test
BULDING.md README.md lib package.json
CMakeLists.txt cmake node_modules src
wgethttps://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
zsh: no such file or directory: wgethttps://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
wget https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
--2022-08-20 09:41:35-- https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
Resolving github.com (github.com)... 140.82.113.4
Connecting to github.com (github.com)|140.82.113.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/282229865/879f7be9-2921-4321-9729-440961f5304e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220820%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220820T144137Z&X-Amz-Expires=300&X-Amz-Signature=700385425d5146af60ff3c3a5cbb39cf30eb06e0cb572bad316a499c07c07fa3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=282229865&response-content-disposition=attachment%3B%20filename%3Dnode-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-08-20 09:41:37-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/282229865/879f7be9-2921-4321-9729-440961f5304e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220820%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220820T144137Z&X-Amz-Expires=300&X-Amz-Signature=700385425d5146af60ff3c3a5cbb39cf30eb06e0cb572bad316a499c07c07fa3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=282229865&response-content-disposition=attachment%3B%20filename%3Dnode-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 779888 (762K) [application/octet-stream]
Saving to: ‘node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz’
node-datachannel-v0.3.6-dev-node-v93- 100%[========================================================================>] 761.61K 1.06MB/s in 0.7s
2022-08-20 09:41:38 (1.06 MB/s) - ‘node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz’ saved [779888/779888]
ls
API.md lib
BULDING.md node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
CMakeLists.txt node_modules
LICENSE package-lock.json
README.md package.json
cmake src
examples test
ls
API.md lib
BULDING.md node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
CMakeLists.txt node_modules
LICENSE package-lock.json
README.md package.json
cmake src
examples test
ls
API.md lib
BULDING.md node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
CMakeLists.txt node_modules
LICENSE package-lock.json
README.md package.json
cmake src
examples test
mkdir -p build/Release
ls
API.md lib
BULDING.md node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
CMakeLists.txt node_modules
LICENSE package-lock.json
README.md package.json
build src
cmake test
examples
tar -xvz node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
^C
open .
tar -xvz node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
^C
wget https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
--2022-08-20 09:42:39-- https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev/node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz
Resolving github.com (github.com)... 140.82.113.4
Connecting to github.com (github.com)|140.82.113.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/282229865/879f7be9-2921-4321-9729-440961f5304e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220820%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220820T144137Z&X-Amz-Expires=300&X-Amz-Signature=700385425d5146af60ff3c3a5cbb39cf30eb06e0cb572bad316a499c07c07fa3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=282229865&response-content-disposition=attachment%3B%20filename%3Dnode-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-08-20 09:42:40-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/282229865/879f7be9-2921-4321-9729-440961f5304e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220820%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220820T144137Z&X-Amz-Expires=300&X-Amz-Signature=700385425d5146af60ff3c3a5cbb39cf30eb06e0cb572bad316a499c07c07fa3&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=282229865&response-content-disposition=attachment%3B%20filename%3Dnode-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 779888 (762K) [application/octet-stream]
Saving to: ‘node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz’
node-datachannel-v0.3.6-dev-node-v93- 100%[========================================================================>] 761.61K 2.23MB/s in 0.3s
2022-08-20 09:42:41 (2.23 MB/s) - ‘node-datachannel-v0.3.6-dev-node-v93-darwin-arm64.tar.gz’ saved [779888/779888]
npm test
> [email protected] test
> jest
PASS test/test.js (12.215 s)
Module Definition
✓ Module Defined (1 ms)
PeerConnection Classes
✓ Create PeerConnection (1 ms)
✓ Create Data Channel (57 ms)
P2P
✓ P2P (12007 ms)
DataChannel streams
✓ can build an echo pipeline (13 ms)
Test Suites: 1 passed, 1 total
Tests: 5 passed, 5 total
Snapshots: 0 total
Time: 12.238 s
Ran all test suites.
Thank you @shirshak55 ! Could you please try again with this binary; https://github.com/murat-dogan/node-datachannel/releases/download/v0.3.6-dev2/node-datachannel-v0.3.6-dev2-node-v93-darwin-arm64.tar.gz
it is statically linked against openssl
@murat-dogan
git clone https://github.com/murat-dogan/node-datachannel.git
Cloning into 'node-datachannel'...
remote: Enumerating objects: 1690, done.
remote: Counting objects: 100% (301/301), done.
remote: Compressing objects: 100% (138/138), done.
remote: Total 1690 (delta 179), reused 246 (delta 163), pack-reused 1389
Receiving objects: 100% (1690/1690), 775.58 KiB | 3.84 MiB/s, done.
Resolving deltas: 100% (1012/1012), done.
cd node-datachannel/
npm install --ignore-scripts
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
added 635 packages, and audited 636 packages in 9s
58 packages are looking for funding
run `npm fund` for details
4 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm test
> [email protected] test
> jest
PASS test/test.js (12.212 s)
Module Definition
✓ Module Defined (2 ms)
PeerConnection Classes
✓ Create PeerConnection
✓ Create Data Channel (56 ms)
P2P
✓ P2P (12008 ms)
DataChannel streams
✓ can build an echo pipeline (21 ms)
Test Suites: 1 passed, 1 total
Tests: 5 passed, 5 total
Snapshots: 0 total
Time: 12.23 s
Ran all test suites.
shasum build/Release/node_datachannel.node
d50246e8a2bcc6181d87bbf3090b46c21f01f420 build/Release/node_datachannel.node
Thank you for fast response.
Now we have mac m1 binaries! Thank you!
Note: I could not find a way to create a universal binary (arm64+x64). Reason for that is we are using openssl, and I could not find a universally compiled openssl lib.
Mac m1 binaries will be released with v0.3.6