question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rebuilding for ia32 on a x64 machine

See original GitHub issue

I am trying to make sure that I can build ia32 binaries for my project.

The last piece is this native module rebuild. I am using gulp, and I cannot for the life of my figure out how to specify just electron version and the architecture parameter. In the “installNodeHeaders” function signature, the --arch option that can be given on the command line is listed as the 4th parameter. I really want to just specify the electron version and just tell it the ia32 architecture, but function signature wants me to put all four parameters in. I am new to a lot of this so I might be making a lot of rookie mistakes, but I am stuck on how to set the arch value to ia without providing the 3rd parameter.

var eRebuild = require('electron-rebuild');

eRebuild.shouldRebuildNativeModules('./node_modules/.bin/electron.cmd')
.then(function(shouldBuild) {
    if (!shouldBuild) {
        return true;
    }

    return eRebuild.installNodeHeaders(electronVersion,'https://atom.io/download/atom-shell', ?????,'ia32')
        .then(function () {
            eRebuild.rebuildNativeModules(electronVersion, './node_modules');
        }).then(function () {
            eRebuild.preGypFixRun('./node_modules', true, './node_modules/.bin/electron.cmd');
        });
})
.catch(function(e) {
    log('Building modules didn\'t work: ' + e);
});

I have shown my code above (a pattern copied almost verbatim from the electron-rebuild README.md). How do I properly call the installNodeHeaders function? As I said, I really only want to specify the first and fourth parameters, as I have no idea what to put in the third that will work for rebuild of all modules.

installNodeHeaders(electronVersion,'https://atom.io/download/atom-shell', ?????,'ia32')

help…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
corvinrokcommented, Jul 20, 2016

After much testing I have found that the actual installNodeHeaders does not properly update according the architecture parameter (the fourth param). Fortunately, there is a way around this. You must simply use a combination of npm install and npm set commands to set up the node environment, from which the electron-rebuild will inherit its proper targets.

That is to say, after you git clone your project, be sure you are doing as follows, if you wish to build ia32 from a 64bit box:

install or switch to your 32bit installation of Node [git clone your project or whatever… ] cd to your project directory

Set the target architecture of your npm/node context npm set npm_config_arch ia32

Download/install the arch specific electron prebuilt (if you need this) npm install --arch=ia32 electron-prebuilt -g

Install and compile your project dependencies (arch switch here is specifically for electron) npm install --arch=ia32

run your gulp code to rebuild (or use the command line if you’d rather)…

var eRebuild = require('electron-rebuild');

eRebuild.shouldRebuildNativeModules('./node_modules/.bin/electron.cmd')
.then(function(shouldBuild) {
    if (!shouldBuild) {
        return true;
    }

    return eRebuild.installNodeHeaders(electronVersion')
        .then(function () {
            eRebuild.rebuildNativeModules(electronVersion, './node_modules');
        }).then(function () {
            eRebuild.preGypFixRun('./node_modules', true, './node_modules/.bin/electron.cmd');
        });
})
.catch(function(e) {
    log('Building modules didn\'t work: ' + e);
});

Windows, electron, node and this electron-rebuild package all seem to conspire to make this process basically indecipherable by reading documentation, believing the APIs or seeing examples of this kind of usage anywhere. Hopefully this bit of info here will help others avoid this hornets nest of convolution…

3reactions
fcastilloeccommented, Aug 14, 2017

what are the new API functions? the README still says that I can call electron-rebuild with the --arch option. It doesn’t even specify which format the arch option uses, it could be ia32, i386,x86. So, how can a rebuild a module for 32bit from a 64bit computer? I’m just trying to use it from the command-line, nothing else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rebuilding for ia32 on a x64 machine · Issue #84 - GitHub
I am trying to make sure that I can build ia32 binaries for my project. The last piece is this native module rebuild....
Read more >
Installing Windows x64 on 32-bit UEFI (EFI-IA32) via GRUB
Just create a USB boot device partitioned as GPT with a ESP partition formated with FAT32. Put in the USB drive the EFI...
Read more >
How to build as an ia32 solution from visual studio using cmake
I open it with Visual Studio 2019 and click on the button Local Windows Debugger . I can see also a drop-down menu...
Read more >
rebuild 32 bit application for 64 bit OS - MSDN - Microsoft
In short first of all you have to rebuilt all your applications using 64 bit configuration. Which can be found in configuration you...
Read more >
Intel® 64 and IA-32 Architectures Software Developer's Manual
This chapter describes the basics of virtual machine architecture and an overview of ... Handling in 64-bit Mode,” of the Intel® 64 and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found