kornia/kornia-rs

[Bug]: kornia-apriltag tests are not portable on Windows due to pthread dependency and fixture path assumptions

Open

#805 opened on Mar 10, 2026

View on GitHub
 (2 comments) (0 reactions) (1 assignee)Rust (188 forks)auto 404
bughelp wantedtriage

Repository metrics

Stars
 (675 stars)
PR merge metrics
 (PR metrics pending)

Description

🐛 Describe the bug

cargo test -p kornia-apriltag is not portable across environments:

On Windows, test/dev dependency resolution pulls apriltag-sys and fails due to missing pthread.h. AprilTag fixture tests use fragile relative paths and fail when run from a different cwd or when fixture directories are not present. This causes local test failures unrelated to the actual Rust implementation.

🔄 Steps to Reproduce

1. Use Windows (MSVC toolchain).
2. Clone repo and run from workspace root: cargo test -p kornia-apriltag
3. Observe:   
apriltag-sys compile error: fatal error C1083: Cannot open include file: 'pthread.h'
or fixture runtime error: The system cannot find the path specified.

💻 Minimal Code Example

// Repro is command-based rather than API-based:
/// cargo test -p kornia-apriltag

✅ Expected behavior

kornia-apriltag tests should run consistently across supported platforms. Platform-specific reference dependencies should not break Windows test builds. Fixture-based tests should resolve paths robustly and/or skip clearly when fixtures are unavailable.

❌ Actual behavior

error: failed to run custom build command for apriltag-sys v0.3.0 ... fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory Error: Os { code: 3, kind: NotFound, message: "The system cannot find the path specified." }

🔧 Environment

kornia-rs version: 0.1.11 (workspace)
Rust version (rustc -V): rustc 1.93.0 (254b59607 2026-01-19)
Cargo version (cargo -V): cargo 1.93.0 (083ac5135 2025-12-15)
OS: Windows 11 (x86_64)
Target architecture: x86_64-pc-windows-msvc
Python version (if using Python bindings): N/A

📝 Additional context

Relevant files:

  • crates/kornia-apriltag/Cargo.toml
  • crates/kornia-apriltag/src/lib.rs

Potential fix direction:

  • Gate aprilgrid / apriltag dev-dependencies for non-Windows targets.
  • Resolve fixture paths using CARGO_MANIFEST_DIR and skip with a clear message when fixtures are unavailable.

🤝 Contribution Intent

  • I plan to submit a PR to fix this bug
  • I'm reporting this bug but not planning to fix it

Contributor guide