bschwind / opencascade-rs

Rust bindings to the OpenCascade CAD Kernel
GNU Lesser General Public License v2.1
118 stars 22 forks source link

getting opencascade-rs running with OCCT built-in on windows #179

Open Markussp256 opened 4 months ago

Markussp256 commented 4 months ago

Hello,

I am trying to compile with OCCT builtin on Windows 10. I use the following versions: Rust: 1.80.0 opencascade = "0.2.0" CMake: 3.25.1

Build script for occt-sys takes very long (>1min) and finally panics (see below).

On my machine there exists a file TKernel.pdb but it is in a folder called libd instead of bind.

is it recommended to download OCCT separately and use external OCCT anyway?

regards, Markus

-- Installing: C:/Git/aag-ac6-interpreter/src/Interpreter/IP/rust/interpreter/target/debug/build/occt-sys-90d2379d9b0fb7d7/out/cmake/OpenCASCADEDataExchangeTargets-debug.cmake CMake Error at src/TKernel/cmake_install.cmake:47 (file): file INSTALL cannot find "C:/Git/aag-ac6-interpreter/src/Interpreter/IP/rust/interpreter/target/debug/build/occt-sys-90d2379d9b0fb7d7/out/build/win64/vc14/bind/TKernel.pdb": No error. Call Stack (most recent call first): cmake_install.cmake:6035 (include)

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command "setlocal [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmEnd [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmErrorLevel [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: exit /b %1 [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 1. [C:\Git\aag-ac6-interpreter\src\Interpreter\IP\rust\interpreter\target\debug\build\occt-sys-90d2379d9b0fb7d7\out\build\install.vcxproj]

--- stderr CMake Warning: Manually-specified variables were not used by the project:

  USE_XLIB

thread 'main' panicked at C:\Users\sprechem.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.50\src\lib.rs:1098:5:

command did not execute successfully, got: exit code: 1

build script failed, must exit now note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

bschwind commented 3 months ago

Hi, sorry for the late reply.

is it recommended to download OCCT separately and use external OCCT anyway?

Yes, I would recommend that. I also don't currently own a windows machine so I can't provide a lot of support for builds on windows. This will change eventually.

Until then, I would recommend installing OCCT into your system, ideally version 7.7.1 as that is the version currently bundled if you try to build it from source in this repo.

When specifying the dependency on opencascade, specify default-features = false:

# cargo.toml
opencascade = { version = 0.2, default-features = false }

It should then try to find OCCT on your system and link it instead of building it.