Cannot compile etcher

On trying to compile etcher on windows 10 using make electron-develop i get the following error
alloc.c : fatal error LNK1107: invalid or corrupt file: cannot read at 0x396C [C:\Ivan\etcher\node_modules\ext2fs\build
\ext2fs.vcxproj]

If I use mingw-64 i get a lot of error LNK2019: unresolved external symbol __imp_htonl referenced in function in etcher\node_modules\ext2fs\build\bindings.vcxproj

On ubuntu it compiles without any problem

Hi Ivan,

Can I ask what it is you’re trying to achieve? Why are you trying to build Etcher rather than run a release?

Also, can you let me know more about your system? You mention using mingw-64 for the second error, but what are you using when you get the LNK1107 error? Can you let me know which version of make you are using, and how you installed it?

I did have a quick go at building Etcher myself on Windows 10 - and ran into a bunch of build dependency issues. I was able to build it no problems on WSL2 after installing jq.

I can take the answers to these questions to the Etcher maintainer(s) and see if they can help.

Phil

Hi Phil,

I have tried it on a couple of windows 10 machines. Followed the instructions mentioned in the contribute.md file. It runs properly till it reaches xxhash and ext2fs. For xxhash, running npm install and then calling node-gyp rebuild seems to work, Howerer calling npm install for ext2fs throws the alloc error.

The readme file in ext2fs files indicates that MingW64 needs to be installed. So i downloaded it and then ran npm install ext2fs again.

I have tried it vs2015 build tools / python 2.7 as well as vs2017 build tools / python 3x

Ivan

The correct versions are visual studio 2015 and python 2.7 as noted in https://github.com/balena-io/etcher/blob/master/docs/CONTRIBUTING.md#windows .
Sorry if this is redundant, but just to double check: have you also set npm config set msvs_version 2015 beforehand?
Which version of node and npm are you running?

Hi Thundron,

yes i did set npm config set msvs_version 2015
I have tried it with node js versions 12.12, 12.18, 14.0.
With all of them ext2fs and xxhash gives problems while compiling.

Ivan.

Hello Ivan,

The instructions in contributing mention:

Either one of the following:
- Visual C++ 2015 Build Tools containing standalone compilers, libraries and scripts
- Install the windows-build-tools via npm with npm install --global windows-build-tools
- Visual Studio Community 2015 (free) (other editions, like Professional and Enterprise, should work too) NOTE: Visual Studio 2015 doesn't install C++ by default. You have to rerun the setup, select "Modify" and then check Visual C++ -> Common Tools for Visual C++ 2015 (see http://stackoverflow.com/a/31955339)

My understanding is that you are using Visual Studio Community 2015, did you make sure to install Visual C++ 2015 through that? If so, did you also try using the npm package described in the second option?

Also, please make sure you have all the following mingw packages installed:

msys-make
msys-unzip
msys-zip
msys-bash
msys-coreutils

One more thing: may I ask why you are trying to build etcher from scratch? Keep in mind you can download any release from https://github.com/balena-io/etcher/releases (or the latest from the website). If you are looking to contribute to Etcher, please consider opening an issue directly on https://github.com/balena-io/etcher as it should get you in contact with the maintainers directly.