electron / electron/rebuild

Failed Rebuilding canvas: error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)"

Open
#924 20 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
181
Avg merge
6h 44m
Merged PRs (30d)
3

Description

Well, I have a dead simple Electron app with only `canvas` and `nan` as dependencies alongside `electron` and `react`, running on a Windows 11 (21H2) machine.

What I'm trying to do is to rebuild `canvas` for electron using `electron-rebuild`. However, It's failing with the following error :
```
Canvas.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr __cdecl v8::ArrayBuffer::GetBackingSto
re(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) referenced in function "void __cdecl parsePNGArgs(class v8::Local,struct PngClosure &)" (?parsePNGArgs@@YAXV?$Local@VValue@v8@@@v8@@AEAUPngClosure@@@Z) [C:\Users\ebrah\Desktop\NFT_Generator-master\node_modules\canvas\build\ca
nvas.vcxproj]
CanvasRenderingContext2d.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr __cdecl v8::ArrayBuf
fer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) [C:\Users\ebrah\Desktop\NFT_Generator-master\node_modu
les\canvas\build\canvas.vcxproj]
ImageData.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr __cdecl v8::ArrayBuffer::GetBacking
Store(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) [C:\Users\ebrah\Desktop\NFT_Generator-master\node_modules\canvas\buil
d\canvas.vcxproj]
C:\Users\ebrah\Desktop\NFT_Generator-master\node_modules\canvas\build\Release\canvas.node : fatal error LNK1120: 1 unresolved externals [C:\Users\ebrah\Desktop\NFT_Genera
tor-master\node_modules\canvas\build\canvas.vcxproj]
```

Here are ALL my system/app information
- Operating System
![image](https://user-images.githubusercontent.com/18527942/142753657-1760e909-570f-4363-8ae8-2b5e094b8cde.png)

- Architecture : x64 (Typical Intel Core-I7 processor 9750H)
- Global Environment
- Node v16.9.1 (using nvm)
- NPM 7.21.1
- node-gyp v8.4.0

- Application Details
- Dependencies
```json
"dependencies": {
"canvas": "2.8.0",
"electron": "16.0.1",
"nan": "2.15.0",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"babel-loader": "^8.1.0",
"css-loader": "^4.3.0",
"electron-rebuild": "^3.2.5",
"electron-reload": "^1.5.0",
"sass": "^1.26.11",
"sass-loader": "^10.0.2",
"style-loader": "^1.2.1",
"webpack": "^5.64.1",
"webpack-cli": "^4.9.1"
}
```

### What I was doing
After running `npm i` I ran `npm run rebuild` which delegates to `electron-rebuild -f -w canvas`, and the error showed up along with some other warnings

### What I was expecting
`canvas` to be built correctly to the correct version of electron I'm using, for this error to stop ruining my business.
![image](https://user-images.githubusercontent.com/18527942/142753911-74109158-c062-4019-b7ab-74b2de5b8742.png)

Waiting for your reply.

P.S. This is how the executon of `electron-rebuild` looks like on Git Bash / CMD on windows (also the same applies for `electron-rebuild.cmd`)

![ezgif-3-465f949847a1](https://user-images.githubusercontent.com/18527942/142754007-59facda6-c034-4e46-9f2b-ad3d46dc659f.gif)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `npm run rebuild`, which delegates to `electron-rebuild -f -w canvas`, on the reported Windows and Electron 16 setup. Inspect the Windows native-module rebuild output and the unresolved V8 symbol; done means the canvas native module builds successfully for the installed Electron version.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, nodejs
Domain
build-system, desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.