Zeromus Golbeze
Zeromus Golbeze

Reputation: 53

FILE_INFO_BY_HANDLE_CLASS not found when compile v8 on windows

I am compiling v8 on win10 pro 20H2 build.

I had already fetch the source code and used gn gen --ide=vs out\x64_proj command under v8\src directory to generate visual studio projects.

there are some small problems during process above,such as env variables, proxy. but I fixed them.

when I start to compile gn_all project in my vs2019 , some error appeared.

most of them is very similar:

1>In file included from ../../../src/base/debug/stack_trace_win.cc:17:
1>In file included from D:\Windows Kits\10\Include\10.0.19041.0\um\windows.h:172:
1>In file included from D:\Windows Kits\10\Include\10.0.19041.0\um\winbase.h:43:
1>In file included from D:\Windows Kits\10\Include\10.0.19041.0\um\fileapifromapp.h:20:
1>D:\Windows Kits\10\Include\10.0.19041.0\um\winbase.h(9118,11): error : unknown type name 'FILE_INFO_BY_HANDLE_CLASS'
1>    _In_  FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
            ^

I google this symbol and find it in minwinbase.h:

#if (NTDDI_VERSION >= NTDDI_LONGHORN)
typedef enum _FILE_INFO_BY_HANDLE_CLASS {
    FileBasicInfo,
    FileStandardInfo,
    FileNameInfo,
    FileRenameInfo,
    FileDispositionInfo,
    FileAllocationInfo,
    FileEndOfFileInfo,
    FileStreamInfo,
    FileCompressionInfo,
    FileAttributeTagInfo,
    FileIdBothDirectoryInfo,
    FileIdBothDirectoryRestartInfo,
    FileIoPriorityHintInfo,
    FileRemoteProtocolInfo,
    FileFullDirectoryInfo,
    FileFullDirectoryRestartInfo,
#if (NTDDI_VERSION >= NTDDI_WIN8)
    FileStorageInfo,
    FileAlignmentInfo,
    FileIdInfo,
    FileIdExtdDirectoryInfo,
    FileIdExtdDirectoryRestartInfo,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS1)
    FileDispositionInfoEx,
    FileRenameInfoEx,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_19H1)
    FileCaseSensitiveInfo,
    FileNormalizedNameInfo,
#endif
    MaximumFileInfoByHandleClass
} FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif

I guess it was the version macro problem to cause this enum not included. so I create another project to print NTDDI_VERSION, but it return 0xa0000008 which is greater than all macro appear above.

then I try to just comment these macro out, and it works, vs continue to compile antother files, and meet some new errors.

but appearently this is just a temporary patch, not a root cause, and the new errors seems also have do with this:

1>../../../src/base/debug/stack_trace_win.cc(173,12): error : use of undeclared identifier 'RtlCaptureStackBackTrace'
1>  count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, nullptr);
1>           ^
1>D:\Windows Kits\10\Include\10.0.19041.0\um\winbase.h(118,31): note: expanded from macro 'CaptureStackBackTrace'
1>#define CaptureStackBackTrace RtlCaptureStackBackTrace
1>../../../src/base/platform/platform-win32.cc(841,11): error : use of undeclared identifier 'IsWindows10OrGreater'
1>      if (IsWindows10OrGreater())

I guess it was that some buildtools didn't configure correctly, but I have no idea what it could be. Anyone have some ideas?

Upvotes: 5

Views: 3679

Answers (4)

Dang_Ho
Dang_Ho

Reputation: 351

Search all your project "_WIN32_WINNT" and "WINVER". Change the value to 0x0A00 #define _WIN32_WINNT 0x0A00 // Target Windows 10 #define WINVER 0x0A00

This variable is the target version for Windows you are plaining to build. Because the visual studio you are using having a new version but you software running with the old version requirement. So you need to add this. Then compiler can look up the correct library in Visual Studio

Upvotes: 0

Z4J5
Z4J5

Reputation: 21

try install windows sdk version 10.0.20348.0 or newest.

Upvotes: 2

JakeSays
JakeSays

Reputation: 349

This isn't an ideal solution but it met my immediate needs.

Roll v8 back to version 9.9.115.10 and d8 builds fine.

To roll back, git checkout 7d7c04aac7d650964d96d1f1c080949ae5519c78 and then gclient sync.

Apparently the main branch is currently broken.

Upvotes: 0

jmrk
jmrk

Reputation: 40681

I think the generated VS project files are enough for browsing/editing but not suitable for compiling. Try building with ninja on the command line. See the official documentation, in short it's just:
ninja -C out\x64_proj, optionally with a specific target to build.

Upvotes: 0

Related Questions