Build problems with Optix 7.0 - "optix.h" No such file or directory

Hi there,

I am trying to build this project (GitHub - UniStuttgart-VISUS/rtxpkd_ldav2020) using Visual Studio 2019. As the application depends on OWL, I am using OWL from this repo (GitHub - UniStuttgart-VISUS/owl) as specified in the readme.
To fix some errors I had before I had to downgrade to Optix 7.0. I am using Cuda 11.5.

When I build the project I run into the following error:

6>D:/Uni/Bachelorarbeit/Program/rtxpkd_ldav2020/../owl/owl/include\owl/llowl.h(42): fatal error C1083: Datei (Include) kann nicht ge├Àffnet werden: "optix.h": No such file or directory
6>CMake Error at cuda_compile_ptx_1_generated_raygen.cu.ptx.Debug.cmake:212 (message):
6>  Error generating
6>  D:/Uni/Bachelorarbeit/Program/rtxpkd_ldav2020/build/rtxParticles/cuda_compile_ptx_1_generated_raygen.cu.ptx
6>
6>

I tried manually adding the path of the optix.h directory to the INCLUDE environment variable but that just threw a lot of “already defined” errors. Is there something obvious I am missing?

Thanks for your help.

To fix some errors I had before I had to downgrade to Optix 7.0. I am using Cuda 11.5.

Please always read the OptiX Release Notes (link below the each version’s OptiX download button) before setting up a development environment. That contains the recommended software and driver versions required to work together.
For example using OptiX 7.0.0 with CUDA 11.5 might not always generate code that older OptiX version can parse since it’s built with an older CUDA version.

About not being able to find the optix.h header in the OptiX SDK include folder:
From glossing over the *.cmake scripts in that repository, that is hardcoded to use only the OptiX SDK 7.0.0 here:
https://github.com/UniStuttgart-VISUS/owl/blob/master/owl/common/cmake/FindOptiX.cmake#L32

I would first look into the generated solution’s compiler properties to see which additional include directories if specified. If that does not contain the required OptiX SDK 7.0.0/include folder, I would add a message to the *.cmake scripts which are trying to find the OptiX include folder to see if that was initialized successfully.
That seems to happen already in line 99 of that script above. So check your CMake output for any errors.
You could still add some message instructions there to see if the OptiX setup is doing what you need.

If you’d like to use that repository with newer OptiX releases, those scripts would need to be changed to a smarter way finding the different OptiX releases.
That will also require some additional code changes to compile because the OptiX API changed a few things in each minor release version.
Looking at the original OWL repository https://github.com/owl-project/owl your local fork is 671 commits behind, so it makes sense to update to the newest version before trying to update the OptiX version.

Thank you for your quick reply!

First of all, I adjusted my CUDA version to 10.1 in order to be in line with the recommendations regarding Optix 7.0.0.

CMake does not output any errors other than some deprecation warnings about compatibility with future CMake versions. Optix SDK 7.0.0/include was in fact not specified as an additional include directory. I added the path manually as an additional include directory. However, the error persists, which really confuses me. Is there something else that could cause this issue?

And thanks for the heads-up regarding compatibility with newer Optix-Releases. I will keep that in mind.

Again from glossing over the CMakeLists.txt, I am not seeing that there is anything adding the OptiX SDK include directory inside the rtxParticles CMakeLists.txt if that requires it.
I would have expected that this line also adds the OptiX include directory:
https://github.com/UniStuttgart-VISUS/rtxpkd_ldav2020/blob/master/rtxParticles/CMakeLists.txt#L56

There are multiple lines include_directories(${OWL_INCLUDES}) inside the CMakeLists.txt, for example in
https://github.com/UniStuttgart-VISUS/rtxpkd_ldav2020/blob/master/CMakeLists.txt#L39

Print that with some message() to see if that contains the OptiX include directory as well.
If not, then the problem is that the OptiX includes directory is missing in the include_directories() call above.

Did this project ever work?

I’m not using OWL and I can’t say what else is going on there without syncing and trying to build that project and I’m not going to spend time on that, since setting up an application project isn’t really an OptiX issue. That’s your responsibility.