nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.11k stars 637 forks source link

`scons source` fails with "Cannot open include file: 'ctype.h': No such file or directory" error #6356

Closed rpaquay closed 7 years ago

rpaquay commented 8 years ago

tldr: The root cause seems related to installing the Windows Driver Kit - Windows 10.0.14393.0, which confuses the scons script detecting the Univeral CRT location.

After cloning the latest repository and installing the dependencies as explained in the readme.md file, running scons source failed with the following error:

(...)
Preparing target build\x86\ia2_i.obj...
cl /Fobuild\x86\ia2_i.obj /c build\x86\ia2_i.c /nologo /wd4091 /arch:IA32 /W3 /WX /Od /MT /D_USING_V110_SDK71_=UNICODE /DWIN32 /DREGISTER_PROXY_DLL /Iinclude /I
miscDeps\include /Ibuild\x86 /Z7
ia2_i.c
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
scons: *** [build\x86\ia2_i.obj] Error 2
scons: building terminated because of errors.

After setting the SCONS_MSCOMMON_DEBUG (set SCONS_MSCOMMON_DEBUG=- and then run scons source again) to figure out what is happening, the log showed that scons was picking the Universal CRT from a directory that did not include the universal CRT include files. In the log below, the list of entries contains 'C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.14393.0\\ucrt which does not exist on my machine.

vc.py:msvc_setup_env() env:PATH -> ['C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow', 'C:\\Program
 Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN', 'C:\\Program Files (x86)\\Microso
ft Visual Studio 14.0\\Common7\\Tools', 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\VCPacka
ges', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Team Tools\\Performance Tools', 'C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86', 'C:\\Progr
am Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6 Tools\\', 'C:\\Windows\\System32']
vc.py:msvc_setup_env() env:INCLUDE -> ['C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE', 'C:\\Program Files (x86)\\Microsoft Visual Studio 1
4.0\\VC\\ATLMFC\\INCLUDE', 'C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.14393.0\\ucrt', 'C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6\\incl
ude\\um', 'C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\shared', 'C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\um', 'C:\\Program Files (x86)
\\Windows Kits\\8.1\\include\\\\winrt']

The issue is that I had installed at some point decided to install the Windows Driver Kit - Windows 10.0.14393.0, which seems to have installed a partial(?) universal crt that does not contain all expected directories, i.e. it is missing a "ucrt" sub-folder.

 Directory of C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0

08/26/2016  09:48 AM    <DIR>          .
08/26/2016  09:48 AM    <DIR>          ..
08/26/2016  09:48 AM    <DIR>          km
08/26/2016  09:48 AM    <DIR>          mmos
08/26/2016  09:48 AM    <DIR>          shared
08/26/2016  09:48 AM    <DIR>          um

By comparison, a "real" Universal CRT installation directory looks like this:

 Directory of C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0

07/18/2016  04:32 PM    <DIR>          .
07/18/2016  04:32 PM    <DIR>          ..
07/18/2016  04:32 PM    <DIR>          ucrt

I worked around the issue by renaming the 10.0.14393.0 directory to bak.10.0.14393.0 so it is skipped by the scons script.

LeonarddeR commented 7 years ago

@rpaquay: Would you be able to try this again with the most recent version of master, which requires VS2017 and uses the Windows 10 SDK?

feerrenrut commented 7 years ago

I've run into this (or something similar) before, I ended up having to resinstall Visual Studio 2015 and the Windows SDK component. Since the issue seems to be resolved for @rpaquay, I'll close the issue. However, @rpaquay if you have any other information to add, please do.