Skip to content

windows-sys@0.61.0+ is broken for win7 target #3808

Closed

Description

@Fenex

windows-sys@0.60.2 is the last version of the crate that can works without a problem under *-win7-windows-msvc target.

Starts from 0.61.0 there is a bug that cannot allow to running compiled binaries. Compiled programs at the start output a message:

$ sea --help
C:/Users/Fenex/.cargo/bin/sea.exe: error while loading shared libraries: combase.dll: cannot open shared object file: No such file or directory
$ rustc -vV
rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: x86_64-win7-windows-msvc
release: 1.91.0
LLVM version: 21.1.2

Activity

  1. kennykerr commented on Nov 5, 2025

    @kennykerr
    Collaborator

    This is likely related to #3743 where it favors compatibility with Windows 11 editions over Windows 7. It only affects a handful of functions so I would just use the windows-link crate directly and specify whatever library you desire.

  2. Fenex commented on Nov 5, 2025

    @Fenex
    Author
  3. kennykerr commented on Nov 5, 2025

    @kennykerr
    Collaborator

    I just want to install cli utility

    Ah, you'll have to check with whoever develops the utility. It may be that they no longer support Windows 7.

  4. Fenex commented on Nov 5, 2025

    @Fenex
    Author

    It may be that they no longer support Windows 7.

    I'm sure problem in this crate, not their.

    I had clone a sea-orm-cli and make downgrade some dependency crates to exclude windows-sys>0.61 from the dependency tree. And all start works fine.

  5. roblabla commented on Dec 2, 2025

    @roblabla
    Contributor

    Kenny Kerr (@kennykerr) Why is windows-rs team so against merging #3791 ? This PR fixes the problems for the people who are experiencing issues with the Win7 target, while still being compatible with whatever weird Win11 target Microsoft is using internally. Why is this project being so actively hostile towards the folks that need win7 to work?

    Also, are we pretending that this Win11 Edition will ever be public? Because it's pretty obvious this is an internal component for MS, given how much existing software will not work on it. The official MS documentation website still claims that all those functions are available through OLE32.dll and not combase.dll...

    So really, this change was done "in favor" of internal MS builds, at the expense of win7 user, despite having a clear way to mitigate the breakage.


    I understand not wanting to support Win7 - I really do. I only support it begrudgingly, because some of my customers have old servers they can't or won't upgrade. But I don't understand why you would reject a simple PR that fixes the win7 breakage without causing any trouble for the targets you do support.

  6. kennykerr commented on Dec 2, 2025

    @kennykerr
    Collaborator

    On a practical level, we don't have the ability to test any of this and without that ability there is nothing that ensures that it even works to begin with or that ensures that it keeps working as future changes are made to this project. As it is, I've allowed a few changes over the years that were not easily testable and they have all come back to bite me in the end. 🙃

    The "weird Win11 target" is actually just a subset of Windows 11 and not some different edition. That is why in practice whatever works on that edition will also work on regular Windows 11. The documentation is unfortunately out of my control but something I hope to affect as we improve the quality and efficacy of the Windows API metadata.

  7. roblabla commented on Dec 3, 2025

    @roblabla
    Contributor

    On a practical level, we don't have the ability to test any of this and without that ability there is nothing that ensures that it even works to begin with or that ensures that it keeps working as future changes are made to this project.

    I understand that, and I'm not asking for the Windows-RS project to test win7 support or to keep win7 working in the future. I fully understand that changes you make can (and will) break win7 support. All I'm asking is the willingness to review/accept contributions that fix win7 when those patches don't impact the supported targets, and are kept simple enough to not impose undue maintenance burden. I don't think the patches I provided failed that test - though if you disagree, I'd like to understand how. As it stands, win7 support is broken anyways, so it's hard to see how the patch could make the situation worse.

    Windows-rs is the foundation on which the entire Rust Windows ecosystem relies. As things stand, it's impossible to make a toolchain supporting win7, solely because of this decision to not accept win7 fixes. Cargo can't even build without this patch. And I think asking every project on earth to carry a fix to support win7, when the fix could easily be included in windows-sys, is rather unreasonable.

    I really hope we can find some compromise here.

  8. roblabla commented on Dec 3, 2025

    @roblabla
    Contributor

    As an alternative, would you accept adding a new target to windows-targets for win7, with the fix provided by riverar (the forwarder .def linked through a build script)? This would make for a self-contained crate where win7-specific fixes can go, at least for windows-sys things, which would minimize your maintenance impact even further.

  9. jamesvren commented on Jun 11, 2026

    @jamesvren

    This is likely related to #3743 where it favors compatibility with Windows 11 editions over Windows 7. It only affects a handful of functions so I would just use the windows-link crate directly and specify whatever library you desire.

    Can give an example about how to overwrite the link already existed in windows-sys crate?
    I met the same issue and want to change the link for window7.

  10. jamesvren commented on Jun 12, 2026

    @jamesvren

    I don't get it. How can you use the codes of this repo to change or remove the link for combase.dll in windows-sys crate?
    I also tried the method metioned by riverar in #3743, it did add ole32.dll function but still require combase.dll.

    Is it possible to release a raw-dylib and ole32.dll based version without touching the main release?

  11. jamesvren commented on Jun 12, 2026

    @jamesvren

    Ok, here is my solution. In your lib.rs,

    pub mod win7com {
        pub use windows_sys::Win32::System::Com::*;
        windows_link::link!("ole32.dll" "system" fn CoTaskMemAlloc(cb : usize) -> *mut core::ffi::c_void);
        windows_link::link!("ole32.dll" "system" fn CoTaskMemFree(pv : *const core::ffi::c_void));
    }
    

    then in your code where use the function

    use crate::win7com::*; // to replace use windows_sys::Win32::System::Com::CoTaskMemAlloc;
    
  12. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions