electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.58k stars 1.73k forks source link

Building 64bit installer, portable exe in windows #8408

Open sridhard opened 1 month ago

sridhard commented 1 month ago

Latest 6.3.2

20.16.0

26.2.1

windows

I am using electron sample app from https://github.com/electron-react-boilerplate/electron-react-boilerplate I am building this app in a windows 64 bit machine.

I am trying to build a 64 bit portable exe and also a 64 bit nsis installer m(x64). But I am always getting 32bit(x86) installer and portable.exe

I verified the installer architecture using dumpbin. Below is the output:

>dumpbin.exe /headers "c:\Users\Administrator\Downloads\electron-react-boilerplate-main\electron-react-boilerplate-main\release\build\ElectronReact Setup 4.6.0.exe"
Microsoft (R) COFF/PE Dumper Version 14.40.33812.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file c:\Users\Administrator\Downloads\electron-react-boilerplate-main\electron-react-boilerplate-main\release\build\ElectronReact Setup 4.6.0.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               5 number of sections
        5C157F86 time date stamp Sat Dec 15 22:26:14 2018
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             10F characteristics
                   Relocations stripped
                   Executable
                   Line numbers stripped
                   Symbols stripped
                   32 bit word machine

OPTIONAL HEADER VALUES
             10B magic # (PE32)
            6.00 linker version
            6800 size of code
           73800 size of initialized data
            4000 size of uninitialized data
            338F entry point (0040338F)
            1000 base of code
            8000 base of data
          400000 image base (00400000 to 005FBFFF)
            1000 section alignment
             200 file alignment
            4.00 operating system version
            6.00 image version
            4.00 subsystem version
               0 Win32 version
          1FC000 size of image
             400 size of headers
               0 checksum
               2 subsystem (Windows GUI)
            8540 DLL characteristics
                   Dynamic base
                   NX compatible
                   No structured exception handler
                   Terminal Server Aware
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
            8610 [      A0] RVA [size] of Import Directory
          19F000 [   5C928] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
               0 [       0] RVA [size] of Base Relocation Directory
               0 [       0] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            8000 [     2B0] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
               0 [       0] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory

SECTION HEADER #1
   .text name
    6627 virtual size
    1000 virtual address (00401000 to 00407626)
    6800 size of raw data
     400 file pointer to raw data (00000400 to 00006BFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

SECTION HEADER #2
  .rdata name
    14A2 virtual size
    8000 virtual address (00408000 to 004094A1)
    1600 size of raw data
    6C00 file pointer to raw data (00006C00 to 000081FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

SECTION HEADER #3
   .data name
   70FF8 virtual size
    A000 virtual address (0040A000 to 0047AFF7)
     600 size of raw data
    8200 file pointer to raw data (00008200 to 000087FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0000040 flags
         Initialized Data
         Read Write

SECTION HEADER #4
  .ndata name
  124000 virtual size
   7B000 virtual address (0047B000 to 0059EFFF)
       0 size of raw data
       0 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0000080 flags
         Uninitialized Data
         Read Write

SECTION HEADER #5
   .rsrc name
   5C928 virtual size
  19F000 virtual address (0059F000 to 005FB927)
   5CA00 size of raw data
    8800 file pointer to raw data (00008800 to 000651FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

  Summary

       71000 .data
      124000 .ndata
        2000 .rdata
       5D000 .rsrc
        7000 .text

We can see the installer is a 32bit x86 installer FILE HEADER VALUES 14C machine (x86)

How can we build a 64bit portable exe and a installer?

I tried passing --x64 to electron builder and also configured arch as x64 in target in package.json

mmaietta commented 1 month ago

Not sure if this is how it works off the top of my head. Does the architecture of an installed app have to be the same architecture as the installer? I'm wondering if the 32-bit installer is for compatibility purposes, and since it just copies files, the files within (e.g. the app) could still be 64 bit?