Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Beginner
138 Views

Linking OpenVINO DLLs to a program compiled with MinGW

Hello,

is it possible to link InferenceEngine DLLs (compiled with MSVC) to a program compiled for Windows with MinGW?

I have a CMake-based software project that I would like to compile for Linux (GCC) and Windows (MinGW). I use find_package() with manually set ${InferenceEngine_DIR}, ${ngraph_DIR} and ${TBB_DIR} variables to locate the shared libraries. Building for Linux works correctly, however, when I build for Windows with MinGW compiler, InferenceEngine libraries are not found, specifically, the following commands in InferenceEngineConfig.cmake file from the OpenVINO distribution fail to find any libraries:

find_library(IE_RELEASE_LIBRARY inference_engine "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
find_library(IE_LEGACY_RELEASE_LIBRARY inference_engine_legacy "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)

I checked the paths and they are correct: ${IE_LIB_REL_DIR} folder contains inference_engine.dll and other InferenceEngine DLL files. CMake is also aware that it is compiling for Windows ("if (WIN32)" is true).

At this point, I am not sure if it is generally not possible to link to InferenceEngine DLLs when compiling with MinGW or if my CMake script is missing something.

Additional information

Development environment: Ubuntu 18.04, OpenVINO 2021.1.110, CMake 3.16.

My MinGW Windows toolchain contains the following:

SET(CMAKE_SYSTEM_NAME Windows)
SET(CROSS_COMPILE_TOOLCHAIN_PREFIX "x86_64-w64-mingw32")
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

get_filename_component(openvino_DIR "${PROJECT_SOURCE_DIR}/3rdparty/openvino_2021.1.110" ABSOLUTE CACHE)
set(InferenceEngine_DIR ${openvino_DIR}/deployment_tools/inference_engine/share)
set(ngraph_DIR ${openvino_DIR}/deployment_tools/ngraph/cmake)
set(TBB_DIR ${openvino_DIR}/deployment_tools/inference_engine/external/tbb/cmake)
set(OpenCV_DIR ${openvino_DIR}/opencv/cmake)

 

0 Kudos
4 Replies
Beginner
113 Views

Update:

I have since discovered that the issue was caused by CMake that, in newer versions, no longer searches for DLL files unless it is explicitly requested. The following addition to my CMake file fixed it:

set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})

 

Additional information for all who wish to use OpenVINO DLLs with MinGW:

TBB libraries cannot be linked by using TBBConfig.cmake / find_package() (TBBConfig.cmake is only compatible with MSVC). A workaround is to either write ones own Cmake file or link TBB and all its dependencies manually.

 

Unfortunately, I cannot test whether the final program also executes correctly, since I have other, unrelated runtime issues. Nevertheless, the original issue is now resolved.

0 Kudos
Community Manager
103 Views

Hi catriona,

 

Thank you for sharing this information. We highly value your cooperation.

 

Regards,

Adli

 

0 Kudos
Community Manager
75 Views

Hi Catriona,


Thank you for your question. If you need any additional information from Intel, please submit a new question as this thread is no longer being monitored.


Regards,

Adli


0 Kudos
Beginner
15 Views

Hi I have the same issue you had and I would like to know if you managed to use OpenVINOs DLLS with MingW! 
I managed to build TBB with MingW using this repository: https://github.com/wjakob/tbb which is a fork of the TBB github with a CMAKE system but I am stuck building OpenVINO.

Could you tell me if you succeded and how? 

Thank you!

0 Kudos