Got it, thank you Ross! -----Original Message----- From: Ross Burton <ross.bur...@arm.com> Sent: Tuesday, October 18, 2022 4:52 AM To: Tom Hochstein <tom.hochst...@nxp.com> Cc: Martin Jansa <martin.ja...@gmail.com>; openembedded-core@lists.openembedded.org Subject: Re: [OE-core] [PATCH] vulkan-loader: Move libvulkan.so to main package
On 17 Oct 2022, at 17:12, Tom Hochstein <tom.hochst...@nxp.com> wrote: > > I found a few examples online for both ways. In SaschaWillems examples, .so > is used: > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSaschaWillems%2FVulkan%2Fblob%2Fmaster%2Fbase%2FVulkanAndroid.cpp%23L142&data=05%7C01%7Ctom.hochstein%40nxp.com%7C9c135c0d4b16464e586208dab0ee669d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638016835220670988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D5UDy3Fd%2F%2Fq8Hby31cqj4vxn2g8anMNBTZJJMbBdVHo%3D&reserved=0 > > In Vulkan-Tools there's a mix. Here the implementation falls back to .so.1 if > .so is not found: > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Tools%2Fblob%2Fmaster%2Fvulkaninfo%2Fvulkaninfo.h%23L256-L257&data=05%7C01%7Ctom.hochstein%40nxp.com%7C9c135c0d4b16464e586208dab0ee669d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638016835220670988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fNOFnmZUbDGZAXGgU5Cq5N4cKmRBgLA7Od7FXcGXpLY%3D&reserved=0 > > While here only .so is used: > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Tools%2Fblob%2Fmaster%2Fcommon%2Fvulkan_wrapper.cpp%23L25&data=05%7C01%7Ctom.hochstein%40nxp.com%7C9c135c0d4b16464e586208dab0ee669d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638016835220827298%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mlM7Mr%2FEt9LTalhmHo5Js1UliBABxqpkXHC4V8KfUUk%3D&reserved=0 > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Tools%2Fblob%2Fmaster%2Fscripts%2Fgenerate_vulkan_wrapper.py%23L2043&data=05%7C01%7Ctom.hochstein%40nxp.com%7C9c135c0d4b16464e586208dab0ee669d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638016835220827298%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PqV8hitdAseUDE4BnKeqvwOT0B9iQ03h77LCzJbxLj8%3D&reserved=0 > > With no consistency or guidance I'm not sure what the right solution is. At > first I thought perhaps it is better for the caller to be more specific so > that a compatibility problem is detected with a dlopen failure. Complicating > that, though, is that vulkan-loader 1.2 is not compatible with 1.3. Plus why > does Vulkan-Tools use .so.1 second? Probably to get around the fact that the > .so is in the dev package? I did some research. libvulkan.so* is the Vulkan Loader, which is responsible for finding the correct driver and bridging the application with the driver. As per the documentation at https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvulkan.lunarg.com%2Fdoc%2Fsdk%2F1.3.224.1%2Flinux%2FLoaderApplicationInterface.html&data=05%7C01%7Ctom.hochstein%40nxp.com%7C9c135c0d4b16464e586208dab0ee669d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638016835220827298%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mZURlOcefEkwdI0VUUUi8i3M8zdvZGXVNsg6I75VfyU%3D&reserved=0, you can either directly dynamically link (-lvulkan to the compiler) to the loader , or indirectly link (dlopen()) to the loader. Quoting from the ABI Versioning section: """ On Linux, applications that have a hard dependency on Vulkan should request linking to the unversioned name libvulkan.so in their build system. For example by importing the CMake target Vulkan::Vulkan or by using the output of pkg-config --cflags --libs vulkan as compiler flags. As usual for Linux libraries, the compiler and linker will resolve this to a dependency on the correct versioned SONAME, currently libvulkan.so.1. Linux applications that load Vulkan-Loader dynamically at runtime do not benefit from this mechanism, and should instead make sure to pass the versioned name such as libvulkan.so.1 to dlopen(), to ensure that they load a compatible version. """ Applications which dlopen("libvulkan.so") without a version are broken and should be fixed. The vulkan tools doing exactly what the documentation says not to do is just embarrassing to be honest... So my position is that we don't mess around with the vulkan-loader recipe, but instead fix the callers. Ross
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#171939): https://lists.openembedded.org/g/openembedded-core/message/171939 Mute This Topic: https://lists.openembedded.org/mt/94372555/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-