tjanczuk / edge

Run .NET and Node.js code in-process on Windows, MacOS, and Linux
http://tjanczuk.github.io/edge
Other
5.41k stars 639 forks source link

Unable to build 'debug' with VS2015 #454

Open dpolivy opened 8 years ago

dpolivy commented 8 years ago

I've pulled down the latest code from master, and am trying to build it with VS2015 on my machine. Python, etc are all installed correctly. Building a release build works just fine, but when I try to build debug, I get a bunch of linker errors that seem to indicate MSVCRT is missing.

Steps:

  1. Clone repo
  2. npm install
  3. node-gyp configure
  4. node-gyp build --> success
  5. node-gyp build -debug --> fail

Sample error output (32 linker errors total):

edge.obj : error LNK2028: unresolved token (0A0005FF) "extern "C" int __cdecl _
CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_
CrtDbgReportW@@$$J0YAHHPEB_WH00ZZ) referenced in function "public: void __cdecl
 std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std
@@$$FQEAAXXZ) [C:\git\edge\build\edge_nativeclr.vcxproj]
v8synchronizationcontext.obj : error LNK2020: unresolved token (0A000602) "exte
rn "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar
_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPEB_WH00ZZ) [C:\git\edge\build\edge_
nativeclr.vcxproj]
clractioncontext.obj : error LNK2020: unresolved token (0A000600) "extern "C" i
nt __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const
 *,...)" (?_CrtDbgReportW@@$$J0YAHHPEB_WH00ZZ) [C:\git\edge\build\edge_nativecl
r.vcxproj]
clrfuncreflectionwrap.obj : error LNK2020: unresolved token (0A0005F9) "extern
"C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t
const *,...)" (?_CrtDbgReportW@@$$J0YAHHPEB_WH00ZZ) [C:\git\edge\build\edge_nat
iveclr.vcxproj]
persistentdisposecontext.obj : error LNK2020: unresolved token (0A000601) "exte
rn "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar
_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPEB_WH00ZZ) [C:\git\edge\build\edge_
nativeclr.vcxproj]

C:\git\edge\build\Debug\edge_nativeclr.node : fatal error LNK1120: 32 unresolve
d externals [C:\git\edge\build\edge_nativeclr.vcxproj]

Funny thing is the CoreCLR library builds just fine; this is only impacting the native CLR version.

As a potential fix/hack, I manually modified build/edge_nativeclr.vcxproj to add msvcmrtd.lib to the <AdditionalDependencies> section. That seems to work, but does give another linker warning:

LINK : warning LNK4098: defaultlib 'ucrtd.lib' conflicts with use of other libs
; use /NODEFAULTLIB:library [C:\git\edge\build\edge_nativeclr.vcxproj]

Not sure if this is a node-gyp issue, or something with the build configuration for edge. Any ideas?

dpolivy commented 8 years ago

Related to this tools\buildall.bat appears to hardcode msvs_version=2013 which is causing problems. If I update that to 2015, then buildall.bat appears to work OK.

dpolivy commented 7 years ago

The proper fix to build debug with VS2015 is to change the RuntimeLibrary property for the debug config to 3, which is the value for the runtime multithreaded debug DLL.