Alex Vorobyev (#aleksvor), 2020-06-04 07:39:40 UTC
Currently these packages contain only static libs which get "compiled-in" in all their reverse dependencies. According to CMakeLists, these packages can be build as shared libs if `BUILD_SHARED_LIBS` flag is set while invoking CMake (see [glslang script](https://github.com/KhronosGroup/glslang/blob/8db9eccc0baf30c9d22c496ab28db0fe1e4e97c5/CMakeLists.txt#L18), for spirv-tools the flag is the same).
I've found revdeps of glslang which currently contain copies of glslang code instead of linking to shared lib:
1. `vulkan-tools`
2. `libplacebo`
Also glslang is a dependency of MangoHud (D8365) which could make use of shared library too. Probably there are other revdeps of glslang that I didn't found.
I've tried building shared `spirv-tools` and `glslang` locally and rebuilding libplacebo against them - it correctly links to shared libglslang and works as expected (Vulkan renderer in mpv works). I wonder about opinion of Core and / or Globals on this matter - is there a reason why we build these libraries as static and should we switch them to shared?
Martin Reboredo (#YakoYakoYokuYoku), 2021-01-16 15:55:20 UTC
Reasons for only building statically are mainly stability and linking issues ([example](https://github.com/KhronosGroup/glslang/issues/1484)), but mostly of them have been addressed nowadays.
Currently these packages contain only static libs which get "compiled-in" in all their reverse dependencies. According to CMakeLists, these packages can be build as shared libs if `BUILD_SHARED_LIBS` flag is set while invoking CMake (see [glslang script](https://github.com/KhronosGroup/glslang/blob/8db9eccc0baf30c9d22c496ab28db0fe1e4e97c5/CMakeLists.txt#L18), for spirv-tools the flag is the same). I've found revdeps of glslang which currently contain copies of glslang code instead of linking to shared lib: 1. `vulkan-tools` 2. `libplacebo` Also glslang is a dependency of MangoHud (D8365) which could make use of shared library too. Probably there are other revdeps of glslang that I didn't found. I've tried building shared `spirv-tools` and `glslang` locally and rebuilding libplacebo against them - it correctly links to shared libglslang and works as expected (Vulkan renderer in mpv works). I wonder about opinion of Core and / or Globals on this matter - is there a reason why we build these libraries as static and should we switch them to shared?