Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

CreateZipFromDirectory exception on macOS Catalina (10.15)

Open malept opened this issue 4 years ago • 20 comments

Squirrel version(s) 1.9.1 (as bundled in electron-winstaller 4.0.0)

Description

On macOS Catalina (10.15), 32-bit apps such as 32-bit wine can no longer be run. This means that running Windows apps with wine will not work. Instead, it should be using wine64.

Steps to recreate

On macOS 10.15:

  1. Make sure wine-stable and mono are installed (brew cask install xquartz wine-stable mono)
  2. Either:

Expected behavior

Executes normally.

Actual behavior

Output:

Error {
    message: `Failed with exit code: 255␊

    Output:␊
    System.AggregateException: One or more errors occurred. () ---> System.Exception␊
      at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
       --- End of inner exception stack trace ---␊
      at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <b6f643ae6ccb410db69142d5eaf9b9c1>:0 ␊
      at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <b6f643ae6ccb410db69142d5eaf9b9c1>:0 ␊
      at System.Threading.Tasks.Task.Wait () [0x00000] in <b6f643ae6ccb410db69142d5eaf9b9c1>:0 ␊
      at Squirrel.ReleasePackage.CreateReleasePackage (System.String outputFile, System.String packagesRootDir, System.Func`2[T,TResult] releaseNotesProcessor, System.Action`1[T] contentsPostProcessHook) [0x001f7] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
      at Squirrel.Update.Program.Releasify (System.String package, System.String targetDir, System.String packagesDir, System.String bootstrapperExe, System.String backgroundGif, System.String signingOpts, System.String baseUrl, System.String setupIcon, System.Boolean generateMsi, System.String frameworkVersion, System.Boolean generateDeltas) [0x00214] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
      at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x004a2] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
      at Squirrel.Update.Program.main (System.String[] args) [0x00082] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
      at Squirrel.Update.Program.Main (System.String[] args) [0x00006] in <a5ee691170b94c488950c75951ce1ba3>:0 ␊
    ---> (Inner Exception #0) System.Exception␊
      at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <a5ee691170b94c488950c75951ce1ba3>:0 <---␊
    `,
  }

Additional information

CI output where this occurred: https://app.circleci.com/pipelines/github/electron/windows-installer/81/workflows/fa34897f-dfa9-4a50-856a-34d3c1804c12/jobs/126

To work around this, I'm using macOS 10.14 in CI, but that doesn't help folks who are trying to use electron-winstaller on Catalina.

I suspect it has something to do with this:

https://github.com/Squirrel/Squirrel.Windows/blob/1b7220b3efd9abeaa0b07a0d04c02d2a54b9b585/src/Squirrel/Utility.cs#L399-L402

My suggestion is to either:

  • check the arch at runtime and set wine or wine64 accordingly
  • use the WINE environment variable and fall back to wine

malept avatar Mar 31 '20 22:03 malept

I'm having the same issue. It would be very helpful if someone could take a look at this. Thanks in advance.

alexthemonk avatar Apr 17 '20 14:04 alexthemonk

@malept were you able to find any workaround to this issue, as I'm running into this as well when trying to build my app on macOS Catalina. I thought I might be able to just symlink wine to wine64 on my machine to force the use on wine64, but unfortunately that still results in the same error above.

sachinrekhi avatar Apr 26 '20 05:04 sachinrekhi

The workarounds that I know of that reliably work are:

  • Use a version of macOS before 10.15 (this is what I'm doing in CI for electron-winstaller)
  • Use a Windows VM
  • Use a Linux VM/container with 32-bit wine installed

malept avatar Apr 29 '20 21:04 malept

same issue on catalina :(

masterkain avatar May 06 '20 08:05 masterkain

Please don't add "same issue"-type comments to this issue, it only adds noise to the folks subscribed to it. Instead, please add a reaction to the issue summary.

malept avatar May 06 '20 14:05 malept

I am waiting a solution for this bug too. ;)

palmadias avatar May 19 '20 13:05 palmadias

Same for me

fabiosoft avatar Jun 17 '20 15:06 fabiosoft

I'm also having this issue on Arch Linux with kernel 5.7.7 (so not MacOS exclusive).

mattfbacon avatar Jul 04 '20 18:07 mattfbacon

@mattfbacon install the 32-bit version of Wine.

malept avatar Jul 04 '20 18:07 malept

Hmm, I'm not sure what you mean, but I believe that you mean regenerate the .wine folder with WINEARCH=win32. I did that, but now it just says "rcedit.exe failed with exit code 1. wine: '/home/matt/.wine' is a 32-bit installation, it cannot support 64-bit applications." and exits. (I don't want to hijack this thread, but I figured I ought to let you know.)

mattfbacon avatar Jul 06 '20 01:07 mattfbacon

@mattfbacon I still think you have a separate issue with a misconfigured wine (32 bit vs 64 bit). I would suggest (temporarily?) moving ~/.wine to ~/.wine32 so that the 64-bit version of wine can generate its installation.

Any further questions about your wine install should go to the Arch Linux forum or the Wine forum, since this really isn't a Wine troubleshooting issue.

malept avatar Jul 06 '20 06:07 malept

temporary solution:

  1. brew install 7zip
  2. mkdir wine_proxy
  3. create a file wine_proxy/wine
  4. add execute permission chmod +x wine_proxy/wine
  5. set environment export PATH="$(pwd)/wine_proxy:$PATH"

wine_proxy/wine:

#!/usr/bin/env node
const { spawn } = require('child_process');

const args = process.argv.slice(2);
let cmd = args.shift();
const cwd = process.cwd();

if (cmd.endsWith('7z.exe')) {
    const z7Args = args.filter((v) => v !== 'on');
    spawn('7z', z7Args, { cwd });
} else {
    // cannot use 'wine' loop
    spawn('/opt/homebrew/bin/wine', [cmd, ...args], { cwd });
}

cjahv avatar Nov 19 '21 09:11 cjahv

I think it's better to support both wine and wine64 cmd dynamically so that we don't have to change anything by default, cuz brew install them both

➜  ~ file `which wine`
/usr/local/bin/wine: Mach-O executable i386
➜  ~ file `which wine64`
/usr/local/bin/wine64: Mach-O 64-bit executable x86_64

https://github.com/Squirrel/Squirrel.Windows/blob/76c87af6f389bea69576c738ef46574b2945b0ba/src/Squirrel/Utility.cs#L171

https://github.com/Squirrel/Squirrel.Windows/blob/76c87af6f389bea69576c738ef46574b2945b0ba/src/Squirrel/Utility.cs#L379

https://github.com/Squirrel/Squirrel.Windows/blob/76c87af6f389bea69576c738ef46574b2945b0ba/src/Squirrel/Utility.cs#L400

hiwanz avatar Dec 09 '21 04:12 hiwanz

  • brew install 7zip

Great approach! I managed to fix a series of issues when packaging Windows on MacOS 12.2 with cjahv's wrapper.

Note: the right path of wine should be got by which wine64.

spawn('/usr/local/bin/wine64', [cmd, ...args], { cwd });

Further memo about this topic: Wine: https://wiki.winehq.org/MacOS Mono: https://www.mono-project.com/docs/getting-started/install/mac/ Alternative 7zip: brew install p7zip

acgrid avatar Feb 09 '22 05:02 acgrid

Hi all, I have the same issue today. And I had tried so many ways to solve it. And there's a workaround of it. Changing wine64-preloader&wine64 into wine-preloader&wine which in the folder /Applications/Wine\ Stable.app/Contents/Resources/wine/bin. Then this error solved. But then I get another error that is about rcedit. So I have to deal with it. Then I solved it by replacing rcedit with rcedit which in the /node_modules/electron-winstaller/vendor.
It shows done at last. But I find that exe file is just 200kb, and not able to run. So I go to check the Squirrel-Releasify.log in the same vendor. And it shows me Failed to write Zip to Setup.exe. So I have no idea about it. If anyone have solution about it, please let me know, THX. Finnaly, I quit, and use win10 to build. And it goes well :)

wwvevy avatar Feb 19 '22 15:02 wwvevy

For people still experiencing this issue try this, fixed the CreateZipFromDirectory error for me!

brew uninstall --cask xquartz
brew uninstall --cask wine-stable

brew tap gcenx/wine
brew install --cask --no-quarantine wine-crossover

ToddAlvordMinerva avatar Apr 18 '22 23:04 ToddAlvordMinerva

For people still experiencing this issue try this, fixed the CreateZipFromDirectory error for me!

brew uninstall --cask xquartz
brew uninstall --cask wine-stable

brew tap gcenx/wine
brew install --cask --no-quarantine wine-crossover

@ToddAlvordMinerva Thx!!! It works fine for me.

hiwanz avatar Apr 19 '22 04:04 hiwanz

macOS is officially unsupported for Squirrel.Windows - if you get it to work, that's great, but tbh I recommend getting an actual Windows machine instead because even if you can build your Electron app on macOS, you're gonna have to test Windows before you ship something. You can set up CI via GitHub Actions to build an installer with some work

anaisbetts avatar Apr 19 '22 12:04 anaisbetts