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

Build from source crashing on Mac (M1) #19925

Closed
jthoma opened this issue Nov 29, 2021 · 9 comments
Closed

Build from source crashing on Mac (M1) #19925

jthoma opened this issue Nov 29, 2021 · 9 comments
Labels
A-Developer-Experience A-Electron A-Packaging Packaging, signing, releasing O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Critical Prevents work, causes data loss and/or has no workaround Z-Platform-Specific

Comments

@jthoma
Copy link

jthoma commented Nov 29, 2021

Steps to reproduce

Build instructions went smooth and the .dmg was created. It could be installed, but on starting it crashes.

Outcome

Not sure if it is due to the build:native building and linking for x86_64 under darwin. My mac PowerBook is having M1 arm64e chipset.

Operating system

macOS

Application version

No response

How did you install the app?

No response

Homeserver

No response

Will you send logs?

No

@SimonBrandner SimonBrandner added A-Electron O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Critical Prevents work, causes data loss and/or has no workaround Z-Platform-Specific A-Packaging Packaging, signing, releasing labels Nov 29, 2021
@novocaine
Copy link
Contributor

novocaine commented Nov 29, 2021

The production build doesn't crash on M1, so something has gone wrong with packaging on your machine (possibly, our instructions are lacking)

To debug, you can try running the binary from gdb and inspecting the stack trace to see where it's dying.

@novocaine novocaine changed the title Crashing on Mac (M1) Build from source crashing on Mac (M1) Nov 29, 2021
@jthoma
Copy link
Author

jthoma commented Nov 29, 2021

Sure will do, meanwhile when I tried "yarn start" there was an error on the console, but the UI started up.
Keytar unexpected error: Error: dlopen(/Users/jijumathew/Projects/element-desktop/.hak/hakModules/keytar/build/Release/keytar.node, 0x0001): tried: '/Users/jijumathew/Projects/element-desktop/.hak/hakModules/keytar/build/Release/keytar.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/keytar.node' (no such file), '/usr/lib/keytar.node' (no such file)

@novocaine
Copy link
Contributor

aha, that looks similar to atom/node-keytar#406 (comment)

@jthoma
Copy link
Author

jthoma commented Nov 29, 2021

Yes, it is, though I read somewhere that "yarn run build:native" will detect the platform and build accordingly; but it seems that the automatic behaviour is just detecting the "darwin" and assuming the chipset to be x86_64. Someone, please guide me how to hint the same to try compiling for arm64e for the native modules it could be better off..

@novocaine
Copy link
Contributor

@dbkr might be best placed to answer that, although I think this might be more a conversation for #element-dev

@dbkr
Copy link
Member

dbkr commented Nov 30, 2021

Yes, it should auto detect: I've just confirmed by starting from fresh and running, yarn run build:native, and I get an arm64 binary:

file .hak/hakModules/matrix-seshat/native/index.node
.hak/hakModules/matrix-seshat/native/index.node: Mach-O 64-bit dynamically linked shared library arm64

You can force the architecture as per the readme file, but I think we'd need to see exactly what you're running and what logs you're getting to be any more help.

@jryans
Copy link
Collaborator

jryans commented Nov 30, 2021

I suspect we may need to know details like which Xcode version you have installed, etc.

Do you perhaps have some non-Apple toolchain on your path as the default complier or linker? That is likely to confuse things.

@jthoma
Copy link
Author

jthoma commented Dec 1, 2021

@jryans :) just started using mac 2 weeks back, and even xcode was installed from the apple store - no idea about checking these things.

xcodebuild -version

Xcode 13.1
Build version 13A1030d

@jthoma
Copy link
Author

jthoma commented Dec 1, 2021

Thanks guyz, it was my ignorance. Somehow package.json was from an old release, once updated and followed the documented process the arm64 binary is built

@jthoma jthoma closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Developer-Experience A-Electron A-Packaging Packaging, signing, releasing O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Critical Prevents work, causes data loss and/or has no workaround Z-Platform-Specific
Projects
None yet
Development

No branches or pull requests

5 participants