Get Vulkan working on TX2?

Hi all,

I have downloaded the Vulkan SDK from LunarG here:

https://github.com/LunarG/VulkanTools/

I have compiled it successfully using the instructions in BUILDvt.md and have a “vulkan” directory which has the vulkan.h and vulkan.hpp files. I have copied this entire vulkan directory tino /usr/local/include so that gcc can find it.

However when I go to the demos directory in my VulkanTools and type gcc cube.h I get this:

nvidia@tegra-ubuntu:~/code/VulkanTools/demos$ gcc cube.c
/tmp/ccbouT30.o: In function vec3_len': cube.c:(.text+0x258): undefined reference to sqrtf’
/tmp/ccbouT30.o: In function mat4x4_rotate': cube.c:(.text+0xa38): undefined reference to sinf’
cube.c:(.text+0xa44): undefined reference to cosf' /tmp/ccbouT30.o: In function mat4x4_perspective’:
cube.c:(.text+0xbe4): undefined reference to tan' /tmp/ccbouT30.o: In function demo_flush_init_cmd’:
cube.c:(.text+0x15ac): undefined reference to vkEndCommandBuffer' cube.c:(.text+0x160c): undefined reference to vkCreateFence’
cube.c:(.text+0x169c): undefined reference to vkQueueSubmit' cube.c:(.text+0x16f0): undefined reference to vkWaitForFences’
cube.c:(.text+0x174c): undefined reference to vkFreeCommandBuffers' cube.c:(.text+0x1760): undefined reference to vkDestroyFence’
/tmp/ccbouT30.o: In function demo_set_image_layout': cube.c:(.text+0x1940): undefined reference to vkCmdPipelineBarrier’
/tmp/ccbouT30.o: In function demo_draw_build_cmd': cube.c:(.text+0x1a78): undefined reference to vkBeginCommandBuffer’
cube.c:(.text+0x1ac0): undefined reference to vkCmdBeginRenderPass' cube.c:(.text+0x1ad8): undefined reference to vkCmdBindPipeline’
cube.c:(.text+0x1b30): undefined reference to vkCmdBindDescriptorSets' cube.c:(.text+0x1b84): undefined reference to vkCmdSetViewport’
cube.c:(.text+0x1bcc): undefined reference to vkCmdSetScissor' cube.c:(.text+0x1be4): undefined reference to vkCmdDraw’
cube.c:(.text+0x1bec): undefined reference to vkCmdEndRenderPass' cube.c:(.text+0x1cc8): undefined reference to vkCmdPipelineBarrier’
cube.c:(.text+0x1cd0): undefined reference to vkEndCommandBuffer' /tmp/ccbouT30.o: In function demo_build_image_ownership_cmd’:
cube.c:(.text+0x1dac): undefined reference to vkBeginCommandBuffer' cube.c:(.text+0x1ec8): undefined reference to vkCmdPipelineBarrier’
cube.c:(.text+0x1ef0): undefined reference to vkEndCommandBuffer' /tmp/ccbouT30.o: In function demo_update_data_buffer’:
cube.c:(.text+0x204c): undefined reference to vkWaitForFences' cube.c:(.text+0x20a0): undefined reference to vkMapMemory’
cube.c:(.text+0x2124): undefined reference to vkUnmapMemory' /tmp/ccbouT30.o: In function demo_draw’:
cube.c:(.text+0x2778): undefined reference to vkWaitForFences' cube.c:(.text+0x27b0): undefined reference to vkResetFences’
cube.c:(.text+0x29cc): undefined reference to vkResetFences' cube.c:(.text+0x2a18): undefined reference to vkQueueSubmit’
cube.c:(.text+0x2b0c): undefined reference to vkQueueSubmit' /tmp/ccbouT30.o: In function demo_prepare_buffers’:
cube.c:(.text+0x3388): undefined reference to vkWaitForFences' cube.c:(.text+0x364c): undefined reference to vkCreateImageView’
cube.c:(.text+0x36c4): undefined reference to vkCreateFence' /tmp/ccbouT30.o: In function demo_prepare_depth’:
cube.c:(.text+0x391c): undefined reference to vkCreateImage' cube.c:(.text+0x3974): undefined reference to vkGetImageMemoryRequirements’
cube.c:(.text+0x3a44): undefined reference to vkAllocateMemory' cube.c:(.text+0x3aa0): undefined reference to vkBindImageMemory’
cube.c:(.text+0x3b08): undefined reference to vkCreateImageView' /tmp/ccbouT30.o: In function demo_prepare_texture_image’:
cube.c:(.text+0x3efc): undefined reference to vkCreateImage' cube.c:(.text+0x3f54): undefined reference to vkGetImageMemoryRequirements’
cube.c:(.text+0x3ff4): undefined reference to vkAllocateMemory' cube.c:(.text+0x4050): undefined reference to vkBindImageMemory’
cube.c:(.text+0x40d0): undefined reference to vkGetImageSubresourceLayout' cube.c:(.text+0x4104): undefined reference to vkMapMemory’
cube.c:(.text+0x41b4): undefined reference to vkUnmapMemory' /tmp/ccbouT30.o: In function demo_destroy_texture_image’:
cube.c:(.text+0x421c): undefined reference to vkFreeMemory' cube.c:(.text+0x423c): undefined reference to vkDestroyImage’
/tmp/ccbouT30.o: In function demo_prepare_textures': cube.c:(.text+0x4288): undefined reference to vkGetPhysicalDeviceFormatProperties’
cube.c:(.text+0x4550): undefined reference to vkCmdCopyImage' cube.c:(.text+0x46e0): undefined reference to vkCreateSampler’
cube.c:(.text+0x477c): undefined reference to vkCreateImageView' /tmp/ccbouT30.o: In function demo_prepare_cube_data_buffers’:
cube.c:(.text+0x4a68): undefined reference to vkCreateBuffer' cube.c:(.text+0x4adc): undefined reference to vkGetBufferMemoryRequirements’
cube.c:(.text+0x4b88): undefined reference to vkAllocateMemory' cube.c:(.text+0x4c08): undefined reference to vkMapMemory’
cube.c:(.text+0x4c94): undefined reference to vkUnmapMemory' cube.c:(.text+0x4cf8): undefined reference to vkBindBufferMemory’
/tmp/ccbouT30.o: In function demo_prepare_descriptor_layout': cube.c:(.text+0x4e10): undefined reference to vkCreateDescriptorSetLayout’
cube.c:(.text+0x4ea0): undefined reference to vkCreatePipelineLayout' /tmp/ccbouT30.o: In function demo_prepare_render_pass’:
cube.c:(.text+0x5058): undefined reference to vkCreateRenderPass' /tmp/ccbouT30.o: In function demo_prepare_shader_module’:
cube.c:(.text+0x511c): undefined reference to vkCreateShaderModule' /tmp/ccbouT30.o: In function demo_prepare_pipeline’:
cube.c:(.text+0x56b0): undefined reference to vkCreatePipelineCache' cube.c:(.text+0x5778): undefined reference to vkCreateGraphicsPipelines’
cube.c:(.text+0x57cc): undefined reference to vkDestroyShaderModule' cube.c:(.text+0x57ec): undefined reference to vkDestroyShaderModule’
/tmp/ccbouT30.o: In function demo_prepare_descriptor_pool': cube.c:(.text+0x58bc): undefined reference to vkCreateDescriptorPool’
/tmp/ccbouT30.o: In function demo_prepare_descriptor_set': cube.c:(.text+0x5b00): undefined reference to vkAllocateDescriptorSets’
cube.c:(.text+0x5bcc): undefined reference to vkUpdateDescriptorSets' /tmp/ccbouT30.o: In function demo_prepare_framebuffers’:
cube.c:(.text+0x5d1c): undefined reference to vkCreateFramebuffer' /tmp/ccbouT30.o: In function demo_prepare’:
cube.c:(.text+0x5e00): undefined reference to vkCreateCommandPool' cube.c:(.text+0x5e7c): undefined reference to vkAllocateCommandBuffers’
cube.c:(.text+0x5ed4): undefined reference to vkBeginCommandBuffer' cube.c:(.text+0x5f88): undefined reference to vkAllocateCommandBuffers’
cube.c:(.text+0x6030): undefined reference to vkCreateCommandPool' cube.c:(.text+0x60d0): undefined reference to vkAllocateCommandBuffers’
/tmp/ccbouT30.o: In function demo_cleanup': cube.c:(.text+0x623c): undefined reference to vkDeviceWaitIdle’
cube.c:(.text+0x627c): undefined reference to vkWaitForFences' cube.c:(.text+0x62ac): undefined reference to vkDestroyFence’
cube.c:(.text+0x62d4): undefined reference to vkDestroySemaphore' cube.c:(.text+0x62fc): undefined reference to vkDestroySemaphore’
cube.c:(.text+0x6334): undefined reference to vkDestroySemaphore' cube.c:(.text+0x6390): undefined reference to vkDestroyFramebuffer’
cube.c:(.text+0x63d0): undefined reference to vkDestroyDescriptorPool' cube.c:(.text+0x63f0): undefined reference to vkDestroyPipeline’
cube.c:(.text+0x6410): undefined reference to vkDestroyPipelineCache' cube.c:(.text+0x6430): undefined reference to vkDestroyRenderPass’
cube.c:(.text+0x6450): undefined reference to vkDestroyPipelineLayout' cube.c:(.text+0x6470): undefined reference to vkDestroyDescriptorSetLayout’
cube.c:(.text+0x64b4): undefined reference to vkDestroyImageView' cube.c:(.text+0x64f0): undefined reference to vkDestroyImage’
cube.c:(.text+0x652c): undefined reference to vkFreeMemory' cube.c:(.text+0x6568): undefined reference to vkDestroySampler’
cube.c:(.text+0x65c8): undefined reference to vkDestroyImageView' cube.c:(.text+0x65e8): undefined reference to vkDestroyImage’
cube.c:(.text+0x6608): undefined reference to vkFreeMemory' cube.c:(.text+0x664c): undefined reference to vkDestroyImageView’
cube.c:(.text+0x6694): undefined reference to vkFreeCommandBuffers' cube.c:(.text+0x66d0): undefined reference to vkDestroyBuffer’
cube.c:(.text+0x670c): undefined reference to vkFreeMemory' cube.c:(.text+0x6748): undefined reference to vkDestroyFence’
cube.c:(.text+0x67a0): undefined reference to vkDestroyCommandPool' cube.c:(.text+0x67d0): undefined reference to vkDestroyCommandPool’
cube.c:(.text+0x67dc): undefined reference to vkDeviceWaitIdle' cube.c:(.text+0x67ec): undefined reference to vkDestroyDevice’
cube.c:(.text+0x6844): undefined reference to vkDestroySurfaceKHR' cube.c:(.text+0x6854): undefined reference to vkDestroyInstance’
/tmp/ccbouT30.o: In function demo_resize': cube.c:(.text+0x6898): undefined reference to vkDeviceWaitIdle’
cube.c:(.text+0x68dc): undefined reference to vkDestroyFramebuffer' cube.c:(.text+0x691c): undefined reference to vkDestroyDescriptorPool’
cube.c:(.text+0x693c): undefined reference to vkDestroyPipeline' cube.c:(.text+0x695c): undefined reference to vkDestroyPipelineCache’
cube.c:(.text+0x697c): undefined reference to vkDestroyRenderPass' cube.c:(.text+0x699c): undefined reference to vkDestroyPipelineLayout’
cube.c:(.text+0x69bc): undefined reference to vkDestroyDescriptorSetLayout' cube.c:(.text+0x6a00): undefined reference to vkDestroyImageView’
cube.c:(.text+0x6a3c): undefined reference to vkDestroyImage' cube.c:(.text+0x6a78): undefined reference to vkFreeMemory’
cube.c:(.text+0x6ab4): undefined reference to vkDestroySampler' cube.c:(.text+0x6aec): undefined reference to vkDestroyImageView’
cube.c:(.text+0x6b0c): undefined reference to vkDestroyImage' cube.c:(.text+0x6b2c): undefined reference to vkFreeMemory’
cube.c:(.text+0x6b70): undefined reference to vkDestroyImageView' cube.c:(.text+0x6bb8): undefined reference to vkFreeCommandBuffers’
cube.c:(.text+0x6bf4): undefined reference to vkDestroyBuffer' cube.c:(.text+0x6c30): undefined reference to vkFreeMemory’
cube.c:(.text+0x6c6c): undefined reference to vkDestroyFence' cube.c:(.text+0x6cac): undefined reference to vkDestroyCommandPool’
cube.c:(.text+0x6cdc): undefined reference to vkDestroyCommandPool' /tmp/ccbouT30.o: In function demo_init_vk’:
cube.c:(.text+0x6ea4): undefined reference to vkEnumerateInstanceLayerProperties' cube.c:(.text+0x6f18): undefined reference to vkEnumerateInstanceLayerProperties’
cube.c:(.text+0x7084): undefined reference to vkEnumerateInstanceExtensionProperties' cube.c:(.text+0x70f8): undefined reference to vkEnumerateInstanceExtensionProperties’
cube.c:(.text+0x73d0): undefined reference to vkCreateInstance' cube.c:(.text+0x7478): undefined reference to vkEnumeratePhysicalDevices’
cube.c:(.text+0x74ec): undefined reference to vkEnumeratePhysicalDevices' cube.c:(.text+0x7578): undefined reference to vkEnumerateDeviceExtensionProperties’
cube.c:(.text+0x761c): undefined reference to vkEnumerateDeviceExtensionProperties' cube.c:(.text+0x7998): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x79c0): undefined reference to vkGetInstanceProcAddr' cube.c:(.text+0x7a50): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x7b94): undefined reference to vkGetPhysicalDeviceProperties' cube.c:(.text+0x7bb4): undefined reference to vkGetPhysicalDeviceQueueFamilyProperties’
cube.c:(.text+0x7c38): undefined reference to vkGetPhysicalDeviceQueueFamilyProperties' cube.c:(.text+0x7c48): undefined reference to vkGetPhysicalDeviceFeatures’
cube.c:(.text+0x7c64): undefined reference to vkGetInstanceProcAddr' cube.c:(.text+0x7cc0): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x7d1c): undefined reference to vkGetInstanceProcAddr' cube.c:(.text+0x7d78): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x7dd4): undefined reference to vkGetInstanceProcAddr' /tmp/ccbouT30.o: In function demo_create_device’:
cube.c:(.text+0x7f54): undefined reference to vkCreateDevice' /tmp/ccbouT30.o: In function demo_init_vk_swapchain’:
cube.c:(.text+0x823c): undefined reference to vkGetInstanceProcAddr' cube.c:(.text+0x82e4): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x838c): undefined reference to vkGetInstanceProcAddr' cube.c:(.text+0x8434): undefined reference to vkGetInstanceProcAddr’
cube.c:(.text+0x84dc): undefined reference to vkGetInstanceProcAddr' /tmp/ccbouT30.o:cube.c:(.text+0x8594): more undefined references to vkGetInstanceProcAddr’ follow
/tmp/ccbouT30.o: In function demo_init_vk_swapchain': cube.c:(.text+0x86dc): undefined reference to vkGetDeviceQueue’
cube.c:(.text+0x8730): undefined reference to vkGetDeviceQueue' cube.c:(.text+0x8908): undefined reference to vkCreateFence’
cube.c:(.text+0x8970): undefined reference to vkCreateSemaphore' cube.c:(.text+0x89d8): undefined reference to vkCreateSemaphore’
cube.c:(.text+0x8a50): undefined reference to vkCreateSemaphore' cube.c:(.text+0x8ac0): undefined reference to vkGetPhysicalDeviceMemoryProperties’
collect2: error: ld returned 1 exit status
nvidia@tegra-ubuntu:~/code/VulkanTools/demos$

Actually I think I have got this working by pointing to the /usr/lib/aarch64-linux-gnu/libvulkan.so.1.0.8

How do you setup Vulkan SDK ? I got fllowing error with cmake as

cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=build/install -DVULKAN_HEADERS_INSTALL_DIR=/home/l/Vulkan-Headers -DVULKAN_LOADER_INSTALL_DIR=/home/l/Vulkan-Loader -DVULKAN_VALIDATIONLAYERS_INSTALL_DIR=/home/l/Vulkan-ValidationLayers/

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
VkLayer_utils_LIBRARY
linked by target “VkLayer_assistant_layer” in directory /home/l/VulkanTools/layer_factory
linked by target “VkLayer_demo_layer” in directory /home/l/VulkanTools/layer_factory
linked by target “VkLayer_starter_layer” in directory /home/l/VulkanTools/layer_factory
linked by target “VkLayer_api_dump” in directory /home/l/VulkanTools/layersvt
linked by target “VkLayer_monitor” in directory /home/l/VulkanTools/layersvt
linked by target “VkLayer_screenshot” in directory /home/l/VulkanTools/layersvt
linked by target “VkLayer_device_simulation” in directory /home/l/VulkanTools/layersvt

Hi lxdong.007,

Please follow below steps to install Vulkan:

Install vulkan header
$ git clone https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers.git
$ sudo cp -r Vulkan-LoaderAndValidationLayers/include/vulkan /usr/include/
$ sudo apt-get install git cmake build-essential libx11-xcb-dev libxkbcommon-dev libmirclient-dev libwayland-dev libxrandr-dev
$ cd Vulkan-LoaderAndValidationLayers
$ ./update_external_sources.sh
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ sudo make install