Skip to content

Undefined symbol error using Vk.Ext.Debug_utils #9

@hja3

Description

@hja3

I think I may have encountered a bug while trying to use the debug utils extension in Olivine. The following code triggers an exception

(* example.ml *)

module A = Ctypes.CArray
module Vkt = Vk.Types
module Vkc = Vk.Core

module Utils = struct
  let ( <?> ) x s =
    match x with
    | Ok (r, x) ->
      Format.printf "%a: %s@." Vkt.Result.raw_pp r s;
      x
    | Error k ->
      Format.eprintf "Error %a: %s @." Vkt.Result.raw_pp k s;
      exit 1
  ;;
end

open Utils

module Instance = struct
  (** Creating a vulkan instance *)

  let extensions = A.of_list Ctypes.string [ "VK_EXT_debug_utils" ]
  let layers = A.of_list Ctypes.string [ "VK_LAYER_KHRONOS_validation" ]
  let create_info =
    Vkt.Instance_create_info.make
      ~flags:Vkt.Instance_create_flags.empty
      ~enabled_extension_names:extensions
      ~enabled_layer_names:layers
      ()
  ;;

  let x = Vkc.create_instance ~create_info () <?> "Instance"
end

(* BUG: undefined symbol: vkCmdBeginDebugUtilsLabelEXT *)
module Debug_utils = Vk.Ext.Debug_utils (Instance)

the output is

Success: Instance
Fatal error: exception Dl.DL_error("/nix/store/9xrls1mp0qpz6mbdfzx98nhqkkm5ygz8-vulkan-loader-1.3.290.0/lib/libvulkan.so.1: undefined symbol: vkCmdBeginDebugUtilsLabelEXT")

Initially, I suspected that the Nix environment might be at fault, but the C++ example from Vulkan Tutorial is able to use the debug utils extension in a similar environment.

Indeed, it appears that there is no such symbol 'vkCmdBeginDebugUtilsLabelEXT' in the library. The nearest I can find is one without the 'vk' prefix:

readelf -Ws --dyn-syms /nix/store/9xrls1mp0qpz6mbdfzx98nhqkkm5ygz8-vulkan-loader-1.3.290.0/lib/libvulkan.so.1 | grep CmdBeginDebugUtilsLabelEXT
    18: 00000000000135d0    32 FUNC    LOCAL  DEFAULT   12 terminator_CmdBeginDebugUtilsLabelEXT.part.0
   903: 00000000000137a0    45 FUNC    LOCAL  DEFAULT   12 terminator_CmdBeginDebugUtilsLabelEXT
   952: 0000000000013740    91 FUNC    LOCAL  DEFAULT   12 CmdBeginDebugUtilsLabelEXT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions