Luban icon indicating copy to clipboard operation
Luban copied to clipboard

Bug: arm64 build requires rosetta to be installed in 3d printing

Open oizone opened this issue 1 year ago • 8 comments

🐞 bug report

Affected Version(s)

The issue is caused by version 4.10.2

Is this a regression?

Not working with older versions either

To Reproduce

Steps to reproduce the behavior:

  1. Using macos arm64 without rosetta installed
  2. Go to '3d printing'
  3. Click on 'open stl'
  4. UI hangs at 75%

server.log error


2024-02-04T10:52:41.588Z - error uncaughtException: spawn Unknown system error -86
Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:415:11)
    at Object.spawn (node:child_process:707:9)
    at Slicer.slice (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:1014398)
    at Slicer.end (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:1015201)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:852808
    at handleCheckModel (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:853114)
    at t.value [as channelMiddleware] (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:194915)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:196160
    at Socket. (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:194347)
    at Socket.emit (node:events:394:28)
    at Socket.emitUntyped (/Applications/Snapmaker Luban.app/Contents/Resources/app/node_modules/socket.io/dist/typed-events.js:69:22)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/node_modules/socket.io/dist/socket.js:614:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
2024-02-04T10:52:41.588Z - error app uncaught exception Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:415:11)
    at Object.spawn (node:child_process:707:9)
    at Slicer.slice (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:1014398)
    at Slicer.end (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:1015201)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:852808
    at handleCheckModel (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:853114)
    at t.value [as channelMiddleware] (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:194915)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:196160
    at Socket. (/Applications/Snapmaker Luban.app/Contents/Resources/app/src/server/index.js:2:194347)
    at Socket.emit (node:events:394:28)
    at Socket.emitUntyped (/Applications/Snapmaker Luban.app/Contents/Resources/app/node_modules/socket.io/dist/typed-events.js:69:22)
    at /Applications/Snapmaker Luban.app/Contents/Resources/app/node_modules/socket.io/dist/socket.js:614:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

Expected behavior Was expecting the stl to be opened in the preview.

The doesn't happen if rosetta is installed, but the build should be arm64 right?

🌍 Your Environment

Platform:



- Operating System: macOS Sonoma 14.2.1
- Printer: Snapmaker A350

oizone avatar Feb 04 '24 12:02 oizone

I have the exact same issue. I have an M2 mac and just tried building the binary locally, and the same error occurs, so I don't think the problem is that the build is not ARM64 as I do not have Rosetta installed.

There seems to be problems with Ubuntu ARM64 builds as well: #2101

So I'm wondering if the issue is ARM64 support across the board?

I will try to dig a bit in this issue.

neerdoc avatar Apr 09 '24 12:04 neerdoc

@oizone You are correct in your report that the build is not arm64, at least not completely!

The root cause of the problem seems to be that the npm package @snapmaker/snapmaker-lunar contains pre-compiled binaries for only three platforms: Windows-x64, linux-x86_64 and MacOS-x86_64. Thus, when trying to execute the slicer, the spawn of the process fails since the installed binary has the wrong architecture. In my case, I'm missing a MacOS-arm64 binary.

I have not found the source of the snapmaker-lunar package anywhere so I cannot build it by myself.

Doing a file node_modules/@snapmaker/snapmaker-lunar/engine/MacOS/LunarSlicer clearly show the problem: node_modules/@snapmaker/snapmaker-lunar/engine/MacOS/LunarSlicer: Mach-O 64-bit executable x86_64 which causes the error: zsh: bad CPU type in executable: node_modules/@snapmaker/snapmaker-lunar/engine/MacOS/LunarSlicer

@parachvte Is the source code for the lunar slicer available somewhere so we can build it for arm64?

neerdoc avatar Apr 10 '24 12:04 neerdoc

@oizone Maybe you should change the title? The arm64 image is in fact not arm64 as it contains x86_64 binaries that are required for the software to function. "ARM64 build is broken" would perhaps be a more correct title?

neerdoc avatar Apr 11 '24 20:04 neerdoc

@parachvte @zjiefee I would love to help out with compiling this for arm64 on MacOS.

The actual binary that throws the error first is the cmd: ../../node_modules/@snapmaker/snapmaker-lunar/engine/MacOS/LunarMP modelrepair -v -p -j since it has the wrong CPU architecture.

I can only assume that all three files needs to be compiled for arm64 as they are currently x86_64:

  • LunarMP
  • LunarSlicer
  • LunarTPP

neerdoc avatar Apr 11 '24 20:04 neerdoc

@oizone Maybe you should change the title? The arm64 image is in fact not arm64 as it contains x86_64 binaries that are required for the software to function. "ARM64 build is broken" would perhaps be a more correct title?

Well, yeah, it's not a arm64 since it has x86_64 code in it, no. But I think the topic already says this, even though a bit indirect. But anyway, I don't think changing the title will fix this :)

oizone avatar Apr 11 '24 21:04 oizone

Is the npm package from here? Snapmaker/LunarSlicer? I don't find it very clear if this is the case.

neerdoc avatar Apr 12 '24 05:04 neerdoc

Got the same problem! Had to downgrade to previous version.

hefler avatar May 02 '24 16:05 hefler