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

Mapeo Desktop Installer doesn't run on 32bit machines #305

Closed
arky opened this issue Mar 11, 2020 · 19 comments
Closed

Mapeo Desktop Installer doesn't run on 32bit machines #305

arky opened this issue Mar 11, 2020 · 19 comments
Labels

Comments

@arky
Copy link
Contributor

arky commented Mar 11, 2020

Trying to run the Mapeo Desktop (5.x) installer on 32 bit Windows 10 Pro machines results in '64-bit Windows is required' message. I have tested multiple versions of latest installers.

DSC_0149
DSC_0150

Most NGO/CSO organization have legacy machines hence the need for 32bit installers. I had managed to download and install Atom editor installer on this machine to check if electronJS applications are supported.

@arky
Copy link
Contributor Author

arky commented Mar 19, 2020

@okdistribute Testing windows artifact from build 5843279 and build 58488207 results in following error on Windows 32 machine.
DSC_0001

@okdistribute
Copy link
Contributor

I was able to get more information by using asar: false in the windows build:

Looks like the issue is with leveldown. We are one of the 1.9% here that need to create our own build.. Level/leveldown#554
Screenshot from 2020-03-19 20-54-40

@arky
Copy link
Contributor Author

arky commented Mar 20, 2020

@okdistribute Yup, That reminds me that I had to rebuild leveldown package before building mapeo-desktop on 32bit machines.

@okdistribute
Copy link
Contributor

@arky what did you type to rebuild?

@arky
Copy link
Contributor Author

arky commented Mar 20, 2020

To build mapeo-desktop on 32bit machine you had rebuild leveldown without 64-bit flag.

"cd node_modules/leveldown && cross-env HOME=~/.electron-gyp node-gyp rebuild --target=2.0.7 --runtime=electron --dist-url=https://atom.io/download/atom-shell

Please refer to this bug #237

@vweevers
Copy link

Which version of leveldown are y'all on? The above command suggests on older version.

On latest leveldown (5.x) there should be no need to rebuild. If node is 32-bit, then on npm install leveldown will see that it has no bundled prebuild for windows 32-bit and fallback to compilation. The resulting build is compatible with both node and electron.

@okdistribute
Copy link
Contributor

@vweevers Thanks for responding. I realize now that you're right, we updated to leveldown 5.x since #237 was filed.

That's what I thought but still running into issues... I've been doing this on GitHub Actions and experimenting on this PR

@okdistribute
Copy link
Contributor

@vweevers okay, doing this it seems to not have rebuilt leveldown, and says it can't find a native build for win32
Screenshot from 2020-03-20 11-29-23

I noticed here in the log for this build that electron-builder is rebuilding native modules for leveldown, but I wonder if that's failing silently?

@vweevers
Copy link

Could be, because those electron tools are geared towards the older node-pre-gyp and prebuild-install. I don't know if they support leveldown's setup.

I've got a Windows machine and can maybe help, given some instructions on how to get started on mapeo-desktop.

@okdistribute
Copy link
Contributor

okdistribute commented Mar 20, 2020

@vweevers thanks, that would be great. We're a small team and non-profit so any help is greatly appreciated. Mapeo Desktop should work out of the box with npm install, npm run watch in a new terminal window or npm run build for one-time front-end build, and npm run dev https://github.com/digidem/mapeo-desktop/#getting-started

@vweevers
Copy link

With:

$ node -v
v12.11.1
$ node -p process.arch
ia32
$ git branch
* master

I see that npm install correctly compiles leveldown.

There's also a postinstall script that (deep breath) runs electron-builder install-app-deps which in turn spawns node_modules/app-builder-bin/win/ia32/app-builder.exe rebuild-node-modules which is written in Go and effectively spawns npm rebuild leveldown@5.5.1 ... which calls the install script of leveldown. Which doesn't do anything, because it previously compiled and doesn't check whether that build is compatible with the target runtime. I'll get back to that.

TLDR, electron-builder install-app-deps doesn't do anything (at least for leveldown) but at this point in time we still have a leveldown build that happens to be compatible with Electron.

The npm run build and npm run dev commands also work, and I see a LevelDB db getting created on disk, so leveldown is correctly loaded.

Next up is packaging; I'll try that in your 32bit-builds branch.

@vweevers
Copy link

@okdistribute After running npm run dist (in the 32bit-builds branch) how can I launch Mapeo? Can I simply open dist/win-ia32-unpacked/Mapeo.exe or is that not a realistic test and should I instead run the installer exe?

Side note: the 32bit-builds branch has this (overly helpful) error:

$ npx electron-builder --ia32
  • electron-builder  version=21.2.0 os=10.0.18362
  • loaded configuration  file=package.json ("build" field)
  ⨯ Package "electron-rebuild" is only allowed in "devDependencies". Please remove it 
      from the "dependencies" section in your package.json.

@vweevers
Copy link

vweevers commented Mar 22, 2020

The 32-bit leveldown build correctly gets included in win-ia32-unpacked/resources/app/node_modules/.. and Mapeo.exe works - but it created registry keys so I ran the installer anyway to have the uninstaller cleanup those keys afterwards.

And... the installed Mapeo also works!

It stops working when I re-enable asar though. Another problem is that npm run dist builds both --x64 and --ia32, and because it doesn't rebuild leveldown, you'd have to separate that into two CI jobs or npm scripts.

@vweevers
Copy link

Given the amount of tools involved, it might take some time and thought to properly fix rebuilding. So I'm leaning towards just adding a 32-bit prebuild to leveldown (and making note of the issues elsewhere).

vweevers added a commit to Level/leveldown that referenced this issue Mar 22, 2020
Adds 194kb (or 406kb unpacked) to our npm package size.

Previously removed because only 2% of installs were on 32-bit
Windows and we agreed those users could compile from source.

However, there is currently a gap in electron(-builder) tooling
when used on native addons that use node-gyp-build: these addons
don't get automatically recompiled. Though we don't need that
anymore for runtimes (the builds are compatible with both node and
electron) our users do need it when targeting multiple CPU
architectures.

Ref digidem/mapeo-desktop#305
Ref electron-userland/electron-builder#4370
Ref #554
@okdistribute
Copy link
Contributor

okdistribute commented Mar 22, 2020

Thanks so much for investigating.

Adding 32-bit builds to leveldown will really help the electron ecosystem!

@okdistribute
Copy link
Contributor

This will be fixed in the next release, but you can try it now in this build https://github.com/digidem/mapeo-desktop/actions/runs/67706742

@arky
Copy link
Contributor Author

arky commented Apr 1, 2020

@okdistribute Tested on windows 32 bit machine. Works like a charm.

@vweevers
Copy link

Given the amount of tools involved, it might take some time and thought to properly fix rebuilding.

Update (FYI): node-gyp-build now respects the electron-builder buildDependenciesFromSource option (prebuild/node-gyp-build#30).

@okdistribute
Copy link
Contributor

nice thanks @vweevers !

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

Successfully merging a pull request may close this issue.

3 participants