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

Issue on cross compiling WslPluginApi.h #12580

Open
mveril opened this issue Feb 12, 2025 · 5 comments
Open

Issue on cross compiling WslPluginApi.h #12580

mveril opened this issue Feb 12, 2025 · 5 comments
Assignees
Labels

Comments

@mveril
Copy link

mveril commented Feb 12, 2025

Hello,

I am developing a Rust framework for creating WSL plugins wslplugins-rs, with a core component involving pure ffi bindings generated using bindgen and windows-rs. It's called wslpluginapi-sys. While the binding generation succeeds on Windows, I encountered an issue when I started to develop cross-compilation feature from Linux to Windows that is nesscesaary for documentation building on docs.rs.

Specifically, the header file provided in your NuGet package includes:

#include <Windows.h>

However, on case-sensitive file systems like Linux, the header is named windows.h, leading to compilation errors. To proceed, I manually edited the header to replace:

#include <Windows.h>

with:

#include <windows.h>

To enhance cross-platform compatibility and streamline the cross-compilation process, I suggest updating the header in future releases to use #include <windows.h>. This change would prevent manual intervention and facilitate smoother cross-compilation from Linux to Windows.

Thank you for considering this improvement.

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

@mveril
Copy link
Author

mveril commented Feb 12, 2025

/feature

Copy link

Diagnostic information
Found '/feature', adding tag 'feature'

@OneBlue OneBlue self-assigned this Feb 12, 2025
@benhillis
Copy link
Member

Which windows.h are you referring to? I just checked the version included in the Windows SDK and it's upper-case Windows.h.

@mveril
Copy link
Author

mveril commented Feb 13, 2025

Oh !
In MinGW it's lowercase
You can check my work in progress branch on feature/cross-compile with the build.rs script that make the required change on Unix platform (tested on WSL and GitHub action).
In fact you are right on Windows SDK it's uppercase.
The issue is the case difference between the Windows SDK on Windows and the MinGW cross compiler on Ubuntu.
Also contrary to Windows, unix platforms are case sensitive.
So now I'm not sure if switching to lowercase is really a good idea.

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

No branches or pull requests

3 participants