TryQuiet / quiet

A private, p2p alternative to Slack and Discord built on Tor & IPFS
https://www.tryquiet.org
GNU General Public License v3.0
1.94k stars 83 forks source link

Developer setup on Apple silicon (M1, M2, arm64) doesn't just work #1213

Closed pdurbin closed 1 year ago

pdurbin commented 1 year ago

NOTE: (from @holmesworcester) someone should get the M1 mac in the office and debug this, either fixing things so that the default dev instructions just work (preferred) or—if it's a much easier path—including instructions in the desktop README for M1/M2 users.

...

I got a new M2 MacBook Air and had trouble running npm run lerna bootstrap as of cbc0c1d80:

npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/pdurbin/.npm/_cacache/tmp/git-clonexHcdWz/node_modules/go-ipfs
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c node src/post-install.js
npm ERR! npm ERR! https://dist.ipfs.io/go-ipfs/versions
npm ERR! npm ERR! Error: No binary available for arch 'undefined'
npm ERR! npm ERR!     at getDownloadURL (/Users/pdurbin/.npm/_cacache/tmp/git-clonexHcdWz/node_modules/go-ipfs/src/download.js:131:11)
npm ERR! npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! npm ERR!     at async download (/Users/pdurbin/.npm/_cacache/tmp/git-clonexHcdWz/node_modules/go-ipfs/src/download.js:139:15)
npm ERR! npm ERR!     at async module.exports (/Users/pdurbin/.npm/_cacache/tmp/git-clonexHcdWz/node_modules/go-ipfs/src/download.js:196:13)
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/pdurbin/.npm/_logs/2023-02-11T02_48_34_696Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/pdurbin/.npm/_logs/2023-02-11T02_48_06_471Z-debug-0.log
lerna ERR! npm install exited 1 in '@quiet/backend'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.

When I run node -e "console.log(process.arch)" I get arm64.

From the log above, it looks like go-ipfs 0.9.1 is being pulled in...

grep 'fetch.*go-ipfs' /Users/pdurbin/.npm/_logs/2023-02-11T02_48_34_696Z-debug-0.log 3570 http fetch GET 200 https://registry.npmjs.org/go-ipfs/-/go-ipfs-0.9.1.tgz 7484ms (cache miss)

... and here's the No binary available for arch 'undefined' error: https://github.com/ipfs/npm-go-ipfs/blob/v0.9.1/src/download.js#L131

That error was also reported here: https://github.com/ipfs/npm-go-ipfs/issues/40 and was apparently fixed in https://github.com/ipfs/npm-go-ipfs/pull/44 which (based on dates of tags) seems to have been released in go-ipfs 0.12.0. So maybe upgrading go-ipfs will help? Or maybe I'm way off. 😅

Here's that log file mentioned above: 2023-02-11T02_48_34_696Z-debug-0.log.txt

pdurbin commented 1 year ago

I have no idea if this helps or not but in https://github.com/pdurbin/quiet/commit/a59d54a I pushed some signed binaries I extracted from Tor Browser.

They at least let me enter the Quiet invite code. However, I get endless errors like this...

backend:registration Fetched http://s42yo3j7joaaunthluafw737p5pbbyps27gpfiiqcj2xz24kn4hzm2id.onion, time: 0.726 +736ms backend:registration:err Registrar responded with 500 "Internal Server Error" (D727CD6D35D42BB5255759EE09D14E59) +736ms backend:socket Registering user certificate (D727CD6D35D42BB5255759EE09D14E59) on http://s42yo3j7joaaunthluafw737p5pbbyps27gpfiiqcj2xz24kn4hzm2id.onion +735ms

... and just spinning in the UI:

Screenshot 2023-05-16 at 10 03 39 PM

This is how I'm checking if binaries are signed (this is the tor binary I extracted from Tor Browser):

% codesign -dvv /Users/pdurbin/github/tryquiet/quiet/3rd-party/tor/darwin/arm64/tor                 
Executable=/Users/pdurbin/github/tryquiet/quiet/3rd-party/tor/darwin/arm64/tor
Identifier=tor
Format=Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=42351 flags=0x10000(runtime) hashes=1315+5 location=embedded
Signature size=8991
Authority=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=May 12, 2023 at 12:05:56 PM
Info.plist=not bound
TeamIdentifier=MADPSAYN6T
Runtime Version=11.0.0
Sealed Resources=none
Internal requirements count=1 size=164

Again, I'm ok with closing this issue. It has gone on and on. Maybe someone else will figure this out in the future. I'm ok with just using Quiet and not being able to develop.

holmesworcester commented 1 year ago

We will have a lot of developers on new macs, so we need to fix this either way and I'd like to do it now.

rubbingalcoholic commented 1 year ago

On my M1 Ultra I'm getting a different compilation error when going through the Developer setup than what is described here. Using Node 18.12.1 and npm 8.19.2, and a completely clean clone of the quiet monorepo, I get the following output when running npm run lerna bootstrap:

jeff@cube quiet % npm run lerna bootstrap

> lerna
> lerna bootstrap

lerna notice cli v4.0.0
lerna info versioning independent
lerna info Bootstrapping 11 packages
lerna info Installing external dependencies
lerna ERR! npm install exited 1 in 'quiet'
lerna ERR! npm install stderr:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-inspector@5.1.1
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN   dev react@"18.1.0" from the root project
npm WARN   80 more (@cypress/react18, @emotion/react, @emotion/styled, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.4 || ^17.0.0" from react-inspector@5.1.1
npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN   react-inspector@"^5.1.0" from @storybook/addon-actions@6.5.14
npm WARN   node_modules/@storybook/addon-actions
npm WARN
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^16.8.4 || ^17.0.0" from react-inspector@5.1.1
npm WARN   node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN     react-inspector@"^5.1.0" from @storybook/addon-actions@6.5.14
npm WARN     node_modules/@storybook/addon-actions
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @mdx-js/react@1.6.22
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN   dev react@"18.1.0" from the root project
npm WARN   80 more (@cypress/react18, @emotion/react, @emotion/styled, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.13.1 || ^17.0.0" from @mdx-js/react@1.6.22
npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
npm WARN   @mdx-js/react@"^1.6.22" from @storybook/addon-docs@6.5.14
npm WARN   node_modules/@storybook/addon-docs
npm WARN
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^16.13.1 || ^17.0.0" from @mdx-js/react@1.6.22
npm WARN   node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
npm WARN     @mdx-js/react@"^1.6.22" from @storybook/addon-docs@6.5.14
npm WARN     node_modules/@storybook/addon-docs
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-element-to-jsx-string@14.3.4
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN   dev react@"18.1.0" from the root project
npm WARN   80 more (@cypress/react18, @emotion/react, @emotion/styled, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.14
npm WARN   node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.14
npm WARN     node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-element-to-jsx-string@14.3.4
npm WARN Found: react-dom@18.1.0
npm WARN node_modules/react-dom
npm WARN   dev react-dom@"18.1.0" from the root project
npm WARN   59 more (@cypress/react18, @mui/base, @mui/lab, @mui/material, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.14
npm WARN   node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: react-dom@17.0.2
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from react-element-to-jsx-string@14.3.4
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/react@6.5.14
npm WARN     node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-swipeable@4.3.0
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN   dev react@"18.1.0" from the root project
npm WARN   80 more (@cypress/react18, @emotion/react, @emotion/styled, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.0 || ^15.0.0-0 || ^16.0.0-0" from react-swipeable@4.3.0
npm WARN node_modules/react-alice-carousel/node_modules/react-swipeable
npm WARN   react-swipeable@"4.3.0" from react-alice-carousel@1.15.3
npm WARN   node_modules/react-alice-carousel
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^0.14.0 || ^15.0.0-0 || ^16.0.0-0" from react-swipeable@4.3.0
npm WARN   node_modules/react-alice-carousel/node_modules/react-swipeable
npm WARN     react-swipeable@"4.3.0" from react-alice-carousel@1.15.3
npm WARN     node_modules/react-alice-carousel
npm WARN deprecated set-value@2.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN deprecated mixin-deep@1.3.1: Critical bug fixed in v2.0.1, please upgrade to the latest version.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated set-value@0.4.3: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated trim@0.0.1: Use String.prototype.trim() instead
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated redux-devtools-extension@2.13.8: Package moved to @redux-devtools/extension.
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated electron-notarize@0.2.1: Please use @electron/notarize moving forward.  There is no API change, just a package name change
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated asar@3.2.0: Please use @electron/asar moving forward.  There is no API change, just a package name change
npm WARN deprecated uuid@3.3.2: 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 source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated electron-osx-sign@0.6.0: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm WARN deprecated core-js@2.6.4: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.21.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.21.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/jeff/htdocs/quiet/packages/desktop/node_modules/utf-8-validate
npm ERR! command failed
npm ERR! command sh -c -- node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@5.1.1
npm ERR! gyp info using node@18.12.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.3 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
npm ERR! (node:1885) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/jeff/htdocs/quiet/packages/desktop/node_modules/utf-8-validate/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/jeff/htdocs/quiet/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/jeff/Library/Caches/node-gyp/18.12.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/jeff/Library/Caches/node-gyp/18.12.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/jeff/htdocs/quiet/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/jeff/Library/Caches/node-gyp/18.12.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/jeff/htdocs/quiet/packages/desktop/node_modules/utf-8-validate',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
npm ERR!     sys.exit(gyp.script_main())
npm ERR!              ^^^^^^^^^^^^^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
npm ERR!     return main(sys.argv[1:])
npm ERR!            ^^^^^^^^^^^^^^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
npm ERR!     return gyp_main(args)
npm ERR!            ^^^^^^^^^^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 520, in gyp_main
npm ERR!     [generator, flat_list, targets, data] = Load(
npm ERR!                                             ^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 136, in Load
npm ERR!     result = gyp.input.Load(build_files, default_variables, includes[:],
npm ERR!              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2782, in Load
npm ERR!     LoadTargetBuildFile(build_file, data, aux_data,
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
npm ERR!     build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
npm ERR!                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR!   File "/Users/jeff/htdocs/quiet/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 234, in LoadOneBuildFile
npm ERR!     build_file_contents = open(build_file_path, 'rU').read()
npm ERR!                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! ValueError: invalid mode: 'rU' while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/jeff/htdocs/quiet/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/Users/jeff/.nvm/versions/node/v18.12.1/bin/node" "/Users/jeff/htdocs/quiet/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/jeff/htdocs/quiet/packages/desktop/node_modules/utf-8-validate
npm ERR! gyp ERR! node -v v18.12.1
npm ERR! gyp ERR! node-gyp -v v5.1.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jeff/.npm/_logs/2023-05-25T22_06_36_983Z-debug-0.log
lerna ERR! npm install exited 1 in 'quiet'
pdurbin commented 1 year ago

@rubbingalcoholic what commit are you on, please?

rubbingalcoholic commented 1 year ago

@pdurbin commit 1c08a04216baa55589a785a2500109f6afdb61ff on branch #882

holmesworcester commented 1 year ago

@pdurbin I just looked more closely at your last issue and I don't want to jinx it but I think congratulations are in order: it looks like Quiet is working just fine, but the registrar for the community you are trying to join (our community perhaps) was offline or unreachable.

Instead of trying to connect at first, try creating your own community. Then perhaps try running another production Quiet from the CLI using DATA_DIR="some-other-folder" (or running it on an Android phone) and joining your community with that Quiet.

I think it should work. Let me know if it doesn't!

holmesworcester commented 1 year ago

Also, @rubbingalcoholic you're all set now with this right? since you'll be using linux instead?

holmesworcester commented 1 year ago

@EmiM the remaining things to close this ticket are to either:

  1. put all additional necessary steps in the README and confirm that they work on a fresh setup (fresh user account e.g.)
  2. change build scripts so that there are no additional necessary steps and the instructions are the same for M1
EmiM commented 1 year ago

I tried running the project on fresh account on M1 and Intel. I adjusted project files and code instead of readme and after those changes everything went smoothly: https://github.com/TryQuiet/quiet/pull/1566/files

pdurbin commented 1 year ago

I adjusted project files and code instead of readme and after those changes everything went smoothly: https://github.com/TryQuiet/quiet/pull/1566/files

I just tried again even without the files above. I'm on the develop branch as of 8f4e0386b.

First I was telling @holmesworcester tonight that it's still not working, that I wasn't having trouble joining the #Quiet-team community. He explained that developers using the develop branch shouldn't expect to always be able to join that community. Instead, developers commonly create a community. I just tried this and it seemed to work fine.

In order to create a new community and not join #Quiet-team, I move aside the dev directory, as @holmesworcester suggested:

cd ~/Library/Application\ Support && mv Quietdev Quietdev.moved

Closing. Thanks!