mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.1k stars 248 forks source link

python extension run incorrectly when using compiled mitsuba on win #1298

Closed momo773510 closed 2 months ago

momo773510 commented 2 months ago

Summary

VS solution of python extension couldn't be generated correctly and caused compile error

System configuration

System information:

OS: Win11 23H2 Python version: 3.11.4 Mitsuba version: 3.5.2 Compiled with: VS2022 Variants compiled: "scalar_rgb", "llvm_mono", "llvm_spectral_polarized", "cuda_ad_spectral", "cuda_ad_mono"

Description

Following the tutorial given by the documentation, after running the cmake generation command, the mitsuba.conf file will be generated and it should be configured to compile variants wanted. However when open the mitsuba.sln with mitsuba.conf configured, the variants showed in solution explorer/python isn't complete and lack some corresponding items. 图片 图片 You can see the absence of llvm_mono_ext and other extensions of variants. Direct compile will lead to hundreds of errors and most of them are "unresolved external symbol", while they all occur in mitsuba_some_variant_ext and mitsuba_stub_file_generation:

In the end of compilation VS will tell that the external file changes(mitsuba.conf?) of solution are checked, and remind to reload the solution. After reloading, the solution items of missing variants will appear and now it needs a recompile(but it wastes a lot of time), then the python interface is available. 图片 If not, using the mitsuba.exe to render isn't influenced by the error but the python interface isn't available: mi.variants() will print the correct output while mi.set_variants telling that "some_variant not found" because the python extension of that variants hasn't been generated.

I wonder that either it's a VS problem or I miss some key points in the tutorial. Now I choose to manually interrupt the generation at the beginning of compile and then VS will give a tip of reload solution. Is there some solution that after configure the mitsuba.conf VS can inspect the change immediately and generate correct solutions of wanted variants? Thanks.

njroussel commented 2 months ago

Hi @momo773510

Does it build correctly if you use the terminal (i.e cmake --build build --config Release) instead of opening the .sln file ?

momo773510 commented 2 months ago

Everything including python extension runs well in this way, a lot thanks! Maybe that's a VS solution detecting problem.