felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
229 stars 17 forks source link

Unable to `make libprimus_vk.so libnv_vulkan_wrapper.so` #75

Closed lestephane closed 3 years ago

lestephane commented 4 years ago

Given these library versions:

$ dpkg -l libvulkan*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                  Version                 Architecture            Description
+++-=====================================-=======================-=======================-===============================================================================
ii  libvulkan-dev:amd64                   1.1.73+dfsg-1~gpu16.04. amd64                   Vulkan loader library -- development files
ii  libvulkan1:amd64                      1.1.73+dfsg-1~gpu16.04. amd64                   Vulkan loader library
ii  libvulkan1:i386                       1.1.73+dfsg-1~gpu16.04. i386                    Vulkan loader library

I get this when I try to compile:

$ make libprimus_vk.so libnv_vulkan_wrapper.so
g++  --std=gnu++11 -g3 -I/usr/include/vulkan -shared -fPIC primus_vk.cpp -o libprimus_vk.so -Wl,-soname,libprimus_vk.so.1 -ldl -lpthread 
primus_vk.cpp:69:3: error: ‘PFN_vkLayerCreateDevice’ does not name a type
   PFN_vkLayerCreateDevice layerCreateDevice;
   ^
primus_vk.cpp:70:3: error: ‘PFN_vkLayerDestroyDevice’ does not name a type
   PFN_vkLayerDestroyDevice layerDestroyDevice;
   ^
primus_vk.cpp:83:9: error: ‘PFN_vkLayerCreateDevice’ has not been declared
         PFN_vkLayerCreateDevice layerCreateDevice,
         ^
primus_vk.cpp:84:9: error: ‘PFN_vkLayerDestroyDevice’ has not been declared
         PFN_vkLayerDestroyDevice layerDestroyDevice) : instance(instance), layerCreateDevice(layerCreateDevice), layerDestroyDevice(layerDestroyDevice) {
         ^
primus_vk.cpp: In constructor ‘InstanceInfo::InstanceInfo(VkInstance, int, int)’:
primus_vk.cpp:84:76: error: class ‘InstanceInfo’ does not have any field named ‘layerCreateDevice’
         PFN_vkLayerDestroyDevice layerDestroyDevice) : instance(instance), layerCreateDevice(layerCreateDevice), layerDestroyDevice(layerDestroyDevice) {
                                                                            ^
primus_vk.cpp:84:114: error: class ‘InstanceInfo’ does not have any field named ‘layerDestroyDevice’
         PFN_vkLayerDestroyDevice layerDestroyDevice) : instance(instance), layerCreateDevice(layerCreateDevice), layerDestroyDevice(layerDestroyDevice) {
                                                                                                                  ^
primus_vk.cpp: In function ‘VkResult PrimusVK_CreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, VkInstance_T**)’:
primus_vk.cpp:244:3: error: ‘PFN_vkLayerCreateDevice’ was not declared in this scope
   PFN_vkLayerCreateDevice layerCreateDevice = nullptr;
   ^
primus_vk.cpp:245:3: error: ‘PFN_vkLayerDestroyDevice’ was not declared in this scope
   PFN_vkLayerDestroyDevice layerDestroyDevice = nullptr;
   ^
primus_vk.cpp:252:115: error: ‘VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK’ was not declared in this scope
     if ( layerCreateInfo->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO &&  layerCreateInfo->function == VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK) {
                                                                                                                   ^
primus_vk.cpp:253:7: error: ‘layerCreateDevice’ was not declared in this scope
       layerCreateDevice = layerCreateInfo->u.layerDevice.pfnLayerCreateDevice;
       ^
primus_vk.cpp:253:46: error: ‘union VkLayerInstanceCreateInfo::<anonymous>’ has no member named ‘layerDevice’
       layerCreateDevice = layerCreateInfo->u.layerDevice.pfnLayerCreateDevice;
                                              ^
primus_vk.cpp:254:7: error: ‘layerDestroyDevice’ was not declared in this scope
       layerDestroyDevice = layerCreateInfo->u.layerDevice.pfnLayerDestroyDevice;
       ^
primus_vk.cpp:254:47: error: ‘union VkLayerInstanceCreateInfo::<anonymous>’ has no member named ‘layerDevice’
       layerDestroyDevice = layerCreateInfo->u.layerDevice.pfnLayerDestroyDevice;
                                               ^
primus_vk.cpp:262:6: error: ‘layerCreateDevice’ was not declared in this scope
   if(layerCreateDevice == nullptr || layerDestroyDevice == nullptr) {
      ^
primus_vk.cpp:262:38: error: ‘layerDestroyDevice’ was not declared in this scope
   if(layerCreateDevice == nullptr || layerDestroyDevice == nullptr) {
                                      ^
primus_vk.cpp:284:52: error: ‘layerCreateDevice’ was not declared in this scope
   auto my_instance_info = InstanceInfo{*pInstance, layerCreateDevice, layerDestroyDevice};
                                                    ^
primus_vk.cpp:284:71: error: ‘layerDestroyDevice’ was not declared in this scope
   auto my_instance_info = InstanceInfo{*pInstance, layerCreateDevice, layerDestroyDevice};
                                                                       ^
primus_vk.cpp:284:89: error: no matching function for call to ‘InstanceInfo::InstanceInfo(<brace-enclosed initializer list>)’
   auto my_instance_info = InstanceInfo{*pInstance, layerCreateDevice, layerDestroyDevice};
                                                                                         ^
primus_vk.cpp:82:3: note: candidate: InstanceInfo::InstanceInfo(VkInstance, int, int)
   InstanceInfo(VkInstance instance,
   ^
primus_vk.cpp:82:3: note:   conversion of argument 2 would be ill-formed:
primus_vk.cpp:81:3: note: candidate: InstanceInfo::InstanceInfo(InstanceInfo&&)
   InstanceInfo(InstanceInfo &&) = default;
   ^
primus_vk.cpp:81:3: note:   candidate expects 1 argument, 3 provided
primus_vk.cpp:79:3: note: candidate: InstanceInfo::InstanceInfo()
   InstanceInfo() = default;
   ^
primus_vk.cpp:79:3: note:   candidate expects 0 arguments, 3 provided
primus_vk.cpp: In function ‘VkResult PrimusVK_CreateDevice(VkPhysicalDevice, const VkDeviceCreateInfo*, const VkAllocationCallbacks*, VkDevice_T**)’:
primus_vk.cpp:748:40: error: ‘struct InstanceInfo’ has no member named ‘layerCreateDevice’
   auto createDevice = my_instance_info.layerCreateDevice;
                                        ^
primus_vk.cpp: In lambda function:
primus_vk.cpp:751:16: error: ‘createDevice’ is not captured
     auto ret = createDevice(my_instance_info.instance, my_instance_info.display, &createInfo, nullptr, &dev, PrimusVK_GetInstanceProcAddr, &gdpa);
                ^
primus_vk.cpp:749:46: note: the lambda has no capture-default
   cod->finish([createDevice,&my_instance_info](VkDeviceCreateInfo &createInfo, VkDevice &dev){
                                              ^
primus_vk.cpp:748:8: note: ‘<typeprefixerror>createDevice’ declared here
   auto createDevice = my_instance_info.layerCreateDevice;
        ^
primus_vk.cpp:757:12: error: unable to deduce lambda return type from ‘ret’
     return ret;
            ^
primus_vk.cpp: In function ‘VkResult PrimusVK_CreateDevice(VkPhysicalDevice, const VkDeviceCreateInfo*, const VkAllocationCallbacks*, VkDevice_T**)’:
primus_vk.cpp:758:4: error: no matching function for call to ‘CreateOtherDevice::finish(PrimusVK_CreateDevice(VkPhysicalDevice, const VkDeviceCreateInfo*, const VkAllocationCallbacks*, VkDevice_T**)::<lambda(VkDeviceCreateInfo&, VkDevice_T*&)>)’
   });
    ^
primus_vk.cpp:557:8: note: candidate: void CreateOtherDevice::finish(std::function<VkResult(VkDeviceCreateInfo&, VkDevice_T*&)>)
   void finish(std::function<VkResult(VkDeviceCreateInfo &createInfo, VkDevice &dev)> creator){
        ^
primus_vk.cpp:557:8: note:   no known conversion for argument 1 from ‘PrimusVK_CreateDevice(VkPhysicalDevice, const VkDeviceCreateInfo*, const VkAllocationCallbacks*, VkDevice_T**)::<lambda(VkDeviceCreateInfo&, VkDevice_T*&)>’ to ‘std::function<VkResult(VkDeviceCreateInfo&, VkDevice_T*&)>’
primus_vk.cpp: In function ‘void PrimusVK_DestroyDevice(VkDevice, const VkAllocationCallbacks*)’:
primus_vk.cpp:842:15: error: ‘struct InstanceInfo’ has no member named ‘layerDestroyDevice’
   my_instance.layerDestroyDevice(display_device, nullptr, device_dispatch[GetKey(display_device)].DestroyDevice);
               ^
Makefile:19: recipe for target 'libprimus_vk.so' failed
make: *** [libprimus_vk.so] Error 1

I'm following the manual install HOWTO to the letter so far, what am I missing?

felixdoerre commented 4 years ago

From the Readme:

Due to a bug/missing feature in the Vulkan Loader you will need Vulkan/libvulkan >= 1.1.108. If you have an older system you can try primus_vk version 1.1 which contains an ugly workaround for that issue and is therefore compatible with older Vulkan versions.

You have version 1.1.73 which is too old.

felixdoerre commented 4 years ago

Just for your information: We are working on backporting primus-vk to debian buster. I can try to remember this issue, when we are finished and update it when primus-vk is available in buster backports. Do you have debian buster as OS? Or is it an ubuntu (where it will probably take longer until primus-vk is available from the OS)?

lestephane commented 4 years ago

I'm using Ubuntu 16.04. But it's not a show stopper over here. I just wanted to play a specific game on Steam that seems to require it.

On Mon, Sep 28, 2020 at 1:55 PM felixdoerre notifications@github.com wrote:

Just for your information: We are working on backporting primus-vk to debian buster. I can try to remember this issue, when we are finished and update it when primus-vk is available in buster backports. Do you have debian buster as OS? Or is it an ubuntu (where it will probably take longer until primus-vk is available from the OS)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/felixdoerre/primus_vk/issues/75#issuecomment-699934057, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJVHFCBSAHI2L2AG35YF5DSIBTSNANCNFSM4R3CTBJQ .

--

felixdoerre commented 3 years ago

I am closing this issue as we have identified the cause of the compile errors.