nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 282 forks source link

v8_libbase.lib(time.obj) : error LNK2019: 无法解析的外部符号 __imp_timeGetTime #2545

Closed GoddessLuBoYan closed 4 years ago

GoddessLuBoYan commented 4 years ago

Node.js 13.11.0 OS Windows7

command: vcbuild projgen dll openssl-no-asm

error:

v8_libbase.lib(time.obj) : error LNK2019: 无法解析的外部符号 __imp_timeGetTime,
该符号在函数 "u
nsigned long __cdecl v8::base::`anonymous namespace'::timeGetTimeWrapper(void)"
 (?timeGetTimeWrapper@?A0x9036770b@base@v8@@YAKXZ) 中被引用 [D:\Users\lujincheng
\Do
wnloads\node-13.11.0\libnode.vcxproj]
v8_libbase.lib(platform-win32.obj) : error LNK2001: 无法解析的外部符号 __imp_tim
eGetTime
 [D:\Users\lujincheng\Downloads\node-13.11.0\libnode.vcxproj]
out\Release\libnode.dll : fatal error LNK1120: 1 个无法解析的外部命令 [D:\Users\
lujinchen
g\Downloads\node-13.11.0\libnode.vcxproj]

environment: python3.7.5(conda) + vs2017(with windows10.0.17763.0)

ps: there's no chinese chars in the path

GoddessLuBoYan commented 4 years ago

build node.exe no error, but build node.dll has error in issues of "nodejs/node", there's a solution which has been merged into the master but now here comes the error again.

pull request url:

https://github.com/nodejs/node/pull/30695
bnoordhuis commented 4 years ago

You don't mention how you generate the project files but __imp_timeGetTime is provided by winmm.lib. Node's build system links to that in the appropriate places but see if it adding it manually helps.

For reference:

$ git grep -n -C3 winmm node.gyp*
node.gyp-429-        ['OS=="win"', {
node.gyp-430-          'libraries': [
node.gyp-431-            'Dbghelp.lib',
node.gyp:432:            'winmm.lib',
node.gyp-433-            'Ws2_32.lib',
node.gyp-434-          ],
node.gyp-435-        }],
--
node.gyp-1183-        ['OS=="win"', {
node.gyp-1184-          'libraries': [
node.gyp-1185-            'Dbghelp.lib',
node.gyp:1186:            'winmm.lib',
node.gyp-1187-            'Ws2_32.lib',
node.gyp-1188-          ],
node.gyp-1189-        }],
--
node.gyp-1239-        ['OS=="win"', {
node.gyp-1240-          'libraries': [
node.gyp-1241-            'Dbghelp.lib',
node.gyp:1242:            'winmm.lib',
node.gyp-1243-            'Ws2_32.lib',
node.gyp-1244-          ],
node.gyp-1245-        }],
--
node.gyp-1301-          'libraries': [
node.gyp-1302-            'dbghelp.lib',
node.gyp-1303-            'PsApi.lib',
node.gyp:1304:            'winmm.lib',
node.gyp-1305-            'Ws2_32.lib',
node.gyp-1306-          ],
node.gyp-1307-        }],
--
node.gyp-1354-        ['OS=="win"', {
node.gyp-1355-          'libraries': [
node.gyp-1356-            'Dbghelp.lib',
node.gyp:1357:            'winmm.lib',
node.gyp-1358-            'Ws2_32.lib',
node.gyp-1359-          ],
node.gyp-1360-        }],
richardlau commented 4 years ago

build node.exe no error, but build node.dll has error in issues of "nodejs/node", there's a solution which has been merged into the master but now here comes the error again.

pull request url:

https://github.com/nodejs/node/pull/30695

That pull request is still open and has not been merged into master.

GoddessLuBoYan commented 4 years ago

You don't mention how you generate the project files but __imp_timeGetTime is provided by winmm.lib. Node's build system links to that in the appropriate places but see if it adding it manually helps.

For reference:

$ git grep -n -C3 winmm node.gyp*
node.gyp-429-        ['OS=="win"', {
node.gyp-430-          'libraries': [
node.gyp-431-            'Dbghelp.lib',
node.gyp:432:            'winmm.lib',
node.gyp-433-            'Ws2_32.lib',
node.gyp-434-          ],
node.gyp-435-        }],
--
node.gyp-1183-        ['OS=="win"', {
node.gyp-1184-          'libraries': [
node.gyp-1185-            'Dbghelp.lib',
node.gyp:1186:            'winmm.lib',
node.gyp-1187-            'Ws2_32.lib',
node.gyp-1188-          ],
node.gyp-1189-        }],
--
node.gyp-1239-        ['OS=="win"', {
node.gyp-1240-          'libraries': [
node.gyp-1241-            'Dbghelp.lib',
node.gyp:1242:            'winmm.lib',
node.gyp-1243-            'Ws2_32.lib',
node.gyp-1244-          ],
node.gyp-1245-        }],
--
node.gyp-1301-          'libraries': [
node.gyp-1302-            'dbghelp.lib',
node.gyp-1303-            'PsApi.lib',
node.gyp:1304:            'winmm.lib',
node.gyp-1305-            'Ws2_32.lib',
node.gyp-1306-          ],
node.gyp-1307-        }],
--
node.gyp-1354-        ['OS=="win"', {
node.gyp-1355-          'libraries': [
node.gyp-1356-            'Dbghelp.lib',
node.gyp:1357:            'winmm.lib',
node.gyp-1358-            'Ws2_32.lib',
node.gyp-1359-          ],
node.gyp-1360-        }],

thanks, I'll have a try. By the way, when I write c++, I use this to link the lib file.

#pragma comment(lib, "*.lib")

what does the node.gyp do?

GoddessLuBoYan commented 4 years ago

oh, I force add the "winmm.lib" into the libnode.vcxproj, and build it successfully in VS2017 now I can see the libnode.dll.

node_mksnapshot.exe, mkcodecache.exe and node.exe build failed, but no problem, what I want is only the "libnode.dll". Thanks for your answers.