Skip to content

compile "TensorRT-introduction" #34

Open
@zccyman

Description

@zccyman

I compile "TensorRT-introduction", but have some error as follow:

CMakeFiles/main.dir/ioHelper.cpp.o: In function `nvinfer1::readTensorProto(std::string const&, float*)':
ioHelper.cpp:(.text+0x131): undefined reference to `onnx::TensorProto::TensorProto()'
ioHelper.cpp:(.text+0x232): undefined reference to `onnx::TensorProto::~TensorProto()'
ioHelper.cpp:(.text+0x255): undefined reference to `onnx::TensorProto::~TensorProto()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/main.dir/build.make:201: main] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/main.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

project(simpleOnnx)

add_executable(main simpleOnnx_2.cpp cudaWrapper.h ioHelper.cpp ioHelper.h logger.cpp)

include_directories(/usr/local/include)

include_directories(/home/developer/zhangcc/download/TensorRT-7.0.0.11/include)
include_directories(/home/developer/zhangcc/download/TensorRT-7.0.0.11/samples/common)
set(TENSORRT_DIR /home/developer/zhangcc/download/TensorRT-7.0.0.11/lib)

find_package(CUDA 10.2 REQUIRED)
message(STATUS "CUDA status:")
message(STATUS "    include path: ${CUDA_INCLUDE_DIRS}")
message(STATUS "    libraries: ${CUDA_LIBRARIES}")
include_directories(${CUDA_INCLUDE_DIRS})
target_link_libraries(main ${CUDA_LIBRARIES})

find_package(Protobuf REQUIRED)
message(STATUS "Protobuf library status:")
message(STATUS "    version: ${Protobuf_VERSION}")
message(STATUS "    libraries: ${Protobuf_LIBS}")
message(STATUS "    include path: ${Protobuf_INCLUDE_DIRS}")

target_link_libraries(main /usr/local/lib/libprotobuf-lite.so)
target_link_libraries(main /usr/local/lib/libonnxifi.so)
target_link_libraries(main /usr/local/lib/libprotoc.so)

target_link_libraries(main ${TENSORRT_DIR}/libnvinfer.so ${TENSORRT_DIR}/libnvinfer_plugin.so ${TENSORRT_DIR}/libnvonnxparser.so ${TENSORRT_DIR}/libnvparsers.so)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions