微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

libncnn对vulkan的未定义引用

如何解决libncnn对vulkan的未定义引用

我遵循NCNN instructions,并在LUbuntu x64上成功构建了libncnn。我看到libvulkan.so和其他库文件在那里。

$ ls /home/jerry/1.1.114.0/x86_64/lib
libglslang.a           libshaderc_shared.so.1  libspirv-cross-msl.a      libSPIRV-Tools-shared.so       libVkLayer_device_simulation.so     libVkLayer_unique_objects.so
libHLSL.a              libSPIRV.a              libspirv-cross-reflect.a  libSPVRemapper.a               libVkLayer_khronos_validation.so    libVkLayer_utils.a
libOGLCompiler.a       libspirv-cross-c.a      libspirv-cross-util.a     libvkdisplay_wayland.so        libVkLayer_monitor.so               libVkLayer_vktrace_layer.so
libOSDependent.a       libspirv-cross-core.a   libSPIRV-Tools.a          libvkdisplay_xcb.so            libVkLayer_object_lifetimes.so      libvulkan.so
libshaderc.a           libspirv-cross-cpp.a    libSPIRV-Tools-link.a     libVkLayer_api_dump.so         libVkLayer_screenshot.so            libvulkan.so.1
libshaderc_combined.a  libspirv-cross-glsl.a   libSPIRV-Tools-opt.a      libVkLayer_assistant_layer.so  libVkLayer_stateless_validation.so  libvulkan.so.1.1.114
libshaderc_shared.so   libspirv-cross-hlsl.a   libSPIRV-Tools-reduce.a   libVkLayer_core_validation.so  libVkLayer_thread_safety.so

但是当我尝试将它们链接到我自己的项目中时。我收到以下错误。似乎无法正确链接,请问可能是什么问题?

/usr/bin/g++ -g /home/jerry/housekeeper/src/*.cpp -o /home/jerry/housekeeper/bin/housekeeper \
-I /home/jerry/housekeeper/ncnn/src \
-I /home/jerry/housekeeper/ncnn/build/src \
-I /usr/include/opencv4 \
-I /home/jerry/1.1.114.0/x86_64/include \
-L /home/jerry/1.1.114.0/x86_64/lib \
-lVkLayer_core_validation \
-lVkLayer_object_lifetimes \
-lshaderc_shared \
-lVkLayer_assistant_layer \
-lvulkan \
-lVkLayer_device_simulation \
-lvkdisplay_wayland \
-lVkLayer_vktrace_layer \
-lSPIRV-Tools-shared \
-lVkLayer_monitor \
-lVkLayer_unique_objects \
-lVkLayer_screenshot \
-lVkLayer_thread_safety \
-lVkLayer_api_dump \
-lVkLayer_stateless_validation \
-lVkLayer_khronos_validation \
-lvkdisplay_xcb \
lib/libncnn.a `pkg-config --libs --cflags opencv4` -fopenmp
    
/usr/bin/ld: lib/libncnn.a(pipelinecache.cpp.o): in function `ncnn::PipelineCache::clear()':
pipelinecache.cpp:(.text+0x378): undefined reference to `vkDestroyPipeline'
/usr/bin/ld: pipelinecache.cpp:(.text+0x393): undefined reference to `vkDestroyPipelineLayout'
/usr/bin/ld: pipelinecache.cpp:(.text+0x3ae): undefined reference to `vkDestroyDescriptorSetLayout'
/usr/bin/ld: pipelinecache.cpp:(.text+0x3c8): undefined reference to `vkDestroyShaderModule'
/usr/bin/ld: lib/libncnn.a(pipelinecache.cpp.o): in function `ncnn::PipelineCache::new_pipeline(VkShaderModule_T*,ncnn::ShaderInfo const&,std::vector<ncnn::vk_specialization_type,std::allocator<ncnn::vk_specialization_type> > const&,VkDescriptorSetLayout_T**,VkPipelineLayout_T**,VkPipeline_T**,VkDescriptorUpdateTemplate_T**) const':
pipelinecache.cpp:(.text+0x6e8): undefined reference to `vkDestroyPipeline'
/usr/bin/ld: pipelinecache.cpp:(.text+0x703): undefined reference to `vkDestroyPipelineLayout'
/usr/bin/ld: pipelinecache.cpp:(.text+0x723): undefined reference to `vkDestroyDescriptorSetLayout'
/usr/bin/ld: lib/libncnn.a(pipelinecache.cpp.o): in function `ncnn::PipelineCache::get_pipeline(unsigned int const*,unsigned long,unsigned int,VkShaderModule_T**,VkDescriptorUpdateTemplate_T**,ncnn::ShaderInfo&) const':
pipelinecache.cpp:(.text+0xdfc): undefined reference to `vkDestroyShaderModule'
/usr/bin/ld: lib/libncnn.a(pipelinecache.cpp.o): in function `ncnn::PipelineCache::get_pipeline(int,ncnn::Option const&,ncnn::ShaderInfo&) const':
pipelinecache.cpp:(.text+0x1266): undefined reference to `vkDestroyShaderModule'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightStagingallocator::fastFree(ncnn::VkBufferMemory*)':
allocator.cpp:(.text+0xc0): undefined reference to `vkUnmapMemory'
/usr/bin/ld: allocator.cpp:(.text+0xd6): undefined reference to `vkDestroyBuffer'
/usr/bin/ld: allocator.cpp:(.text+0xec): undefined reference to `vkFreeMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightAllocator::clear()':
allocator.cpp:(.text+0x13b): undefined reference to `vkDestroyBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x151): undefined reference to `vkFreeMemory'
/usr/bin/ld: allocator.cpp:(.text+0x18e): undefined reference to `vkUnmapMemory'
/usr/bin/ld: allocator.cpp:(.text+0x1cb): undefined reference to `vkDestroyBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x1e1): undefined reference to `vkFreeMemory'
/usr/bin/ld: allocator.cpp:(.text+0x21e): undefined reference to `vkUnmapMemory'
/usr/bin/ld: allocator.cpp:(.text+0x27e): undefined reference to `vkFreeMemory'
/usr/bin/ld: allocator.cpp:(.text+0x2d6): undefined reference to `vkFreeMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkStagingallocator::clear()':
allocator.cpp:(.text+0x3c5): undefined reference to `vkUnmapMemory'
/usr/bin/ld: allocator.cpp:(.text+0x3dc): undefined reference to `vkDestroyBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x3f3): undefined reference to `vkFreeMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::flush(ncnn::VkBufferMemory*)':
allocator.cpp:(.text+0x609): undefined reference to `vkFlushMappedMemoryRanges'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::invalidate(ncnn::VkBufferMemory*)':
allocator.cpp:(.text+0x6f9): undefined reference to `vkInvalidateMappedMemoryRanges'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightAllocator::fastFree(ncnn::VkImageMemory*)':
allocator.cpp:(.text+0x76e): undefined reference to `vkDestroyImageView'
/usr/bin/ld: allocator.cpp:(.text+0x784): undefined reference to `vkDestroyImage'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkBlobAllocator::clear()':
allocator.cpp:(.text+0x7d3): undefined reference to `vkDestroyBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x7e9): undefined reference to `vkFreeMemory'
/usr/bin/ld: allocator.cpp:(.text+0x826): undefined reference to `vkUnmapMemory'
/usr/bin/ld: allocator.cpp:(.text+0x8b6): undefined reference to `vkFreeMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkBlobAllocator::fastFree(ncnn::VkImageMemory*)':
allocator.cpp:(.text+0x15a4): undefined reference to `vkDestroyImageView'
/usr/bin/ld: allocator.cpp:(.text+0x15ba): undefined reference to `vkDestroyImage'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkStagingallocator::fastMalloc(unsigned long)':
allocator.cpp:(.text+0x177f): undefined reference to `vkCreateBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x17ac): undefined reference to `vkGetBufferMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x17fa): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x1822): undefined reference to `vkBindBufferMemory'
/usr/bin/ld: allocator.cpp:(.text+0x1849): undefined reference to `vkMapMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightStagingallocator::fastMalloc(unsigned long)':
allocator.cpp:(.text+0x19d4): undefined reference to `vkCreateBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x1a01): undefined reference to `vkGetBufferMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x1a4f): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x1a77): undefined reference to `vkBindBufferMemory'
/usr/bin/ld: allocator.cpp:(.text+0x1a9e): undefined reference to `vkMapMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::create_buffer(unsigned long,unsigned int)':
allocator.cpp:(.text+0x1efe): undefined reference to `vkCreateBuffer'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::allocate_memory(unsigned long,unsigned int)':
allocator.cpp:(.text+0x1fb4): undefined reference to `vkAllocateMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::allocate_dedicated_memory(unsigned long,VkImage_T*,VkBuffer_T*)':
allocator.cpp:(.text+0x2090): undefined reference to `vkAllocateMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::create_image(VkImageType,int,VkFormat,VkImageTiling,unsigned int)':
allocator.cpp:(.text+0x21bd): undefined reference to `vkCreateImage'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkAllocator::create_imageview(VkImageViewType,VkFormat)':
allocator.cpp:(.text+0x22d3): undefined reference to `vkCreateImageView'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkBlobAllocator::fastMalloc(unsigned long)':
allocator.cpp:(.text+0x288d): undefined reference to `vkCreateBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x28c1): undefined reference to `vkGetBufferMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x2914): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x2944): undefined reference to `vkBindBufferMemory'
/usr/bin/ld: allocator.cpp:(.text+0x2b24): undefined reference to `vkMapMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkBlobAllocator::fastMalloc(int,int)':
allocator.cpp:(.text+0x2d40): undefined reference to `vkGetimageMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x2ec3): undefined reference to `vkBindImageMemory'
/usr/bin/ld: allocator.cpp:(.text+0x30e3): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x311e): undefined reference to `vkBindImageMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightAllocator::fastMalloc(int,int)':
allocator.cpp:(.text+0x35b9): undefined reference to `vkGetimageMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x368b): undefined reference to `vkBindImageMemory'
/usr/bin/ld: allocator.cpp:(.text+0x382a): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x3865): undefined reference to `vkBindImageMemory'
/usr/bin/ld: allocator.cpp:(.text+0x39e8): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x3a26): undefined reference to `vkBindImageMemory'
/usr/bin/ld: lib/libncnn.a(allocator.cpp.o): in function `ncnn::VkWeightAllocator::fastMalloc(unsigned long)':
allocator.cpp:(.text+0x3e24): undefined reference to `vkCreateBuffer'
/usr/bin/ld: allocator.cpp:(.text+0x3e71): undefined reference to `vkGetBufferMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x3ecf): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x3efd): undefined reference to `vkBindBufferMemory'
/usr/bin/ld: allocator.cpp:(.text+0x400c): undefined reference to `vkGetBufferMemoryRequirements'
/usr/bin/ld: allocator.cpp:(.text+0x4094): undefined reference to `vkMapMemory'
/usr/bin/ld: allocator.cpp:(.text+0x412b): undefined reference to `vkAllocateMemory'
/usr/bin/ld: allocator.cpp:(.text+0x415c): undefined reference to `vkBindBufferMemory'
/usr/bin/ld: allocator.cpp:(.text+0x429e): undefined reference to `vkMapMemory'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::~VkCompute()':
command.cpp:(.text+0xbc): undefined reference to `vkFreeDescriptorSets'
/usr/bin/ld: command.cpp:(.text+0xdd): undefined reference to `vkDestroyDescriptorPool'
/usr/bin/ld: command.cpp:(.text+0x10d): undefined reference to `vkDestroyFence'
/usr/bin/ld: command.cpp:(.text+0x12a): undefined reference to `vkFreeCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x140): undefined reference to `vkDestroyCommandPool'
/usr/bin/ld: command.cpp:(.text+0x32a): undefined reference to `vkDestroyImageView'
/usr/bin/ld: command.cpp:(.text+0x340): undefined reference to `vkDestroyImage'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::submit_and_wait()':
command.cpp:(.text+0x501): undefined reference to `vkEndCommandBuffer'
/usr/bin/ld: command.cpp:(.text+0x584): undefined reference to `vkQueueSubmit'
/usr/bin/ld: command.cpp:(.text+0x5c6): undefined reference to `vkWaitForFences'
/usr/bin/ld: command.cpp:(.text+0x758): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: command.cpp:(.text+0x7d6): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: command.cpp:(.text+0x83e): undefined reference to `vkCmddispatch'
/usr/bin/ld: command.cpp:(.text+0x876): undefined reference to `vkCmdPushConstants'
/usr/bin/ld: command.cpp:(.text+0x8a4): undefined reference to `vkCmdBindDescriptorSets'
/usr/bin/ld: command.cpp:(.text+0x8bc): undefined reference to `vkCmdBindPipeline'
/usr/bin/ld: command.cpp:(.text+0x900): undefined reference to `vkCmdcopyImagetoBuffer'
/usr/bin/ld: command.cpp:(.text+0x938): undefined reference to `vkCmdcopyBufferToImage'
/usr/bin/ld: command.cpp:(.text+0x96f): undefined reference to `vkCmdcopyImage'
/usr/bin/ld: command.cpp:(.text+0x9a4): undefined reference to `vkCmdcopyBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::reset()':
command.cpp:(.text+0xd40): undefined reference to `vkFreeDescriptorSets'
/usr/bin/ld: command.cpp:(.text+0xd61): undefined reference to `vkDestroyDescriptorPool'
/usr/bin/ld: command.cpp:(.text+0xdc3): undefined reference to `vkResetCommandBuffer'
/usr/bin/ld: command.cpp:(.text+0xde4): undefined reference to `vkResetFences'
/usr/bin/ld: command.cpp:(.text+0xe36): undefined reference to `vkDestroyImageView'
/usr/bin/ld: command.cpp:(.text+0xe4c): undefined reference to `vkDestroyImage'
/usr/bin/ld: command.cpp:(.text+0xea9): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::init()':
command.cpp:(.text+0xfea): undefined reference to `vkCreateCommandPool'
/usr/bin/ld: command.cpp:(.text+0x1031): undefined reference to `vkAllocateCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x106a): undefined reference to `vkCreateFence'
/usr/bin/ld: command.cpp:(.text+0x10d1): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::begin_command_buffer()':
command.cpp:(.text+0x11c2): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkCompute::end_command_buffer()':
command.cpp:(.text+0x122a): undefined reference to `vkEndCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::~VkTransfer()':
command.cpp:(.text+0x128c): undefined reference to `vkDestroyFence'
/usr/bin/ld: command.cpp:(.text+0x12a8): undefined reference to `vkFreeCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x12bd): undefined reference to `vkDestroyCommandPool'
/usr/bin/ld: command.cpp:(.text+0x134e): undefined reference to `vkDestroyFence'
/usr/bin/ld: command.cpp:(.text+0x1363): undefined reference to `vkDestroySemaphore'
/usr/bin/ld: command.cpp:(.text+0x137f): undefined reference to `vkFreeCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x1394): undefined reference to `vkDestroyCommandPool'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::begin_command_buffer()':
command.cpp:(.text+0x13e9): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: command.cpp:(.text+0x1449): undefined reference to `vkBeginCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::init()':
command.cpp:(.text+0x14ed): undefined reference to `vkCreateCommandPool'
/usr/bin/ld: command.cpp:(.text+0x1534): undefined reference to `vkAllocateCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x156d): undefined reference to `vkCreateFence'
/usr/bin/ld: command.cpp:(.text+0x15c6): undefined reference to `vkCreateCommandPool'
/usr/bin/ld: command.cpp:(.text+0x1603): undefined reference to `vkAllocateCommandBuffers'
/usr/bin/ld: command.cpp:(.text+0x163c): undefined reference to `vkCreateSemaphore'
/usr/bin/ld: command.cpp:(.text+0x1675): undefined reference to `vkCreateFence'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::end_command_buffer()':
command.cpp:(.text+0x1753): undefined reference to `vkEndCommandBuffer'
/usr/bin/ld: command.cpp:(.text+0x1785): undefined reference to `vkEndCommandBuffer'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::submit_and_wait()':
command.cpp:(.text+0x1898): undefined reference to `vkQueueSubmit'
/usr/bin/ld: command.cpp:(.text+0x1906): undefined reference to `vkQueueSubmit'
/usr/bin/ld: command.cpp:(.text+0x196a): undefined reference to `vkWaitForFences'
/usr/bin/ld: command.cpp:(.text+0x19f6): undefined reference to `vkQueueSubmit'
/usr/bin/ld: command.cpp:(.text+0x1a78): undefined reference to `vkWaitForFences'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::record_upload(ncnn::Mat const&,ncnn::VkMat&,bool)':
command.cpp:(.text+0x1fad): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: command.cpp:(.text+0x1ffc): undefined reference to `vkCmdcopyBuffer'
/usr/bin/ld: command.cpp:(.text+0x207f): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: command.cpp:(.text+0x22b3): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: command.cpp:(.text+0x272f): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: command.cpp:(.text+0x27b3): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::record_upload(ncnn::Mat const&,ncnn::VkImageMat&,ncnn::Option const&)':
command.cpp:(.text+0x3c04): undefined reference to `vkCmdPipelineBarrier'
/usr/bin/ld: lib/libncnn.a(command.cpp.o):command.cpp:(.text+0x3c71): more undefined references to `vkCmdPipelineBarrier' follow
/usr/bin/ld: lib/libncnn.a(command.cpp.o): in function `ncnn::VkTransfer::record_upload(ncnn::Mat const&,ncnn::Option const&)':
command.cpp:(.text+0x3d4c): The terminal process "/bin/bash '-c','/usr/bin/g++ -g /home/jerry/housekeeper/src/*.cpp -o /home/jerry/housekeeper/bin/housekeeper -I /home/jerry/housekeeper/ncnn/src -I /home/jerry/housekeeper/ncnn/build/src -I /usr/include/opencv4 -I /home/jerry/1.1.114.0/x86_64/include -L /home/jerry/1.1.114.0/x86_64/lib -lVkLayer_core_validation -lVkLayer_object_lifetimes -lshaderc_shared -lVkLayer_assistant_layer -lvulkan -lVkLayer_device_simulation -lvkdisplay_wayland -lVkLayer_vktrace_layer -lSPIRV-Tools-shared -lVkLayer_monitor -lVkLayer_unique_objects -lVkLayer_screenshot -lVkLayer_thread_safety -lVkLayer_api_dump -lVkLayer_stateless_validation -lVkLayer_khronos_validation -lvkdisplay_xcb lib/libncnn.a `pkg-config --libs --cflags opencv4` -fopenmp'" terminated with exit code: 1.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。