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

createDMG fails when running on m1 mac when running under x86_64 architecture #215

Open
adesko opened this issue Jul 8, 2024 · 5 comments
Labels

Comments

@adesko
Copy link

adesko commented Jul 8, 2024

I'm trying to build an app for x86_64 on m1 mac. I'm running the build scripts through the compatibility layer, so it looks like this
arch -86_64 /path/build_app.sh
I have different versions of node for arm and x86 installed, so this particular script is running with node for x86. So when the script is running, it detects the architecture as x86 and tries to run a command that is incompatible with arm Macs

15:05:35.200 › Command failed: bless --folder /Volumes/SPINSInstaller --openfolder /Volumes/SPINSInstaller
bless: The 'openfolder' is not supported on Apple Silicon devices.

Is there any way to avoid this error and build for x86 on an arm machine?

@erickzhao
Copy link
Member

Duplicate of #131. Should be fixed as of v4.0.0.

@erickzhao erickzhao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@adesko
Copy link
Author

adesko commented Jul 8, 2024

@erickzhao i fail to see how it's a duplicate. The issue you linked describes building an app for arm64. I, however, am trying to build an app under x86_64 architecture, but on an arm mac. So inside of node, the process.arch is x64 so it tries to execute with "openfolder" but fails since it's not available on arm macs.
Also, i'm using the 5.0.1 version of the package.

@erickzhao erickzhao reopened this Jul 9, 2024
@erickzhao
Copy link
Member

@adesko Ah I see, my apologies. Have you tried packaging your app for x64 and using electron-installer-dmg on the output result without the arch -86_64 translation?

Not immediately sure if there's anything platform-specific about the resulting DMG and I don't have an x64 Mac on me to test.

@erickzhao erickzhao added the bug label Jul 9, 2024
@adesko
Copy link
Author

adesko commented Jul 10, 2024

@erickzhao unfortunately that didn't work
Since node_modules were installed under arm architecture, the resulting app won't run on x86 macs (though the dmg file can be opened and the app can be copied to Applications)
And when installing node_modules under x86, i get the error above since electron-installer-dmg was also installed under x86 together with other modules

@nljohnson
Copy link

nljohnson commented Sep 11, 2024

@adesko, I'm not sure if you're still struggling with this. I ran into this today, and have a very stupid workaround for it I can share, in my build script:

    const originalArch = os.arch
    os.arch = () => 'arm64' // Tell os.arch() to return 'arm64' to prevent appdmg from passing in '--openfolder' to bless
    await createDMG(options)
    os.arch = originalArch

The problem lies in appdmg, which relies on os.arch() to determine if it should pass the --openfolder option to bless. Unfortunately, os.arch() seems to just be returning the same value as process.arch, which is obviously not what we want. This at least convinces appdmg to not pass in illegal arguments to bless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants