Skip to content

Conversation

@YuniqueUnic
Copy link

Description

This PR addresses critical CI build failures and enhances path handling robustness for cross-platform compatibility. Below are the details of the issues encountered and the corresponding solutions implemented.

Issues Encountered in CI Build

  1. Missing vendor Directory: The vendor directory (containing third-party dependencies) was absent in the target path during CI runs. This caused failures when the static feature is enabled (requires dependency source/binary files from the vendor submodule).
  2. Incorrect Path Resolution: When building the GNU version of the WinDivert static library in CI, build.rs failed to locate the vendor/dll directory. The root cause was a hardcoded Windows-style path string ("vendor\include"), which is incompatible with cross-platform build environments.

Relevant modification measures:

  • Replace hardcoded string paths with path_macro2 macros to improve cross-platform compatibility and maintainability.
  • Add path_macro2 as a build dependency in Cargo.toml.
  • Implement automatic Git submodule initialization for static builds.
  • Optimize the file copying logic and sys file detection in the build script.
  • Consistently use the path! and path_const! macros to format paths in the compiler configurations (gnu.rs and msvc.rs), thereby generating path formats compatible with the respective systems.

Could you please review this PR when you have time? Let me know if there are any adjustments needed for better compatibility or maintainability!

…ove build scripts

- Replace hardcoded string paths with `path_macro2` macros for better cross-platform
  compatibility and maintainability.
- Add `path_macro2` as a build dependency in Cargo.toml.
- Introduce automatic git submodule initialization during static builds.
- Improve file copying logic and sys file detection in build scripts.
- Format Windows-specific paths using `path!` and `path_const!` macros consistently
  across gnu.rs and msvc.rs compilers.
- Clean up object files properly after DLL compilation.
@YuniqueUnic
Copy link
Author

YuniqueUnic commented Nov 4, 2025

The failing job encountered this error:

error: package `syn v2.0.108` cannot be built because it requires rustc 1.68 or newer, while the currently active rustc version is 1.64.0

update MSRV to 1.68 in check workflow

Update the minimum supported Rust version to 1.68 in the GitHub Actions check workflow
configuration file.

  strategy:
       fail-fast: false
       matrix:
-        msrv: [1.64]
+        msrv: [1.68]
     steps:
       - uses: actions/checkout@v4
         with:

Update the minimum supported Rust version to 1.68 in the GitHub Actions check workflow
configuration file.
@Rubensei
Copy link
Owner

Rubensei commented Nov 4, 2025

I do appreciate the contribution, but the changes are not suitable for merging

Cross compilation was already fixed by just replacing the backward slashes for fordward slashes, no need to add a dependency for something that was just a typo (and also resolvable using std)

Submodule initialization:

  1. The vendor folder is always populated, creates.io tarball releases do contain the folder and cargo recursively initializes submodules in git dependencies
  2. It is not good practice to include network steps in build scripts for a few reasons

@Rubensei Rubensei closed this Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants