Linking issues when adding cusom 3party lib

Hi,

I’m trying to write my own codegen with an custom binary repr which is generated by an external project called cnn_converter. Unfortunately I’m no cmake expert which is why I can’t seem to include said project successfully. The project consists of two relevant folders:

/bif: contains an header and an source file /netgen: contains a couple headers and source files + CmakeLists

I’ve tried to integrate it into TVM like so:

cmake/modules/contrib/cnn_converter.cmake:

if ((USE_CNN_CONVERTER STREQUAL "ON"))
    find_package(Qt5 COMPONENTS Core REQUIRED) # subproject depends on Qt
    add_definitions(-DQT_NO_VERSION_TAGGING)
    set(NetgenIncludeExtDirs ${CNN_CONVERTER_PATH} ${CNN_CONVERTER_PATH}/bif/ ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
    set(NetgenIncludeDirs ${CNN_CONVERTER_PATH}/bif/ ${CNN_CONVERTER_PATH}/netgen/ ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
    add_subdirectory(${CNN_CONVERTER_PATH}/netgen)
    target_include_directories(netgen PRIVATE ${NetgenIncludeDirs})
    include_directories(${NetgenIncludeExtDirs})
endif()

additions to CMakeLists.txt

tvm_option(CNN_CONVERTER_PATH "Path to IMS CNN Converter" "3rdparty/cnn_converter")
include(cmake/modules/contrib/CNN_CONVERTER.cmake)

make output:

bytecode.cc:(.text._ZN7CNN_NET3Net18designMmLayoutEv[_ZN7CNN_NET3Net18designMmLayoutEv]+0x2f2): undefined reference to `mmAddrStr(unsigned long)'

where mmAddrStr is a function defined in the subproject.

Thanks for reading & any ideas how to fix those linking errors would be appreciated :slight_smile:

It definitely sounds like an interesting issue, but I’m not sure how I could help in this particular case with limited information…Generally if a symbol is missing, I would assume it’s not linked properly, or the compiled target (in your case, the cnn converter) misses some symbols.