Automattic / Automattic/node-canvas
2.7.0 build from source compilation errors (windows) -- Broken build method
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue
When compiling canvas for windows, node-gyp will correctly compile all c++ code into the canvas.node file. However, the DLLs that are imported are incorrect. To my knowledge the issue is rooted in the `./binding.gyp`. This file links in the specific libraries from GTK; However, these dependencies are out of date for the current version of node-canvas vs the provided version of GTK.
The documentation states that to install on windows, node-canvas requires GTK2; additionally, it would be nice to specify the Cairo min-version. The provided link to pre-compiled win binaries is from 2010, and I could not find more up to date pre-compile windows binaries.
Realistically dropping GTK requirement in itself seems the best method forward and to only rely on Cairo, as neither provide pre-compiled binaries for windows. Bigger than this, though, is that the requirements of node-canvas are not GTK2 compatible anymore. GTK2 does not provide the needed binaries for modern node-canvas.
[https://github.com/Automattic/node-canvas/wiki/Installation%3A-Windows](https://github.com/Automattic/node-canvas/wiki/Installation%3A-Windows)
A presentation of this is easily accessible by downloading the current (2.7.0) windows x64 pre-compiled binaries that are provided in [Releases](https://github.com/Automattic/node-canvas/releases/tag/v2.7.0).
The DLLs located inside this file are not only newer, but more numerous, updated versions, and have removed several old dependencies as compared to the `--build-from-source`.
## Steps to Reproduce
This expects that GTK2 is installed as provided by the documentation.
In order to compile canvas for specific versions of NodeJS, Electron, and various other runtimes, you need to run one of these commands. They all call node-gyp to do the actual build process.
```sh
electron-rebuild -f
```
```sh
npm install --build-from-source
```
```sh
node-gyp rebuild
```
## Tested Environments
* node-canvas 2.5.0+ (Should impact earlier versions)
* Windows 10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.