Rebuilding for ia32 on a x64 machine
See original GitHub issueI 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:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
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)…
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…
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 thearch
option uses, it could beia32
,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.