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

Building for Windows on MacOS using Docker container #871

Closed
saenzramiro opened this issue Nov 3, 2016 · 6 comments
Closed

Building for Windows on MacOS using Docker container #871

saenzramiro opened this issue Nov 3, 2016 · 6 comments
Labels

Comments

@saenzramiro
Copy link

  • Version: 7.18.0
  • Target: Windows 64

I'm trying to build for Windows from my macOS using the Docker container provided (electronuserland/electron-builder:wine). Everthing works great building for Linux, but when I tried to build for Windows, throw an error:

Error: Exit code: 1. Command failed: wine /root/.cache/winCodeSign/winCodeSign-1.4.2/rcedit.exe /p243ab633605af455374aa646db1a63110697917109902f0022d6b29e469f4e07 (sha256 hash) --set-version-string CompanyName ACME --set-version-string FileDescription ACME --set-version-string ProductName ACME --set-version-string InternalName ACME --set-version-string LegalCopyright Copyright © 2016 ACME --set-version-string OriginalFilename  --set-file-version 1.0.0 --set-product-version 1.0.0 --set-icon /project/build/icon.ico
err:virtual:NtMapViewOfSection map_file_into_view 0x4e0000 53f1000 000000000 failed
Fatal error: Unable to commit changes
err:virtual:NtMapViewOfSection map_file_into_view 0x4e0000 53f1000 000000000 failed
Fatal error: Unable to commit changes
at /project/node_modules/electron-builder/src/util/util.ts:107:16
at ChildProcess.exithandler (child_process.js:218:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
From previous event:
at exec (/project/node_modules/electron-builder/src/util/util.ts:85:3)
at /project/node_modules/electron-builder/src/winPackager.ts:170:11
From previous event:
at WinPackager.signAndEditResources (/project/node_modules/electron-builder/out/winPackager.js:239:11)
at /project/node_modules/electron-builder/src/winPackager.ts:178:16
From previous event:
at WinPackager.postInitApp (/project/node_modules/electron-builder/out/winPackager.js:248:11)
at /project/node_modules/electron-builder/src/platformPackager.ts:243:26
From previous event:
at /project/node_modules/electron-builder/src/packager/dirPackager.ts:58:11
at Generator.next (<anonymous>)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
at pack (/project/node_modules/electron-builder/out/packager/dirPackager.js:43:21)
at /project/node_modules/electron-builder/src/platformPackager.ts:185:11
at Generator.next (<anonymous>)
From previous event:
at WinPackager.doPack (/project/node_modules/electron-builder/out/platformPackager.js:302:11)
at /project/node_modules/electron-builder/src/winPackager.ts:119:16
at Generator.next (<anonymous>)
From previous event:
at WinPackager.pack (/project/node_modules/electron-builder/out/winPackager.js:192:11)
at /project/node_modules/electron-builder/src/packager.ts:134:22
From previous event:
at Packager.doBuild (/project/node_modules/electron-builder/out/packager.js:254:11)
at /project/node_modules/electron-builder/src/packager.ts:102:32
at Generator.next (<anonymous>)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
at Packager.build (/project/node_modules/electron-builder/out/packager.js:206:11)
at /project/node_modules/electron-builder/src/builder.ts:234:33
at Generator.next (<anonymous>)
From previous event:
at build (/project/node_modules/electron-builder/out/builder.js:81:21)
at Object.<anonymous> (/project/node_modules/electron-builder/out/build-cli.js:66:41)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.runMain (module.js:607:10)
at run (bootstrap_node.js:382:7)
at startup (bootstrap_node.js:137:9)
at bootstrap_node.js:497:3

The steps to run the container and build are these:

  1. Run: docker run --rm -ti -v /my/folder/project:/project -v ~/.electron:/root/.electron electronuserland/electron-builder:wine /bin/bash
  2. Run inside the container: npm run build:win64 (equals to build --win --x64)

Am I doing something wrong?

@develar
Copy link
Member

develar commented Nov 3, 2016

How did you install Docker? Parallels and VMWare are broken. Please use only latest official Docker for mac (https://docs.docker.com/engine/installation/mac/#/docker-for-mac). Please do not use Docker Toolbox.

@saenzramiro
Copy link
Author

Oh, I was using Docker Toolbox. Let me try it following your instructions and post you back.

In the meantime, Can you confirm if the only environment that can build for Windows, Linux and macOS is macOS (following the Multi Platform Build wiki)? If this is right, I can use the Docker image in my Mac to build for Linux and Windows, but building for macOS I cannot do it in a container (because of the certificates). Right?

@develar
Copy link
Member

develar commented Nov 3, 2016

Right?

Yes. One exception — "If your app has native dependencies, windows can be compiled only on the target platform — windows."

In any case I strongly suggest to build app on CI servers due to security reasons.

I can use the Docker image in my Mac to build for Linux and Windows

You can build even without Docker. Docker just help you to not install wine and other dependencies.

@saenzramiro
Copy link
Author

saenzramiro commented Nov 3, 2016

Yes. One exception — "If your app has native dependencies, windows can be compiled only on the target platform — windows."

Got it.

I don't want to use CI servers because I'm trying to create a private CI server locally. One server to build for all platforms (considering there isn't native dependencies), so it has to be a macOS. Using containers for Linux and Windows will help having clean environments, but building for macOS is the problem, because it cannot be build it inside a container.

Is this correct?

EDIT: Using Docker without Toolbox solved the problem. Now works like a champ!

@develar
Copy link
Member

develar commented Nov 3, 2016

Is this correct?

Yes.

@saenzramiro
Copy link
Author

saenzramiro commented Nov 3, 2016

Thank you so much for your help and this tool.

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

2 participants