Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(build) glslang build error only when USE_HOST_GLSLANG=ON?? #1843

Open
brosasaki opened this issue Feb 10, 2025 · 2 comments
Open

(build) glslang build error only when USE_HOST_GLSLANG=ON?? #1843

brosasaki opened this issue Feb 10, 2025 · 2 comments

Comments

@brosasaki
Copy link
Contributor

This applies to both v2.4 and the latest git...
With USE_VULKAN=ON and USE_HOST_GLSLANG=OFF, building completes without a hitch.
When compiling with USE_HOST_GLSLANG=ON, however, Flycast does not build, with the following error:

In file included from /tmp/guix-build-flycast-2.4.drv-0/source/core/deps/glslang/SPIRV/GlslangToSpv.h:42,
                 from /tmp/guix-build-flycast-2.4.drv-0/source/core/rend/vulkan/shaders.h:23,
                 from /tmp/guix-build-flycast-2.4.drv-0/source/core/rend/vulkan/quad.h:24,
                 from /tmp/guix-build-flycast-2.4.drv-0/source/core/rend/vulkan/vulkan_context.h:89,
                 from /tmp/guix-build-flycast-2.4.drv-0/source/core/wsi/switcher.cpp:29:
/tmp/guix-build-flycast-2.4.drv-0/source/core/deps/glslang/SPIRV/SpvTools.h:50:10: fatal error: glslang/MachineIndependent/localintermediate.h: No such file or directory
   50 | #include "glslang/MachineIndependent/localintermediate.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/flycast.dir/build.make:3383: CMakeFiles/flycast.dir/core/wsi/switcher.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/guix-build-flycast-2.4.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:230: CMakeFiles/flycast.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-flycast-2.4.drv-0/build'
make: *** [Makefile:139: all] Error 2

This is very strange--according to the root CMakeLists.txt, core/deps/glslang shouldn't even be building, if I read correctly (if--Please forgive me if I'm missing something obvious).

if(USE_VULKAN)
	if(USE_HOST_GLSLANG)
		find_package(glslang REQUIRED)
	else()
		option(BUILD_EXTERNAL "Build external dependencies in /External" OFF)
		option(SKIP_GLSLANG_INSTALL "Skip installation" ON)
		option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" OFF)
...

Stranger, USE_VULKAN=ON and USE_HOST_GLSLANG=ON, the log for the configure phase is missing the 'found glslang' message.

@flyinghead
Copy link
Owner

This is likely due to this line in CMakeLists.txt:

target_include_directories(${PROJECT_NAME} PRIVATE core core/deps core/deps/stb core/deps/json core/deps/asio/asio/include)

It adds core/deps to the include path, which contains glslang/SPIRV/GlslangToSpv.h

@brosasaki
Copy link
Contributor Author

brosasaki commented Feb 11, 2025

Is that a mistake?
Edit: aha, my distro's version of glslang is missing include/glslang/MachineIndependent/localintermediate.h.
Edit 2: Or, wait, shouldn't core/rend/vulkan/shaders.h:23 refer to my system's SPIRV/GlslangToSpv.h, not the one in core/deps/glslang?
Edit 3: Yes, my distro's version of glslang's GlslangToSpv.h does not include these lines that are in the vendored version, and neither does the upstream.

#if defined(_MSC_VER) && _MSC_VER >= 1900
    #pragma warning(disable : 4464) // relative include path contains '..'
#endif

#include "SpvTools.h"
#include "glslang/Include/intermediate.h"

But anyways, if anything, the build should be complaining about the files in my system's glslang, not the vendored one. I'm sorry, I'm a bit in over my head here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants