naddy@ reported a bulk build with emulators/flycast build failure. --8<---------------cut here---------------start------------->8--- /usr/obj/ports/flycast-2.1pl20230303/flycast/core/deps/glslang/SPIRV/CInterface/spirv_c_interface.cpp:39:1: error: static_assert failed due to requirement 'sizeof(glslang_spv_options_s) == sizeof(glslang::SpvOptions)' "" static_assert(sizeof(glslang_spv_options_t) == sizeof(glslang::SpvOptions), ""); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. --8<---------------cut here---------------end--------------->8---
To resolve this, I propose enabling shared library building in graphics/glslang and unbundling glslang in flycast. To reproduce the build error, I had to uninstall my modified glslang and install packaged glslang. The issue is different struct sizes in the /usr/local/include glslang header file and bundled flycast glslang file. This diff does the following: - no revision bump because build failure so a package never built. - unbundles glslang and uses graphics/glslang for libglslang.so.0.0 and libSPIRV.so instead. - mirrors a different dist file with glslang deleted Test against the libglslang diff to build shared libraries sent prior to this email. Feedback and tests are welcome. ok? Index: Makefile =================================================================== RCS file: /cvs/ports/emulators/flycast/Makefile,v retrieving revision 1.2 diff -u -p -u -p -r1.2 Makefile --- Makefile 26 Apr 2023 09:19:17 -0000 1.2 +++ Makefile 30 Apr 2023 03:23:05 -0000 @@ -19,7 +19,7 @@ MAINTAINER = Nam Nguyen <namn@berkeley.e # Custom NVIDIA and Khronos Group (glslang preprocessor) PERMIT_PACKAGE = Yes -WANTLIB += ${COMPILER_LIBCXX} GL SDL2 ao c curl chdr +WANTLIB += ${COMPILER_LIBCXX} GL SDL2 ao c curl chdr glslang WANTLIB += lua${MODLUA_VERSION} m miniupnpc pulse xxhash z zip NO_TEST = Yes @@ -44,6 +44,7 @@ RUN_DEPENDS = graphics/vulkan-loader BUILD_DEPENDS = lang/luabridge LIB_DEPENDS = audio/libao \ devel/sdl2 \ + graphics/glslang \ emulators/libchdr \ sysutils/xxhash \ net/curl \ @@ -59,7 +60,7 @@ D = /tmp/flycast dist: cd /tmp && git clone https://github.com/flyinghead/flycast.git; \ cd ${D} && git checkout ${COMMIT}; \ - git rm -r --cached core/deps/{SDL,libchdr,luabridge,breakpad}; \ + git rm -r --cached core/deps/{SDL,breakpad,glslang,libchdr,luabridge}; \ git submodule init; \ git submodule update; \ rm -rfv core/deps/{dirent,libretro-common,libzip,miniupnpc,oboe,xxHash}; \ Index: distinfo =================================================================== RCS file: /cvs/ports/emulators/flycast/distinfo,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 distinfo --- distinfo 25 Apr 2023 19:31:43 -0000 1.1.1.1 +++ distinfo 30 Apr 2023 03:23:05 -0000 @@ -1,2 +1,2 @@ -SHA256 (flycast-2.1pl20230303.tar.gz) = KojesNJ/ODejrhVK8Kh9aKCQDRZuKY7+FYhYMDMbypQ= -SIZE (flycast-2.1pl20230303.tar.gz) = 18430249 +SHA256 (flycast-2.1pl20230303.tar.gz) = F4AjWMwKO1hFJEeUzZOMf7i3drm74+4UtPwIMRX3N3o= +SIZE (flycast-2.1pl20230303.tar.gz) = 14886805 Index: patches/patch-CMakeLists_txt =================================================================== RCS file: /cvs/ports/emulators/flycast/patches/patch-CMakeLists_txt,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-CMakeLists_txt --- patches/patch-CMakeLists_txt 25 Apr 2023 19:31:43 -0000 1.1.1.1 +++ patches/patch-CMakeLists_txt 30 Apr 2023 03:23:05 -0000 @@ -1,5 +1,5 @@ add include and link directories -unbundle xxhash and libchdr +unbundle xxhash, glslang and libchdr link against -lSDL2 instead of libSDL2.a by using PkgConfig Index: CMakeLists.txt @@ -31,7 +31,39 @@ Index: CMakeLists.txt option(BUILD_SHARED_LIBS "Build shared library" OFF) add_subdirectory(core/deps/glm) -@@ -356,29 +364,10 @@ if(NOT LIBRETRO) +@@ -339,8 +347,29 @@ if(USE_VULKAN) + option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" OFF) + option(ENABLE_HLSL "Enables HLSL input support" OFF) + option(ENABLE_PCH "Enables Precompiled header" OFF) +- add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL) +- target_link_libraries(${PROJECT_NAME} PRIVATE SPIRV) ++ find_library(GLSLANG_LIBRARIES glslang) ++ if (GLSLANG_LIBRARIES) ++ set(GLSLANG_FOUND 1) ++ find_path(GLSLANG_INCLUDE_DIR GlslangToSpv.h PATH_SUFFIXES glslang/SPIRV) ++ set(GLSLANG_INCLUDE_DIR "${GLSLANG_INCLUDE_DIR}/..") ++ endif(GLSLANG_LIBRARIES) ++ find_library(SPIRV_LIBRARIES SPIRV) ++ if (SPIRV_LIBRARIES) ++ set(SPIRV_FOUND 1) ++ endif (SPIRV_LIBRARIES) ++ if (GLSLANG_FOUND) ++ message(STATUS "Found glslang: ${GLSLANG_LIBRARIES}") ++ message(STATUS "glslang include: ${GLSLANG_INCLUDE_DIR}") ++ else() ++ message(STATUS "glslang library not found.") ++ endif() ++ if (SPIRV_FOUND) ++ message(STATUS "Found SPIRV: ${SPIRV_LIBRARIES}") ++ else() ++ message(STATUS "spirv library not found.") ++ endif() ++ target_include_directories(${PROJECT_NAME} PRIVATE ${GLSLANG_INCLUDE_DIR}) ++ target_link_libraries(${PROJECT_NAME} PRIVATE ${GLSLANG_LIBRARIES} ${SPIRV_LIBRARIES}) + endif() + + if(NOT LIBRETRO) +@@ -356,29 +385,10 @@ if(NOT LIBRETRO) endif() if(NOT ANDROID AND NOT IOS) @@ -65,7 +97,7 @@ Index: CMakeLists.txt target_compile_definitions(${PROJECT_NAME} PRIVATE USE_SDL USE_SDL_AUDIO) target_sources(${PROJECT_NAME} PRIVATE core/sdl/sdl.cpp core/sdl/sdl.h core/sdl/sdl_gamepad.h core/sdl/sdl_keyboard.h) -@@ -403,10 +392,6 @@ if(NOT LIBRETRO) +@@ -403,10 +413,6 @@ if(NOT LIBRETRO) endif() endif() @@ -76,7 +108,7 @@ Index: CMakeLists.txt if(NOT WITH_SYSTEM_ZLIB) target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/core/deps/libchdr/deps/zlib-1.2.11") target_link_libraries(${PROJECT_NAME} PRIVATE zlib) -@@ -521,7 +506,7 @@ if(UNIX AND NOT APPLE AND NOT ANDROID) +@@ -521,7 +527,7 @@ if(UNIX AND NOT APPLE AND NOT ANDROID) target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBRT}) endif() Index: patches/patch-core_rend_vulkan_compiler_cpp =================================================================== RCS file: patches/patch-core_rend_vulkan_compiler_cpp diff -N patches/patch-core_rend_vulkan_compiler_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-core_rend_vulkan_compiler_cpp 30 Apr 2023 03:23:05 -0000 @@ -0,0 +1,26 @@ +error: excess elements in scalar initializer + +undo 8d0654c323028d9d31f67c51d65e99b410a91750 as done in gentoo port + +see: +https://github.com/gentoo/guru/commit/a960b203c4ba687f0eb08e774d919982e791535c + +Index: core/rend/vulkan/compiler.cpp +--- core/rend/vulkan/compiler.cpp.orig ++++ core/rend/vulkan/compiler.cpp +@@ -115,6 +115,15 @@ static const TBuiltInResource DefaultTBuiltInResource + /* .maxTaskWorkGroupSizeY_NV = */ 1, + /* .maxTaskWorkGroupSizeZ_NV = */ 1, + /* .maxMeshViewCountNV = */ 4, ++ /* .maxMeshOutputVerticesEXT = */ 256, ++ /* .maxMeshOutputPrimitivesEXT = */ 256, ++ /* .maxMeshWorkGroupSizeX_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeY_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeZ_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeX_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeY_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeZ_EXT = */ 128, ++ /* .maxMeshViewCountEXT = */ 4, + /* .maxDualSourceDrawBuffersEXT = */ 1, + + /* .limits = */ {