[PR #1704] [MERGED] [FIX] cargo tests failing on windows #2419

Open
opened 2026-01-29 17:22:03 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1704
Author: @hrideshmg
Created: 6/26/2025
Status: Merged
Merged: 6/29/2025
Merged by: @prateekmedia

Base: masterHead: windows_cargo_fix


📝 Commits (1)

  • c7eea7e fix: cargo tests failing on windows

📊 Changes

5 files changed (+85 additions, -76 deletions)

View changed files

📝 src/rust/lib_ccxr/src/time/timing.rs (+19 -10)
📝 src/rust/lib_ccxr/src/time/units.rs (+6 -16)
📝 src/rust/src/lib.rs (+57 -39)
📝 src/rust/src/libccxr_exports/time.rs (+2 -1)
📝 src/rust/src/parser.rs (+1 -10)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Cargo tests have been failing on Windows on the master branch for a while now. The primary reason seems to be differences in linking behaviour between the GNU and MSVC ABIs, see here for more info.

The main issue was that when running unit tests, the linker that MSVC uses couldn't resolve several external C symbols, primarily these. This makes sense as when running unit tests, the C side of the codebase never comes into play. To address this, I added a cfg_if block that provides mock implementations during test runs so that the tests can run without requiring linkage to C symbols.

I also noticed that there was an extern declaration in lib_ccxr for MPEG_CLOCK_FREQUENCY, after consulting with @steel-bucket I realized that this is was an oversight as the lib_ccxr crate is meant to be a clean idiomatic rust layer. To fix this, I added a new field to GLOBAL_TIMING_INFO and ensured the MPEG clock frequency is passed explicitly through FFI.

With these changes, all unit tests now run successfully on Windows. This should help with fixing any windows specific bugs in upcoming PRs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1704 **Author:** [@hrideshmg](https://github.com/hrideshmg) **Created:** 6/26/2025 **Status:** ✅ Merged **Merged:** 6/29/2025 **Merged by:** [@prateekmedia](https://github.com/prateekmedia) **Base:** `master` ← **Head:** `windows_cargo_fix` --- ### 📝 Commits (1) - [`c7eea7e`](https://github.com/CCExtractor/ccextractor/commit/c7eea7eb96d0e7fc62fe40b499baa23c0e0cbb25) fix: cargo tests failing on windows ### 📊 Changes **5 files changed** (+85 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `src/rust/lib_ccxr/src/time/timing.rs` (+19 -10) 📝 `src/rust/lib_ccxr/src/time/units.rs` (+6 -16) 📝 `src/rust/src/lib.rs` (+57 -39) 📝 `src/rust/src/libccxr_exports/time.rs` (+2 -1) 📝 `src/rust/src/parser.rs` (+1 -10) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [ ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [x] I am an active contributor to CCExtractor. --- Cargo tests have been failing on Windows on the master branch for a while now. The primary reason seems to be differences in linking behaviour between the GNU and MSVC ABIs, see [here](https://rust-lang.github.io/rustup/installation/windows.html#:%7E:text=Or%20to%20choose%20the%2064%20bit%20GNU%20toolchain) for more info. The main issue was that when running unit tests, the linker that MSVC uses couldn't resolve several external C symbols, primarily [these](https://github.com/CCExtractor/ccextractor/blob/407d0f4e93611c5b0ceb14b7fc01d4a4c2e90433/src/rust/src/lib.rs#L60-L77). This makes sense as when running unit tests, the C side of the codebase never comes into play. To address this, I added a `cfg_if` block that provides mock implementations during test runs so that the tests can run without requiring linkage to C symbols. I also noticed that there was an extern declaration in `lib_ccxr` for `MPEG_CLOCK_FREQUENCY`, after consulting with @steel-bucket I realized that this is was an oversight as the `lib_ccxr` crate is meant to be a clean idiomatic rust layer. To fix this, I added a new field to GLOBAL_TIMING_INFO and ensured the MPEG clock frequency is passed explicitly through FFI. With these changes, all unit tests now run successfully on Windows. This should help with fixing any windows specific bugs in upcoming PRs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:22:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2419