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

Element desktop fails to build on Apple M1 Macbook Air #19486

Closed
ghost opened this issue Oct 22, 2021 · 15 comments
Closed

Element desktop fails to build on Apple M1 Macbook Air #19486

ghost opened this issue Oct 22, 2021 · 15 comments
Labels
A-Electron A-Packaging Packaging, signing, releasing O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Cannot-Reproduce Z-Platform-Specific

Comments

@ghost
Copy link

ghost commented Oct 22, 2021

Steps to reproduce

  1. I am strictly following the build steps on element-desktop README file
  2. Run yarn install - succeeded
  3. Run yarn run build:native --target aarch64-apple-darwin - Failed.
  4. Shows error, build failed with error code 1, cannot continue

Outcome

What did you expect?

I expect the build of native modules will finish successfully

What happened instead?

When running the command yarn run build:native --target aarch64-apple-darwin it shows the following error

checking build system type... Invalid configuration `arm64-apple-darwin21.1.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin21.1.0 failed
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Operating system

macOS

Application version

element-dekstop master branch at commit 0af82db

How did you install the app?

Manually building

Homeserver

(Not applicable)

Will you send logs?

No

@ghost ghost added the T-Defect label Oct 22, 2021
@ghost ghost changed the title Fail to build on Apple M1 Macbook Air Element desktop fails to build on Apple M1 Macbook Air Oct 22, 2021
@aaronraimist
Copy link
Collaborator

Hmm it works for me. Are you running your terminal in Rosetta?

@ghost
Copy link
Author

ghost commented Oct 23, 2021 via email

@aaronraimist
Copy link
Collaborator

Are your Xcode command line tools up to date?

xcode-select --install

@ghost
Copy link
Author

ghost commented Oct 23, 2021

Are your Xcode command line tools up to date?

xcode-select --install

Yes they are I am using Command Line Tool version 13.1.0.0.1.1633545042 which is the latest and there are no new updates available

@SimonBrandner SimonBrandner added Z-Platform-Specific A-Packaging Packaging, signing, releasing labels Oct 23, 2021
@dbkr
Copy link
Member

dbkr commented Oct 25, 2021

Looks like it's going wrong when building sqlcipher as part of seshat, which for some reason is detecting your build system as arm64-apple-darwin when it (presumably) should be aarch64-apple-darwin. Quite why this would be, I'm not sure. If you want to try building the package manually, it'll be extracted to .hak/matrix-seshat/aarch64-apple-darwin/sqlcipher-4.3.0. It's possible this is a bug when building M1 natively on M1 (I don't think any of us have M1s so we've only ever cross-compiled). For a real moonshot, you could try just running yarn run build:native (the default will be to build for the native platform and there's an outside change that somehow the cross-compile target is confusing it).

@dbkr dbkr added O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Oct 25, 2021
@ghost
Copy link
Author

ghost commented Oct 26, 2021

Unfortunately even when I run build:native it is still the very same error ouput

@dbkr
Copy link
Member

dbkr commented Nov 19, 2021

Now I have a machine I can try this with, I've tried and it works fine for me (although there's a different bug when using node 17: nodejs/node-gyp#2534) - does it work for you now?

@ghost
Copy link
Author

ghost commented Nov 19, 2021

OK I will try again when I have time and if it works this issue will be closed.

@ghost
Copy link
Author

ghost commented Nov 22, 2021

Unfortunately it still produces the very same eror message as in description. I am now on the latest master at commit 9746517

Here is a more detailed traceback:

checking build system type... Invalid configuration `arm64-apple-darwin21.1.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin21.1.0 failed
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
verbose 0.899665834 Error: Command failed with exit code 1.
    at ProcessTermError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:750:123)
    at new ProcessTermError (/usr/local/lib/node_modules/yarn/lib/cli.js:790:113)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:34672:30
    at Generator.throw (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:323:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

@dbkr
Copy link
Member

dbkr commented Nov 25, 2021

Would you be able to upload the whole log? If there is anything there, chance are its buried somewhere in the pages above.

@ghost
Copy link
Author

ghost commented Nov 26, 2021

Would you be able to upload the whole log? If there is anything there, chance are its buried somewhere in the pages above.

I cannot even build it how am I even supposed to upload the log?

I am not quite clear what to upload :(

Again, I would like to emphasize that this is desktop app not web app

@dbkr
Copy link
Member

dbkr commented Dec 1, 2021

The console log from the terminal you're typing in when you're trying to build element (ie. wherever your snippets above came from).

@ghost
Copy link
Author

ghost commented Dec 1, 2021

 % yarn install
yarn install v1.22.17
warning ../../package.json: No license field
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.13s.
% yarn --verbose run build:native --target aarch64-apple-darwin
yarn run v1.22.17
warning ../../package.json: No license field
verbose 0.082302834 Checking for configuration file "/Users/david/code/element-desktop/.npmrc".
verbose 0.08246425 Checking for configuration file "/Users/david/.npmrc".
verbose 0.08253 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.082660459 Checking for configuration file "/Users/david/code/element-desktop/.npmrc".
verbose 0.082794459 Checking for configuration file "/Users/david/code/.npmrc".
verbose 0.082846292 Checking for configuration file "/Users/david/.npmrc".
verbose 0.082954084 Checking for configuration file "/Users/.npmrc".
verbose 0.083259959 Checking for configuration file "/Users/david/code/element-desktop/.yarnrc".
verbose 0.083358375 Checking for configuration file "/Users/david/.yarnrc".
verbose 0.083414125 Found configuration file "/Users/david/.yarnrc".
verbose 0.0835945 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.083662667 Checking for configuration file "/Users/david/code/element-desktop/.yarnrc".
verbose 0.083734625 Checking for configuration file "/Users/david/code/.yarnrc".
verbose 0.083862042 Checking for configuration file "/Users/david/.yarnrc".
verbose 0.083926167 Found configuration file "/Users/david/.yarnrc".
verbose 0.084082042 Checking for configuration file "/Users/.yarnrc".
verbose 0.085777709 current time: 2021-12-01T20:53:43.243Z
$ yarn run hak --target aarch64-apple-darwin
warning ../../package.json: No license field
$ node scripts/hak/index.js --target aarch64-apple-darwin
hak check: matrix-seshat
hak check: keytar
hak fetch: matrix-seshat
hak fetch: keytar
hak fetchDeps: matrix-seshat
hak fetchDeps: keytar
hak build: matrix-seshat
checking build system type... Invalid configuration `arm64-apple-darwin21.1.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin21.1.0 failed
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
verbose 0.9023815 Error: Command failed with exit code 1.
    at ProcessTermError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:750:123)
    at new ProcessTermError (/usr/local/lib/node_modules/yarn/lib/cli.js:790:113)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:34672:30
    at Generator.throw (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:323:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@ghost
Copy link
Author

ghost commented Dec 6, 2021

@dbkr Found the problem! It is the homebrew coreutils that is the culprit! especially the uname in that version of coreutils
I removed it and then Element built normally

@ghost ghost closed this as completed Dec 6, 2021
@ghost
Copy link
Author

ghost commented Dec 6, 2021

However I run into another issue now as you mentioned above

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.10.0 found at "/opt/homebrew/opt/[email protected]/bin/python3.10"
(node:29530) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.10
gyp info spawn args [
gyp info spawn args   '/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/david/.electron-gyp/13.5.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/david/.electron-gyp/13.5.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/david/.electron-gyp/13.5.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 21.1.0
gyp ERR! command "/opt/homebrew/Cellar/node/17.2.0/bin/node" "/Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/david/code/element-desktop/.hak/keytar/aarch64-apple-darwin/build
gyp ERR! node -v v17.2.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
verbose 6.547370917 Error: Command failed with exit code 1.
    at ProcessTermError.ExtendableBuiltin (/opt/homebrew/lib/node_modules/yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/opt/homebrew/lib/node_modules/yarn/lib/cli.js:750:123)
    at new ProcessTermError (/opt/homebrew/lib/node_modules/yarn/lib/cli.js:790:113)
    at /opt/homebrew/lib/node_modules/yarn/lib/cli.js:34672:30
    at Generator.throw (<anonymous>)
    at step (/opt/homebrew/lib/node_modules/yarn/lib/cli.js:310:30)
    at /opt/homebrew/lib/node_modules/yarn/lib/cli.js:323:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Electron A-Packaging Packaging, signing, releasing O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Cannot-Reproduce Z-Platform-Specific
Projects
None yet
Development

No branches or pull requests

3 participants