Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building DR with VS2015 #2166

Closed
b1ack0wl opened this issue Jan 31, 2017 · 10 comments
Closed

Support building DR with VS2015 #2166

b1ack0wl opened this issue Jan 31, 2017 · 10 comments

Comments

@b1ack0wl
Copy link

I've looked at all of the related issues with VS15 (e.g. #2125) and the solutions are not working for me. I still have errors with resolving C functions such as _snprintf.

Build FAILED.

"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\tools\DRcontrol.vcxproj" (default target) (3) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj" (default target) (4) ->
(ClCompile target) ->
  C:\Users\WinAFL\Desktop\dynamorio\libutil\services.c(422): warning C4459: declaration of 'scmdb' hides global declara
tion [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj]
  C:\Users\WinAFL\Desktop\dynamorio\libutil\utils.c(396): warning C4477: '_snwprintf' : format string '%S' requires an
argument of type 'char *', but variadic argument 1 has type 'const TCHAR *' [C:\Users\WinAFL\Desktop\dynamorio\build\li
butil\policy_static.vcxproj]
  C:\Users\WinAFL\Desktop\dynamorio\libutil\utils.c(396): warning C4477: '_snwprintf' : format string '%S' requires an
argument of type 'char *', but variadic argument 2 has type 'unsigned short *' [C:\Users\WinAFL\Desktop\dynamorio\build
\libutil\policy_static.vcxproj]
  C:\Program Files\Windows Kits\10\Include\10.0.14393.0\ucrt\stdio.h(1925): warning C4005: 'snprintf': macro redefiniti
on [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\clients\drcachesim\drcachesim.vcxproj" (default target) (32) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\drconfiglib.vcxproj" (default target) (33) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\core\drdecode.vcxproj" (default target) (34) ->
  C:\Users\WinAFL\Desktop\dynamorio\core\arch\x86\decode.c(774): warning C4456: declaration of 'code' hides previous lo
cal declaration [C:\Users\WinAFL\Desktop\dynamorio\build\core\drdecode.vcxproj]
  C:\Users\WinAFL\Desktop\dynamorio\core\arch\x86\decode.c(775): warning C4456: declaration of 'idx' hides previous loc
al declaration [C:\Users\WinAFL\Desktop\dynamorio\build\core\drdecode.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\dumpevts.vcxproj" (default target) (68) ->
  C:\Users\WinAFL\Desktop\dynamorio\libutil\dumpevts.c(93): warning C4456: declaration of 'res' hides previous local de
claration [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\dumpevts.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\tools\DRcontrol.vcxproj" (default target) (3) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj" (default target) (4) ->
(ClCompile target) ->
  C:\Users\WinAFL\Desktop\dynamorio\libutil\services.c(422): error C2220: warning treated as error - no 'object' file g
enerated [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj]
  C:\Users\WinAFL\Desktop\dynamorio\libutil\utils.c(396): error C2220: warning treated as error - no 'object' file gene
rated [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj]
  C:\Program Files\Windows Kits\10\Include\10.0.14393.0\ucrt\stdio.h(1925): error C2220: warning treated as error - no
'object' file generated [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\policy_static.vcxproj]
  C:\Program Files\Windows Kits\10\Include\10.0.14393.0\ucrt\stdio.h(1927): fatal error C1189: #error:  Macro definitio
n of snprintf conflicts with Standard Library function declaration [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\pol
icy_static.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\api\samples\bbbuf.vcxproj" (default target) (12) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\ext\drcontainers\drcontainers.vcxproj" (default target) (14) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\core\dynamorio.vcxproj" (default target) (15) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\core\ntdll_imports.vcxproj" (default target) (20) ->
(Link target) ->
  ntdll_imports.def : error LNK2001: unresolved external symbol _snprintf [C:\Users\WinAFL\Desktop\dynamorio\build\core
\ntdll_imports.vcxproj]
  ntdll_imports.def : error LNK2001: unresolved external symbol _snwprintf [C:\Users\WinAFL\Desktop\dynamorio\build\cor
e\ntdll_imports.vcxproj]
  ntdll_imports.def : error LNK2001: unresolved external symbol _vsnprintf [C:\Users\WinAFL\Desktop\dynamorio\build\cor
e\ntdll_imports.vcxproj]
  ntdll_imports.def : error LNK2001: unresolved external symbol sprintf [C:\Users\WinAFL\Desktop\dynamorio\build\core\n
tdll_imports.vcxproj]
  ntdll_imports.def : error LNK2001: unresolved external symbol sscanf [C:\Users\WinAFL\Desktop\dynamorio\build\core\nt
dll_imports.vcxproj]
  C:/Users/WinAFL/Desktop/dynamorio/build/lib32/ntdll_imports.lib : fatal error LNK1120: 5 unresolved externals [C:\Use
rs\WinAFL\Desktop\dynamorio\build\core\ntdll_imports.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\clients\drcachesim\drcachesim.vcxproj" (default target) (32) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\drconfiglib.vcxproj" (default target) (33) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\core\drdecode.vcxproj" (default target) (34) ->
(ClCompile target) ->
  C:\Users\WinAFL\Desktop\dynamorio\core\arch\x86\decode.c(774): error C2220: warning treated as error - no 'object' fi
le generated [C:\Users\WinAFL\Desktop\dynamorio\build\core\drdecode.vcxproj]


"C:\Users\WinAFL\Desktop\dynamorio\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\WinAFL\Desktop\dynamorio\build\libutil\dumpevts.vcxproj" (default target) (68) ->
  C:\Users\WinAFL\Desktop\dynamorio\libutil\dumpevts.c(93): error C2220: warning treated as error - no 'object' file ge
nerated [C:\Users\WinAFL\Desktop\dynamorio\build\libutil\dumpevts.vcxproj]

    7 Warning(s)
    12 Error(s)

Time Elapsed 00:00:10.01

I've been trying to build this all day and have been unsuccessful. Any help would be greatly appreciated.

Steps taken:

  • Reinstall Windows 10 SDK (Debugger, SDK, App verifier...etc. the whole nine yards)
  • Download Dynamorio via git
  • Download and install all dependancies
  • Double check cmake files to make sure they have the 'if not VC < 1900" patch
  • Double check environment variables
  • Reboot machine (Did you try turning it off and on again?)
  • Run MS Update (For good measure)

Environment: Windows 10 x86, VS15 Community.

@derekbruening
Copy link
Contributor

#2125 is about building a client, not DR. I don't think anybody has tried building DR itself with VS2015. This issue will cover that support. It is not unusual for new compiler versions to have a few new warnings. If you end up with a patch to fix the warnings please contribute it back upstream.

@b1ack0wl
Copy link
Author

b1ack0wl commented Jan 31, 2017

Ah okay that was my mistake. I'll keep poking around and if I can come up with a fix then I'll submit a pull request :)

Edit: There are also errors within the build process which is why I'm currently halted but I'll keep working on this.

@0vercl0k
Copy link

This should be fixed by linking against 'legacy_stdio_definitions.lib'.

Cheers

@b1ack0wl
Copy link
Author

The WinAFL project had the same issue which was resolved with the following PR: https://github.com/ivanfratric/winafl/pull/46

I added the following libraries to the project: "libucrt.lib", "libvcruntime.lib". I'll try modifying the CMakeLists tonight to see if I can help fix this issue. Once the issue is resolved I'll then submit a PR.

@derekbruening
Copy link
Contributor

Sounds right, that is what was added to clients in 94aeb0e

Just be careful that some core libraries need to have zero libc-ish dependencies so we cannot have dynamorio.dll itself importing from any dll other than ntdll.dll.

@b1ack0wl
Copy link
Author

Thanks for the heads up! I'll be able to do some troubleshooting and such tonight. I'll posts any edits in this thread before submitting any PRs

@derekbruening
Copy link
Contributor

We can add a VS2015 build to Appveyor once it's working. Unfortunately Appveyor, unlike Travis, doesn't run build jobs in parallel, so it will add to the total time: but in the middle of weekdays we're waiting for Travis Mac VM contention anyway.

@derekbruening derekbruening changed the title Build Error: Windows 10 x86 - VS15 Community Support building DR with VS2015 Apr 12, 2018
@derekbruening
Copy link
Contributor

Xref #1902

@illera88
Copy link
Contributor

Hi @b1ack0wl,

did you end up fixing it?

Thank you

@derekbruening
Copy link
Contributor

We are adopting VS2017 as the officially supported build. We would expect VS2015 to work as well but there is no planned effort to test it or maintain it. Closing. Of course if someone wants to support it and add a Jenkins build to maintain it that is certainly a possibility: re-open in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants