Skip to content

Conversation

@TonyMarkham
Copy link

Problem

Building on Windows with MSVC fails with two issues:

  1. PDB file errors: CMake is hardcoded to Release profile, causing "cannot find TKernel.pdb" errors when building with cargo build (debug mode)
  2. Linker errors: Missing Windows system libraries causing 23 unresolved external symbols (e.g., SetFileSecurityW, OpenProcessToken, RegOpenKeyW)

Solution

  1. crates/occt-sys/src/lib.rs: Read PROFILE environment variable from Cargo and pass the correct profile to CMake (Debug vs Release)
  2. crates/opencascade-sys/build.rs: Add missing Windows system libraries:
    • advapi32.lib - Security and registry APIs
    • gdi32.lib - Graphics Device Interface
    • shell32.lib - Windows Shell API
    • comdlg32.lib - Common Dialog Box

Testing

  • Successfully builds on Windows 11 with cargo build --release
  • Successfully builds on Windows 11 with cargo build (debug)
  • Both MSVC Release and Debug profiles now work correctly

Notes

This appears to be Windows-specific as Linux builds work fine (debug symbols are embedded in binaries, and these Windows libraries aren't needed).

Fixes the build issues reported by Windows users.

- Fix CMake profile to match Cargo's PROFILE env var (debug/release)
- Add missing Windows system libraries (advapi32, gdi32, shell32, comdlg32)
- Resolves build errors on Windows with MSVC toolchain
TonyMarkham added a commit to TonyMarkham/opencascade-interop-demo that referenced this pull request Oct 29, 2025
- Switch from crates.io to Git fork of opencascade-rs (PR #216)
- Add comprehensive README with architecture and usage documentation
- Update .gitignore to exclude build artifacts (dist/, .cargo/)
- Update Cargo.lock to reflect new Git dependency

Fixes Windows build issues (CMake profile matching and missing system
libraries). PR submitted upstream:
bschwind/opencascade-rs#216
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.

1 participant