DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

hctbuild problems with building with -spirv

Open TheArheus opened this issue 3 years ago • 6 comments

Hello. I am trying to build program with command utils\hct\hctbuild -x64 -vs2022 -rel -official -spirv, but I have issues with it. I am building on Windows 11. There is a building error like this:

CMake Error at external/CMakeLists.txt:20 (add_subdirectory): The source directory

C:/DirectXShaderCompiler/external/SPIRV-Headers

does not contain a CMakeLists.txt file.

CMake Error at external/CMakeLists.txt:26 (message): SPIRV-Headers was not found - required for SPIR-V codegen

I builded spirv-headers and added them to the path environment variable, but, that seems cmake could not find spirv-headers anyway. And, also, everything building correctly without any of spirv arguments. How could I solve problem? Thanks.

TheArheus avatar Aug 28 '22 20:08 TheArheus

SPIR-V headers should go in the SPIR-V tools directory under the “externals” folder. That’s odd though, I don’t believe I had to do this sort of manual configuration with my setup. I’m also on Win 11

natevm avatar Aug 28 '22 22:08 natevm

Well, I've tried different things, like: copying spirv-headers directly to the build directory, build spirv-tools, install spirv-tools and spirv-headers with vcpkg. Not a single thing worked for me and I don't understand, what I should do here. I with there was more comprehensive guide how to correctly do the things here or vulkan sdk was already have dxc.exe builded with -DENABLE_SPIRV_CODEGEN=ON, really close to giving up.

TheArheus avatar Aug 29 '22 16:08 TheArheus

Really thought we used to have proper documentation for this in the readme. Nevertheless, I've always had to add the submodules manually. You can go to the external/ dir and execute

git clone https://github.com/KhronosGroup/SPIRV-Headers
git clone https://github.com/KhronosGroup/SPIRV-Tools
git clone https://github.com/google/effcee
git clone https://github.com/google/re2

and you should be good to go!

@natevm, we should add this information to the Readme. We might also consider making this more automatic. I was looking into another way of adding submodules that would make a lot of this easier. We can discuss it later.

Tagging this bug with SPIRV.

pow2clk avatar Aug 29 '22 20:08 pow2clk

I got it. Now that worked pretty fine. Sorry for being rude, but that was just my stupidity fault, who somehow totally forgot about submodules. Thanks, now everything builded correctly

TheArheus avatar Aug 30 '22 05:08 TheArheus

@TheArheus, Happy to hear it! It's a good note that we need better docs in this area.

pow2clk avatar Aug 30 '22 17:08 pow2clk

Ah, yeah, agreed. This should be documented. By habit I tend to add --recursive to my clone commands, and forgot that I did that here...

natevm avatar Aug 30 '22 19:08 natevm

The SPIR-V CodeGen docs do include the instructions to run git submodule update --init which should clone all submodules. I know this is a very late reply, but if you remember any other instructions you were using where this detail might have been missing feel free to add a link to it below and I'd be happy to update it.

sudonatalie avatar Aug 09 '23 21:08 sudonatalie