opencascade-rs icon indicating copy to clipboard operation
opencascade-rs copied to clipboard

Fix Windows build: CMake profile matching and missing system libraries

Open TonyMarkham opened this issue 2 months ago • 0 comments

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

  • [x] Successfully builds on Windows 11 with cargo build --release
  • [x] Successfully builds on Windows 11 with cargo build (debug)
  • [x] 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.

TonyMarkham avatar Oct 29 '25 17:10 TonyMarkham