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

error when building on arm64 MacBook #7

Closed
jwatte opened this issue Dec 22, 2021 · 23 comments
Closed

error when building on arm64 MacBook #7

jwatte opened this issue Dec 22, 2021 · 23 comments

Comments

@jwatte
Copy link

jwatte commented Dec 22, 2021

Note that there exists a fix for building on M1:
google/cpu_features#211

Also, this module is broken. The cause of the breakage (upstream or not) doesn't really matter -- unless you're saying "I never plan on fixing this," keeping the issue open helps the community understand what's going on.

Finally, I predict this will become more of a pressing issue now that Apple has stopped selling x64 MacBook Pros entirely, AND this module is a dependency of the electron installer builders.

@mscdex
Copy link
Owner

mscdex commented Dec 22, 2021

I'm not keen on having to patch dependencies like this because I'm not familiar with the cpu_features codebase (let alone macs), so I'm not really qualified to say whether the changes in one PR or another is correct (there are multiple PRs now to add M1 support in cpu_features, all delayed for various reasons).

@jwatte
Copy link
Author

jwatte commented Dec 22, 2021

That's fair, but I propose the issue is kept open until the problem no longer exists.
One way or another, the upstream will presumably pick one of the fixes ...

@lxe
Copy link

lxe commented Feb 1, 2022

@mscdex looks like you've fixed all the build issues for M1 Macs, but I'm not seeing the new commits published to npm. Would you mind getting a new version out? Thanks!

@starzou
Copy link

starzou commented Feb 22, 2022

@mscdex Hello, Are there new plans?

@mscdex
Copy link
Owner

mscdex commented Feb 22, 2022

AFAIK there is still no M1 support upstream. The only Apple-related fixes that I originally floated and were eventually made upstream (which I pulled in awhile back) were for macOS x86.

@bompi88
Copy link

bompi88 commented Mar 8, 2022

@mscdex A new version is now available: https://github.com/google/cpu_features/releases/tag/v0.7.0

@technicalpickles
Copy link

It took me a minute to realize the dependency is bundled in deps/cpu_features. I tried grabbing the tarball and replacing the directory, but it looks like it's more involved than that.

@mscdex
Copy link
Owner

mscdex commented Mar 17, 2022

I've landed cpu_features v0.7.0 in the master branch. Everyone feel free to give it a whirl and let me know how it works for you.

@mscdex
Copy link
Owner

mscdex commented Mar 24, 2022

I'm going to assume the aforementioned upgrade fixed things. If not, let me know.

@ckortekaas
Copy link

@mscdex I'm afraid after upgrading to ssh 1.8.0 which brings in cpu-features 0.3 I started getting "dyld missing symbol called" in my jest integration tests and webpack compilation. This is on a Macbook Pro M1 Max with MacOS 12.3 and Node 16.14.2. I'm happy to run any debug commands locally that might help. For now, I've pinned ssh back to 1.7.0. Thanks for your hard work on these libraries 🙇‍♂️

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2022

@ckortekaas If you're getting them from ssh2, then please create an issue in that repo.

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2022

If anyone here is getting those symbol errors while running the cpu-features tests, can you provide a backtrace (via gdb or lldb or similar) to show what the missing symbol is? You may need to switch from Release to Debug in lib/index.js and node-gyp --debug rebuild in order to see symbols and proper backtraces.

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2022

FWIW I can't reproduce those errors on Github's infrastructure and I don't have any mac hardware myself to test on.

@alexbosworth
Copy link

I'm not sure if this helps but here is what I get in lldb

dyld[11400]: missing symbol called
Process 11400 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x000000010490f4dc dyld`__abort_with_payload + 8
dyld`__abort_with_payload:
->  0x10490f4dc <+8>:  b.lo   0x10490f4fc               ; <+40>
    0x10490f4e0 <+12>: pacibsp 
    0x10490f4e4 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x10490f4e8 <+20>: mov    x29, sp
Target 0: (node) stopped.

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2022

@alexbosworth What does bt show?

@alexbosworth
Copy link

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x000000010490f4dc dyld`__abort_with_payload + 8
    frame #1: 0x00000001049164dc dyld`abort_with_payload_wrapper_internal + 104
    frame #2: 0x0000000104916510 dyld`abort_with_payload + 16
    frame #3: 0x00000001048ce8e4 dyld`dyld4::halt(char const*) + 328
    frame #4: 0x00000001048ecf7c dyld`dyld4::APIs::_dyld_missing_symbol_abort() + 44
    frame #5: 0x0000000104ad9278 cpufeatures.node`GetCPUInfo(info=0x000000016fdfe6a0) at binding.cc:117:31
    frame #6: 0x0000000104adb244 cpufeatures.node`Nan::imp::FunctionCallbackWrapper(info=0x000000016fdfe6f0) at nan_callbacks_12_inl.h:176:3
    frame #7: 0x0000000100270d78 node`v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) + 276
    frame #8: 0x0000000100270870 node`v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 468
    frame #9: 0x00000001002700fc node`v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) + 228
    frame #10: 0x00000001009b0bcc node`Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 108
    frame #11: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #12: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #13: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #14: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #15: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #16: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #17: 0x0000000100944718 node`Builtins_InterpreterEntryTrampoline + 248
    frame #18: 0x000000010094250c node`Builtins_JSEntryTrampoline + 172
    frame #19: 0x00000001009421a4 node`Builtins_JSEntry + 164
    frame #20: 0x0000000100313d64 node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 2388
    frame #21: 0x00000001003133f8 node`v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 200
    frame #22: 0x0000000100220888 node`v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 520
    frame #23: 0x0000000100083f5c node`node::ExecuteBootstrapper(node::Environment*, char const*, std::__1::vector<v8::Local<v8::String>, std::__1::allocator<v8::Local<v8::String> > >*, std::__1::vector<v8::Local<v8::Value>, std::__1::allocator<v8::Local<v8::Value> > >*) + 104
    frame #24: 0x0000000100084fc0 node`node::StartExecution(node::Environment*, char const*) + 312
    frame #25: 0x0000000100084e6c node`node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) + 1044
    frame #26: 0x0000000100005a1c node`node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) + 136
    frame #27: 0x00000001000ee580 node`node::NodeMainInstance::Run(int*, node::Environment*) + 72
    frame #28: 0x00000001000ee27c node`node::NodeMainInstance::Run(node::EnvSerializeInfo const*) + 120
    frame #29: 0x0000000100087080 node`node::Start(int, char**) + 184
    frame #30: 0x00000001048c90f4 dyld`start + 520

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2022

Looks like cpu_features' support for M1 macs isn't complete then. 🤷‍♂️

So I guess if you want to see it fixed, continue to bug them about it/test for them over on their repo.

I guess something like this PR will fix things as that should resolve the undefined symbol issue. Whether or not additional changes are needed for reading the M1's CPU features compared to the existing solutions for arm64-based systems (e.g. Linux), I don't know.

@alexbosworth
Copy link

I guess something like this PR will fix things as that should resolve the undefined symbol issue. Whether or not additional changes are needed for reading the M1's CPU features compared to the existing solutions for arm64-based systems (e.g. Linux), I don't know.

Cool, yeah sounds like the problem derives from lack of support there and it seems like a fix is in progress

@FabianFrank
Copy link

Allegedly fixed in the latest release of cpu_features https://github.com/google/cpu_features/releases/tag/v0.7.0 with google/cpu_features#209

@mscdex
Copy link
Owner

mscdex commented Mar 30, 2022

@FabianFrank Unfortunately the support is not complete with v0.7.0.

@alexbosworth
Copy link

Seems like this issue went away for me when I updated to MacOS 12.3

@mscdex
Copy link
Owner

mscdex commented Apr 5, 2022

@alexbosworth The underlying problem still exists (M1 support doesn't actually exist in cpu_features), the only difference is that we now explicitly report the M1 as an unknown CPU without any feature flags instead of crashing at runtime.

@alexbosworth
Copy link

Ah great thanks

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

9 participants