KhronosGroup / Vulkan-Loader

Vulkan Loader
https://vulkan.lunarg.com/doc/sdk/latest/linux/LoaderInterfaceArchitecture.html
Other
513 stars 279 forks source link

How to build static lib for Vulkan-Loader on Linux #1538

Closed Norman-Normandy closed 2 months ago

Norman-Normandy commented 2 months ago

What enhancement are you suggesting for the Vulkan Loader? Please describe in detail. Documentation on how to build Vulkan-Loader as a static library from source. E.G libvulk.a and libvolk.a under Linux.

Is this specific to a single platform? OS platform Linux

Additional context Trying to build a static library for Vulkan-Loader. But there are no build instructions for it. There have been some closed issues which did not resolve or even answer the question, such as #137.

If there's a way to do it under the entire SDK or the stand-alone Vulkan-Loader project then documentation should exist for it.

jjulianoatnv commented 2 months ago

I don't think a static loader is intended to be a supported/allowed thing. The platform must be capable of updating the loader without rebuilding the app. The loader insulates the app from knowing how to discover and load ICDs on a particular platform. How this is done changes over time. Breaking apps when it changes would be bad...and OpenCL learned this "the hard way".

FYI, in a different project I have proposed separating the "loader" from the "runtime". If this separation existed, then the loader would be distributed as part of the platform and it would be updated by the platform maintainer. The rest would be in the new thing called a "runtime", it would come from the Vulkan SDK, and it would be included in the app package.

With that split, the runtime could then be either a static or a dynamic library. But the loader necessarily must remain a dynamic library that can be updated separate from the app.

charles-lunarg commented 2 months ago

Yes, it is a stated policy in the documentation that static linking is not possible on linux and windows for the reasons stated as well as what jjulianoatnv mentions.

As such, I am going to close the issue as 'wont fix'.

I will note that the reason Apple is excused from this policy is due to the lack of a native driver on Apple platforms. Due to that, apps must ship the loader with their application anyhow (as well as a driver), which makes static linking a non-issue on Apple platforms.