Description
openedon May 21, 2020
Issue or Feature
Build fails in Windows 10 x64 using electron-rebuild with Electron.
Build works perfectly fine with just npm install canvas or building manually with node-gyp configure && node-gyp build.
Seems to be something incompatible with the canvas and the electron environment ?
Building the canvas works perfectly fine with same setup in macOS Mojave.
The specific error reported by the compiler:
Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)
Steps to Reproduce
Install all the windows build prerequisities (GTK, libjpeg) in the locations provided by the install instructions.
Running
npx electron-rebuild canvas
Fails with the following message errors:
An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@14.0.0 | win32 | x64
gyp info find Python using Python version 3.8.2 found at "C:\Python38\python.exe"
gyp http GET https://www.electronjs.org/headers/v8.2.0/node-v8.2.0-headers.tar.gz
gyp http 200 https://www.electronjs.org/headers/v8.2.0/node-v8.2.0-headers.tar.gz
gyp http GET https://www.electronjs.org/headers/v8.2.0/SHASUMS256.txt
gyp http GET https://www.electronjs.org/headers/v8.2.0/win-x86/node.lib
gyp http GET https://www.electronjs.org/headers/v8.2.0/win-x64/node.lib
gyp http GET https://www.electronjs.org/headers/v8.2.0/win-arm64/node.lib
gyp http 200 https://www.electronjs.org/headers/v8.2.0/win-x64/node.lib
gyp http 200 https://www.electronjs.org/headers/v8.2.0/SHASUMS256.txt
gyp http 200 https://www.electronjs.org/headers/v8.2.0/win-arm64/node.lib
gyp http 200 https://www.electronjs.org/headers/v8.2.0/win-x86/node.lib
gyp info find VS using VS2019 (16.6.30114.105) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python38\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sakari\\.electron-gyp\\8.2.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\sakari\\.electron-gyp\\8.2.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\sakari\\\\.electron-gyp\\\\8.2.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Copying C:/libjpeg-turbo64/bin/jpeg62.dll to C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\Release\\jpeg62.dll
1 file(s) copied.
Backend.cc
ImageBackend.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\ImageBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\Backend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\ImageBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\Backend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
PdfBackend.cc
SvgBackend.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\PdfBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\PdfBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\SvgBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\backend\SvgBackend.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
BMPParser.cc
Backends.cc
Canvas.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Backends.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Backends.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Canvas.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Canvas.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
CanvasGradient.cc
CanvasPattern.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasGradient.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasGradient.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
CanvasRenderingContext2d.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasPattern.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasPattern.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
closure.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasRenderingContext2d.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\CanvasRenderingContext2d.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
color.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\closure.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\closure.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
Image.cc
ImageData.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Image.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\Image.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\ImageData.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\ImageData.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
init.cc
register_font.cc
win_delay_load_hook.cc
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8923,39): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\init.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\.electron-gyp\8.2.0\include\node\v8.h(8931,42): warning C4996: 'v8::MicrotasksCompletedCallback': Use *WithData version. (compiling source file ..\src\init.cc) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
Creating library C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\Release\canvas.lib and object C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\Release\canvas.exp
Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\Release\canvas.node : fatal error LNK1120: 1 unresolved externals [C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\sakari\dvl\omg-standalone\electron\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=8.2.0" "--arch=x64" "--dist-url=https://www.electronjs.org/headers" "--build-from-source" "--module_name=canvas" "--module_path=C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas\\build\\Release" "--host=https://github.com/node-gfx/node-canvas-prebuilt/releases/download/" "--remote_path=v2.6.1" "--package_name=canvas-v2.6.1-electron-v8.2-win32-unknown-x64.tar.gz"
gyp ERR! cwd C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas
gyp ERR! node -v v14.0.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
Failed with exit code: 1
This line being the culprit:
Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr __cdecl v8::ArrayBuffer::GetBackingStore(void)" (_imp?GetBackingStore@ArrayBuffer@v8@@qeaa?AV?$shared_ptr@VBackingStore@v8@@@std@@xz)
Your Environment
- Version of node-canvas (output of
npm list canvas
oryarn list canvas
):
`-- canvas@2.6.1
- Environment:
Electron 8.2.0, electron-rebuild 1.11.0 on Windows 10 x64.
MSVC2019 Community edition
λ node --version
v14.0.0
Any help is appreciated!
Anybody got the canvas module rebuilt in Windows using electron-rebuild ?
Thank you.