DR and drmf samples fail to link with VS2015
In testing the release, both the build_samples and build_drmf steps failed in my Win10 VM with VS2015:
03:49 PM ~/build_samples
% cmake -GNinja -DDynamoRIO_DIR=c:/derek/DynamoRIO-Windows-6.1.0-2/cmake/ ../DynamoRIO-Windows-6.1.0-2/samples
-- The C compiler identification is MSVC 19.0.23506.0
-- The CXX compiler identification is MSVC 19.0.23506.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/derek/build_samples
03:49 PM ~/build_samples
% ninja
[1/54] Building C object CMakeFiles\bbsize.dir\bbsize.c.obj
[2/54] Building C object CMakeFiles\cbrtrace.dir\cbrtrace.c.obj
[3/54] Building C object CMakeFiles\cbrtrace.dir\utils.c.obj
cl : Command line warning D9025 : overriding '/O2' with '/Od'
[4/54] Linking C shared library bin\bbsize.dll
cl : Command line warning D9025 : overriding '/O2' with '/Od'
[5/54] Building C object CMakeFiles\bbbuf.dir\bbbuf.c.obj
FAILED: cmd.exe /C "cd . && "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_dll C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo CMakeFiles\bbsize.dir\bbsize.c.obj /out:bin\bbsize.dll /implib:bin\bbsize.lib /pdb:bin\bbsize.pdb /dll /version:0.0 /machine:X86 /debug /INCREMENTAL /nodefaultlib libcmtd.lib c:\derek\DynamoRIO-Windows-6.1.0-2\ext\lib32\debug\drmgr.lib c:\derek\DynamoRIO-Windows-6.1.0-2\lib32\debug\dynamorio.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\derek\build_samples && C:\PROGRA~2\CMAKE\bin\cmake.exe -E echo "Usage: pass to drconfig or drrun: -c C:/derek/build_samples/bin/bbsize.dll"""
Creating library bin\bbsize.lib and object bin\bbsize.exp
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm_e referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_invoke_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_return_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __except_handler4 referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(utility.obj) : error LNK2001: unresolved external symbol __except_handler4
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __seh_filter_dll referenced in function ___scrt_dllmain_exception_filter
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_narrow_environment referenced in function ___scrt_dllmain_after_initialize_c
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_onexit_table referenced in function ___scrt_initialize_onexit_tables
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __register_onexit_function referenced in function __onexit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __execute_onexit_table referenced in function ___scrt_dllmain_uninitialize_c
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_atexit referenced in function __onexit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_at_quick_exit referenced in function _at_quick_exit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __cexit referenced in function ___scrt_dllmain_uninitialize_c
libcmtd.lib(tncleanup.obj) : error LNK2019: unresolved external symbol ___std_type_info_destroy_list referenced in function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info@@YAXXZ)
libcmtd.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _terminate referenced in function ___scrt_unhandled_exception_filter@4
bin\bbsize.dll : fatal error LNK1120: 15 unresolved externals
LINK Pass 1 failed. with 1120
cl : Command line warning D9025 : overriding '/O2' with '/Od'
cl : Command line warning D9025 : overriding '/O2' with '/Od'
ninja: build stopped: subcommand failed.
03:01 PM ~/build_drmf
% cmake -GNinja -DDynamoRIO_DIR=c:/derek/DynamoRIO-Windows-6.1.0-2/cmake/ -DDrMemoryFramework_DIR=c:/derek/DynamoRIO-Windows-6.1.0-2/drmemory/drmf/ ../DynamoRIO-Windows-6.1.0-2/drmemory/drmf/samples
-- The C compiler identification is MSVC 19.0.23506.0
-- The CXX compiler identification is MSVC 19.0.23506.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/derek/build_drmf
03:01 PM ~/build_drmf
% ninja
[1/2] Building C object CMakeFiles\strace.dir\strace.c.obj
C:\derek\DynamoRIO-Windows-6.1.0-2\drmemory\drmf\samples\strace.c(56): warning C4142: benign redefinition of type
[2/2] Linking C shared library bin\strace.dll
FAILED: cmd.exe /C "cd . && "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_dll C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo CMakeFiles\strace.dir\strace.c.obj /out:bin\strace.dll /implib:bin\strace.lib /pdb:bin\strace.pdb /dll /version:0.0 /machine:X86 /debug /INCREMENTAL /nodefaultlib libcmtd.lib c:\derek\DynamoRIO-Windows-6.1.0-2\drmemory\drmf\lib32\debug\drsyscall.lib c:\derek\DynamoRIO-Windows-6.1.0-2\ext\lib32\debug\drmgr.lib c:\derek\DynamoRIO-Windows-6.1.0-2\ext\lib32\debug\drcontainers.lib c:\derek\DynamoRIO-Windows-6.1.0-2\lib32\debug\dynamorio.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
Creating library bin\strace.lib and object bin\strace.exp
strace.c.obj : error LNK2019: unresolved external symbol __errno referenced in function _event_post_syscall
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm_e referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_invoke_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_return_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
libcmtd.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __except_handler4 referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
libcmtd.lib(utility.obj) : error LNK2001: unresolved external symbol __except_handler4
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __seh_filter_dll referenced in function ___scrt_dllmain_exception_filter
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_narrow_environment referenced in function ___scrt_dllmain_after_initialize_c
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_onexit_table referenced in function ___scrt_initialize_onexit_tables
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __register_onexit_function referenced in function __onexit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __execute_onexit_table referenced in function ___scrt_dllmain_uninitialize_c
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_atexit referenced in function __onexit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_at_quick_exit referenced in function _at_quick_exit
libcmtd.lib(utility.obj) : error LNK2019: unresolved external symbol __cexit referenced in function ___scrt_dllmain_uninitialize_c
libcmtd.lib(tncleanup.obj) : error LNK2019: unresolved external symbol ___std_type_info_destroy_list referenced in function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info@@YAXXZ)
libcmtd.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _terminate referenced in function ___scrt_unhandled_exception_filter@4
bin\strace.dll : fatal error LNK1120: 16 unresolved externals
LINK Pass 1 failed. with 1120
ninja: build stopped: subcommand failed.
*** TODO also can't build from dev tools cmd w/o ninja
This is cmake 3.3.1, and a VS2015 command prompt:
C:\derek\build_drmf>"c:\Program Files (x86)\CMake\bin\cmake.exe" -DDynamoRIO_DIR=c:/derek/DynamoRIO-Windows-6.1.0-2/cmake/ -DDrMemoryFramework_DIR=c:/derek/DynamoRIO-Windows-6.1.0-2/drmemory/drmf/ ../DynamoRIO-Windows-6.1.0-2/drmemory/drmf/samples
-- Building for: Visual Studio 14 2015
-- The C compiler identification is MSVC 19.0.23506.0
-- The CXX compiler identification is MSVC 19.0.23506.0
-- Check for working C compiler using: Visual Studio 14 2015
-- Check for working C compiler using: Visual Studio 14 2015 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015
-- Check for working CXX compiler using: Visual Studio 14 2015 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/derek/build_drmf
C:\derek\build_drmf>"c:\Program Files (x86)\CMake\bin\cmake.exe" --build .
Microsoft (R) Build Engine version 14.0.24730.2
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 3/8/2016 3:09:09 PM.
The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (186,61)" does not exist in the project, and will be ignored.
The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Micros
oft\NuGet\Microsoft.NuGet.targets (186,61)" does not exist in the project, and will be ignored.
Project "C:\derek\build_drmf\ALL_BUILD.vcxproj" on node 1 (default targets).
Project "C:\derek\build_drmf\ALL_BUILD.vcxproj" (1) is building "C:\derek\build_drmf\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\derek\build_drmf\ZERO_CHECK.vcxproj]
Same thing with the latest cmake, 3.5.0.
Opening up the .vxproj: General | Platform Toolset does say "Visual Studio 2015 (v140)" for all targets. Inside the IDE, it does compile, but then it hits the link errors seen w/ cygwin ninja above.