GauthamBanasandra opened a new pull request, #8713:
URL: https://github.com/apache/hadoop/pull/8713

   ### Description of PR
   
   Building `hadoop-common` with `-Pnative-win` fails on Windows against a 
current
   Windows 11 SDK:
   
   ```
   winutils.h(129,7): error C2733: 'GetFileInformationByName': you cannot 
overload
   a function with 'extern "C"' linkage [libwinutils.vcxproj]
   ```
   
   Windows SDK 10.0.26100.0 introduced its own `GetFileInformationByName` in
   `WinBase.h` (guarded by `#if (NTDDI_VERSION >= NTDDI_WIN11_ZN)`). It collides
   with the winutils helper of the same name that Hadoop has carried for years:
   
   ```c
   /* Windows SDK 10.0.26100.0 - WinBase.h */
   BOOL WINAPI GetFileInformationByName(PCWSTR, FILE_INFO_BY_NAME_CLASS, PVOID, 
ULONG);
   
   /* hadoop - winutils.h */
   DWORD GetFileInformationByName(LPCWSTR pathName, BOOL followLink,
                                  LPBY_HANDLE_FILE_INFORMATION 
lpFileInformation);
   ```
   
   The two differ in signature, so in C++ they would ordinarily overload. But
   overloading requires C++ linkage and both have **C** linkage — `winutils.h`
   wraps its declarations in `extern "C"`, and so does the SDK header — so the
   compiler rejects the pair. It surfaces in `libwinutils.vcxproj`, which 
compiles
   `config.cpp` as C++. SDK 10.0.22621.0 does not declare the symbol, which is 
why
   this only now breaks.
   
   The SDK name cannot be changed, so this renames the Hadoop helper to
   `GetFileInformationByPathName`. That also reads as the by-path counterpart to
   the SDK's existing `GetFileInformationByHandle`.
   
   This is a pure rename of one internal helper plus its call sites. No 
behaviour
   change, and no change to any public or JNI-visible surface.
   
   ### How was this patch tested?
   
   Built on Windows 11 with Visual Studio 2022 (toolset v143), Windows SDK
   10.0.26100.0, and JDK 8, using the `native-win` profile:
   
   - `hadoop-common` builds, producing `winutils.exe`, `hadoop.dll` and
     `libwinutils.lib`.
   - `hadoop-hdfs-native-client` builds, producing `hdfs.dll`.
   - Full reactor `mvn install -Pdist,src,yarn-ui -Dtar -DskipTests`: BUILD 
SUCCESS
     across all 232 modules; the resulting `hadoop-3.5.0-SNAPSHOT.tar.gz` 
contains
     `bin/winutils.exe`, `bin/hadoop.dll` and `bin/hdfs.dll`.
   - Smoke-tested the rebuilt binary on the renamed code path: `winutils ls 
<file>`
     (which calls the renamed function), `winutils chmod 754 <file>` followed by
     `winutils ls`, and `winutils systeminfo` all behave as before.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts with the corresponding JIRA issue id
         (e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint
         declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in
         a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to