Opened 9 years ago

Closed 9 years ago

#9301 closed Bugs (fixed)

Error when attempting to boot strap boost

Reported by: Ben Key <BKey76@…> Owned by:
Milestone: Boost 1.55.0 Component: Building Boost
Version: Boost Development Trunk Severity: Showstopper
Keywords: Cc:

Description

Error when attempting to bootstrap boost

Hello,

I am getting the following error when attempting to run "bootstrap.bat mingw."

Building Boost.Build engine builtins.c: In function 'builtin_readlink': builtins.c:1879:39: error: 'FSCTL_GET_REPARSE_POINT' undeclared (first use in this function)

int okay = DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, &buf, sizeof(buf), &n, NULL);

builtins.c:1879:39: note: each undeclared identifier is reported only once for each function it appears in

Failed to build Boost.Build engine. Please consult bootstrap.log for further diagnostics.

This error does not happen with MSVC but it does happen with MinGW.

For both MinGW and MSVC, FSCTL_GET_REPARSE_POINT is defined in winioctl.h. However, this header file is not directly included in builtins.c. Only Windows.h is directly included in builtins.c.

This compiles for MSVC because winioctl.h is included by winscard.h which is in turn included by Windows.h. But winscard.h does not even exist in the MinGW header files and the MinGW version of Windows.h does not include winioctl.h. Thus winioctl.h is not indirectly included as it is in MSVC.

The solution is obvious. Do not assume that the header fill will be indirectly included as a side effect of including Windows.h. Instead modify builtins.c to directly include winioctl.h. With this one line change the error is resolved.

Change History (5)

comment:1 by Steven Watanabe, 9 years ago

This is not a "side-effect." The inclusion of winioctl.h is part of the documented behavior of Windows.h. Including Windows.h is correct according to MSDN. http://msdn.microsoft.com/en-us/library/windows/desktop/aa364571%28v=vs.85%29.aspx

in reply to:  1 comment:2 by Ben Key, 9 years ago

I think you misunderstand what I was saying. I was not saying that including Windows.h is wrong. I am saying that assuming that including Windows.h will automatically cause winioctl.h to be included on every compiler in existence is wrong. And referring to Microsoft documentation that is specific to Microsoft Visual Studio does not disprove my point.

When Boost is compiled using MinGW there is a compilation error due to the use of a constant that is not defined by any of the directly included header files. You get away with not including the header file in which the constant is defined on one compiler, but Boost is a library that supports many compilers and many operating systems.

On one very commonly used compiler including Windows.h does not cause winioctl.h to be included. The solution is simple, add one line of code to Boost. Do not say that "Microsoft says thus and we only care about compilers that do as Microsoft says."

My suggested change is to include winioctl.h in addition to Windows.h since not all versions of Windows.h in existence cause winioctl.h to be included.

I would understand your resistance to this change if I was referring to a compiler that no one uses, but MinGW is a heavily used version of GCC.

comment:3 by Steven Watanabe, 9 years ago

Note that this has been fixed in recent MinGW.

comment:4 by Steven Watanabe, 9 years ago

Never mind that. I was thinking of something else.

comment:5 by Steven Watanabe, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.