Skip to content

Vulkan #18

Open
Open
@kevinzezel

Description

@kevinzezel

Hi,

I installed ncnn with vulkan on the raspberry pi 4B 8Gb correctly and I'm running the ncnn examples successfully on vulkan. But I'm not knowing how to correctly configure my CMakeLists.txt file to reference the glslang library.

Error:

/usr/bin/ld: /usr/local/lib/ncnn/libncnn.a(gpu.cpp.o): in function `ncnn::destroy_gpu_instance()':
gpu.cpp:(.text+0xcb4): undefined reference to `glslang::FinalizeProcess()'
/usr/bin/ld: /usr/local/lib/ncnn/libncnn.a(gpu.cpp.o): in function `ncnn::create_gpu_instance()':
gpu.cpp:(.text+0x3dc8): undefined reference to `glslang::InitializeProcess()'
/usr/bin/ld: /usr/local/lib/ncnn/libncnn.a(gpu.cpp.o): in function `ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&)':
gpu.cpp:(.text+0x7ba0): undefined reference to `glslang::TShader::TShader(EShLanguage)'
/usr/bin/ld: gpu.cpp:(.text+0x7bb8): undefined reference to `glslang::TShader::setStringsWithLengths(char const* const*, int const*, int)'
/usr/bin/ld: gpu.cpp:(.text+0x7bcc): undefined reference to `glslang::TShader::addProcesses(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
/usr/bin/ld: gpu.cpp:(.text+0x7bdc): undefined reference to `glslang::TShader::setEntryPoint(char const*)'
/usr/bin/ld: gpu.cpp:(.text+0x7be8): undefined reference to `glslang::TShader::setSourceEntryPoint(char const*)'
/usr/bin/ld: gpu.cpp:(.text+0x7d3c): undefined reference to `glslang::TShader::parse(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)'
/usr/bin/ld: gpu.cpp:(.text+0x7d84): undefined reference to `glslang::TShader::getInfoLog()'
/usr/bin/ld: gpu.cpp:(.text+0x7dac): undefined reference to `glslang::TShader::getInfoDebugLog()'
/usr/bin/ld: gpu.cpp:(.text+0x7dd0): undefined reference to `glslang::TShader::~TShader()'
/usr/bin/ld: gpu.cpp:(.text+0x84b0): undefined reference to `glslang::GlslangToSpv(glslang::TIntermediate const&, std::vector<unsigned int, std::allocator<unsigned int> >&, glslang::SpvOptions*)'
/usr/bin/ld: gpu.cpp:(.text+0x84bc): undefined reference to `glslang::TShader::~TShader()'
/usr/bin/ld: gpu.cpp:(.text+0xa474): undefined reference to `glslang::TShader::~TShader()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test.dir/build.make:285: ../test] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/test.dir/all] Error 2

CMakeLists.txt:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(test)

macro(use_cxx11)
  if (CMAKE_VERSION VERSION_LESS "3.1")
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
    endif ()
  else ()
    set (CMAKE_CXX_STANDARD 17)
  endif ()
endmacro(use_cxx11)

find_package(OpenCV REQUIRED)
find_package(aws-crt-cpp REQUIRED)
find_package(AWSSDK REQUIRED COMPONENTS s3 transfer)

set(SOURCES src/main.cpp src/TDetection.cpp)
set(
  EXTRA_LIBS ${OpenCV_LIBS} 
  /usr/local/lib/ncnn/libncnn.a
  /usr/lib/aarch64-linux-gnu/libvulkan.so  
)
set(EXECUTABLE_OUTPUT_PATH "../")

include_directories(include ${OpenCV_INCLUDE_DIRS} /usr/local/include/ncnn )
add_link_options(-fopenmp -s -ldl -lpthread )

add_executable(test ${SOURCES})

target_link_libraries(test ${EXTRA_LIBS})
target_link_libraries(test AWS::aws-crt-cpp)
target_link_libraries(test ${AWSSDK_LINK_LIBRARIES})

find_library(WIRINGPI_LIBRARIES NAMES wiringPi)
target_link_libraries(test ${WIRINGPI_LIBRARIES})

Obs: Everything runs perfect with Ncnn without Vulkan

Regards,
Kevin

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