Skip to content

[Bug] Unable to include MMDeploy_LIBS in another project  #1481

Open
@chrillemanden

Description

@chrillemanden

Checklist

  • I have searched related issues but cannot get the expected help.
  • 2. I have read the FAQ documentation but cannot get the expected help.
  • 3. The bug has not been fixed in the latest version.

Describe the bug

Hi

I successfully installed mmdeploy on my Jetson Orin following the jetson build.
While trying to include mmdeploy in another project with cmake, it is able to find the package "MMDeploy" with:
find_package(MMDeploy REQUIRED) and possibly the headers but unable to include the libraries.

Reproduction

A. Follow jetson build to build mmdeploy for jetson orin with jetpack 5.0.2.

B. Create new project:
CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)
project(foo)

# Default to C17
set(CMAKE_CXX_STANDARD 17)

# find openCV
find_package(OpenCV REQUIRED)


# Include MMDeploy libs
list(APPEND CMAKE_PREFIX_PATH "~/mmdeploy/build/install/lib/cmake/MMDeploy")


# # Include headers
INCLUDE_DIRECTORIES("~/mmdeploy/build/install/include/")
find_package(MMDeploy REQUIRED)

add_executable(foo src/foo.cpp)
target_link_libraries(foo ${OpenCV_LIBS} ${MMDeploy_LIBS})

foo.cpp:

#include <fstream>
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <string>
#include <chrono>

#include "mmdeploy/detector.h"

int main(int argc, char* argv[]) 
{

    if (argc != 4) 
    {
        fprintf(stderr, "usage:\n  object_detection device_name model_path image_path\n");
        return 1;
    }

    
    fprintf(stdout, "this a modified test version of object detection");
    

    auto device_name = argv[1];
    auto model_path = argv[2];
    auto img_files_path = argv[3];
    
    mmdeploy_detector_t detector{};
    int status{};
    status = mmdeploy_detector_create_by_path(model_path, device_name, 0, &detector);
    return 0;

Environment

2022-12-02 10:00:13,493 - mmdeploy - INFO - 

2022-12-02 10:00:13,494 - mmdeploy - INFO - **********Environmental information**********
2022-12-02 10:00:14,374 - mmdeploy - INFO - sys.platform: linux
2022-12-02 10:00:14,374 - mmdeploy - INFO - Python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:56:18) [GCC 10.3.0]
2022-12-02 10:00:14,374 - mmdeploy - INFO - CUDA available: True
2022-12-02 10:00:14,374 - mmdeploy - INFO - GPU 0: Orin
2022-12-02 10:00:14,374 - mmdeploy - INFO - CUDA_HOME: /usr/local/cuda
2022-12-02 10:00:14,374 - mmdeploy - INFO - NVCC: Cuda compilation tools, release 11.4, V11.4.239
2022-12-02 10:00:14,374 - mmdeploy - INFO - GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
2022-12-02 10:00:14,374 - mmdeploy - INFO - PyTorch: 1.12.0a0+2c916ef.nv22.3
2022-12-02 10:00:14,374 - mmdeploy - INFO - PyTorch compiling details: PyTorch built with:
  - GCC 9.4
  - C++ Version: 201402
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: NO AVX
  - CUDA Runtime 11.4
  - NVCC architecture flags: -gencode;arch=compute_62,code=sm_62;-gencode;arch=compute_72,code=sm_72;-gencode;arch=compute_87,code=sm_87
  - CuDNN 8.4.1
    - Built with CuDNN 8.3.2
  - Build settings: BLAS_INFO=open, BUILD_TYPE=Release, CUDA_VERSION=11.4, CUDNN_VERSION=8.3.2, CXX_COMPILER=/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=open, TORCH_VERSION=1.12.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=OFF, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=0, USE_NNPACK=0, USE_OPENMP=ON, USE_ROCM=OFF, 

2022-12-02 10:00:14,374 - mmdeploy - INFO - TorchVision: 0.13.0a0
2022-12-02 10:00:14,374 - mmdeploy - INFO - OpenCV: 4.6.0
2022-12-02 10:00:14,374 - mmdeploy - INFO - MMCV: 1.6.2
2022-12-02 10:00:14,374 - mmdeploy - INFO - MMCV Compiler: GCC 9.4
2022-12-02 10:00:14,374 - mmdeploy - INFO - MMCV CUDA Compiler: 11.4
2022-12-02 10:00:14,375 - mmdeploy - INFO - MMDeploy: 0.11.0+2a1fed9
2022-12-02 10:00:14,375 - mmdeploy - INFO - 

2022-12-02 10:00:14,375 - mmdeploy - INFO - **********Backend information**********
2022-12-02 10:00:15,975 - mmdeploy - INFO - onnxruntime: None	ops_is_avaliable : False
2022-12-02 10:00:16,026 - mmdeploy - INFO - tensorrt: 8.4.1.5	ops_is_avaliable : True
2022-12-02 10:00:16,052 - mmdeploy - INFO - ncnn: None	ops_is_avaliable : False
2022-12-02 10:00:16,055 - mmdeploy - INFO - pplnn_is_avaliable: False
2022-12-02 10:00:16,057 - mmdeploy - INFO - openvino_is_avaliable: False
2022-12-02 10:00:16,081 - mmdeploy - INFO - snpe_is_available: False
2022-12-02 10:00:16,084 - mmdeploy - INFO - ascend_is_available: False
2022-12-02 10:00:16,087 - mmdeploy - INFO - coreml_is_available: False
2022-12-02 10:00:16,087 - mmdeploy - INFO - 

2022-12-02 10:00:16,087 - mmdeploy - INFO - **********Codebase information**********
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmdet:	2.26.0
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmseg:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmcls:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmocr:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmedit:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmdet3d:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmpose:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmrotate:	None
2022-12-02 10:00:16,098 - mmdeploy - INFO - mmaction:	None

Error traceback

/usr/bin/ld: CMakeFiles/foo.dir/src/foo.cpp.o: in function `main':
foo.cpp:(.text+0xd0): undefined reference to `mmdeploy_detector_create_by_path'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/foo.dir/build.make:99: foo] Error 1
make: *** [Makefile:84: all] Error 1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions