Community
cancel
Showing results for 
Search instead for 
Did you mean: 
DOjik
Beginner
1,208 Views

how to link against OpenVINO libraries

Jump to solution

I will like to understand where are the OpenVINO link libraries that are linked with the user’s application when running make.

I am compiling an OpenVINO application that uses external libraries, and I have to link OpenVINO libraries to this application (along with my other external libraries).

I have looked at the makefile and makefile2 files within OpenVINO source, but I am not understanding how to tweak these files for my desired need.  

For this linking, I have also tried something like:

g++  main.o    -L   /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/centos_7.4/intel64/

Dave

0 Kudos

Accepted Solutions
nikos1
Valued Contributor I
1,208 Views

> I am compiling one of Intel's example found here https://github.com/opencv/dldt/blob/2018/inference-engine/samples/classi..., which depends on gflags...

BTW this worked for me - has quite a few dependencies...

 

clang++-6.0 -std=c++14 -o test main.cpp -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/classification_sample_async -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/src/extension -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common/format_reader/ -I ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/include -L ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/lib/linux -linference_engine -lcpu_extension -ldl -lpthread -liomp5 -lgflags -L ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/build/intel64/Release/lib -lformat_reader

if you don't see the entire command you can copy to clipboard and paste to a text editor - data is there but browsers can hide it sometimes

 

ldd   test
	linux-vdso.so.1 =>  (0x00007fff2c517000)
	libinference_engine.so => /home/x/intel//computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so (0x00007f8e1b25f000)
	libcpu_extension.so => ./libcpu_extension.so (0x00007f8e1afac000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8e1ada8000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8e1ab8b000)
	libiomp5.so => /home/x/intel//computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib/libiomp5.so (0x00007f8e1a7af000)
	libgflags.so.2 => /usr/lib/x86_64-linux-gnu/libgflags.so.2 (0x00007f8e1a58e000)
    libformat_reader.so => ./libformat_reader.so (0x00007f06b8813000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8e1a202000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8e19ef9000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8e19ce1000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8e19917000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8e1b888000)

 

View solution in original post

15 Replies
Jeffrey_M_Intel1
Employee
1,208 Views

Here is a makefile including inference engine and OpenCV includes:

g++  -O3 -o multidemo_IE --std=c++11 multidemo_IE.cpp -I. \
            -I/opt/intel/computer_vision_sdk/opencv/include/ \
            -I/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/include/ \
            -I/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/include/cpp \
            -L/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64 \
            -L/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib \
            -linference_engine -ldl -lpthread -lcpu_extension \
            -L/opt/intel/computer_vision_sdk/opencv/lib -lopencv_core -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -lopencv_videoio -lopencv_video -lgflags

 

DOjik
Beginner
1,208 Views

When I run, I get link issues with gflag, as follows:

/usr/bin/ld: cannot find -lgflags
collect2: error: ld returned 1 exit status


 

nikos1
Valued Contributor I
1,208 Views

Hi David,

Can your try again after

sudo apt-get install libgflags-dev

If that fails could you post the output of your g++ command without -lgflags 

Do you have libgflags* under /usr/lib/x86_64-linux-gnu/ ?

ls /usr/lib/x86_64-linux-gnu/libgflags*

 

DOjik
Beginner
1,208 Views
 

OK, I install libgflags-dev and re-run, and I get a lot of unresolved symbols --

Install gflags

$ sudo apt-get install libgflags-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libgflags2.2
The following NEW packages will be installed:
  libgflags-dev libgflags2.2
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/158 kB of archives.
After this operation, 910 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libgflags2.2.
(Reading database ... 196472 files and directories currently installed.)
Preparing to unpack .../libgflags2.2_2.2.1-1_amd64.deb ...
Unpacking libgflags2.2 (2.2.1-1) ...
Selecting previously unselected package libgflags-dev.
Preparing to unpack .../libgflags-dev_2.2.1-1_amd64.deb ...
Unpacking libgflags-dev (2.2.1-1) ...
Setting up libgflags2.2 (2.2.1-1) ...
Setting up libgflags-dev (2.2.1-1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
/sbin/ldconfig.real: /opt/intel/common/mdf/lib64/igfxcmrt64.so is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libmfxhw64.so.1 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-x11.so.2 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libigdgmm.so.1 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-drm.so.2 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva.so.2 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-glx.so.2 is not a symbolic link

/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libmfx.so.1 is not a symbolic link

Re-run:

/usr/bin/ld: warning: libiomp5.so, needed by /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so, not found (try using -rpath or -rpath-link)
/tmp/ccdE9nSL.o: In function `ParseAndCheckCommandLine(int, char**)':
main.cpp:(.text+0x6a5): undefined reference to `gflags::ParseCommandLineNonHelpFlags(int*, char***, bool)'
/tmp/ccdE9nSL.o: In function `parseInputFilesArguments(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> > > >&)':
main.cpp:(.text+0x1444): undefined reference to `gflags::GetArgvs[abi:cxx11]()'
/tmp/ccdE9nSL.o: In function `main':
main.cpp:(.text.startup+0x7be): undefined reference to `CreateFormatReader'
/tmp/ccdE9nSL.o: In function `_GLOBAL__sub_I__Z23readInputFilesArgumentsRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERKS5_':
main.cpp:(.text.startup+0x3f8d): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x3ff7): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4095): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4134): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x41d6): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x423a): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4269): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x42d3): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4372): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x43d6): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4405): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4434): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x44a9): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x450d): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so: undefined reference to `omp_get_thread_num@VERSION'
/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so: undefined reference to `omp_get_max_threads@VERSION'
/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so: undefined reference to `GOMP_parallel@VERSION'
/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so: undefined reference to `omp_get_num_threads@VERSION'
collect2: error: ld returned 1 exit status

(Meanwhile, If I uninstall this gflag, I get previous error, /usr/bin/ld: cannot find -lgflags.)

Yes, libgflags* are there under /usr/lib/x86_64-linux-gnu/ 

-rw-r--r-- 1 root root 258068 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags.a
-rw-r--r-- 1 root root 256002 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags_nothreads.a
lrwxrwxrwx 1 root root     26 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags_nothreads.so -> libgflags_nothreads.so.2.2
lrwxrwxrwx 1 root root     28 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags_nothreads.so.2.2 -> libgflags_nothreads.so.2.2.1
-rw-r--r-- 1 root root 146096 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags_nothreads.so.2.2.1
lrwxrwxrwx 1 root root     16 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags.so -> libgflags.so.2.2
lrwxrwxrwx 1 root root     18 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags.so.2.2 -> libgflags.so.2.2.1
-rw-r--r-- 1 root root 150248 Aug  6  2017 /usr/lib/x86_64-linux-gnu/libgflags.so.2.2.1

 

nikos1
Valued Contributor I
1,208 Views

What are you trying to compile?  Hard to help without the source. I would start with minimal code and then build up. You could also remove the gflags dependency.

FWIW you may also need to link to libiomp5.so - it is 

    libiomp5.so => ~/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib/libiomp5.so (0x00007f8f77962000)
 

My minimal code for example compiles and runs fine with 

clang++-6.0 -std=c++14 -o test test.cpp -I ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/include -L ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/lib/linux -linference_engine -ldl -lpthread 

 

DOjik
Beginner
1,208 Views

I am compiling one of Intel's example found here https://github.com/opencv/dldt/blob/2018/inference-engine/samples/classification_sample_async/main.cpp, which depends on gflags...

DOjik
Beginner
1,208 Views

And, when I do add libiomp5.so to the compile command

-L/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib/ -libiomp5.so

I get 

 ld: cannot find -libiomp5.so

even though the library is there 

$ ls -l /opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib
Jan 23 15:10 libiomp5.so

 

nikos1
Valued Contributor I
1,208 Views

try with 

-liomp5

 

nikos1
Valued Contributor I
1,209 Views

> I am compiling one of Intel's example found here https://github.com/opencv/dldt/blob/2018/inference-engine/samples/classi..., which depends on gflags...

BTW this worked for me - has quite a few dependencies...

 

clang++-6.0 -std=c++14 -o test main.cpp -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/classification_sample_async -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/src/extension -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common -I ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common/format_reader/ -I ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/include -L ~/catalyst/sdks/intel_open_vino/computer_vision_sdk/deployment_tools/inference_engine/lib/linux -linference_engine -lcpu_extension -ldl -lpthread -liomp5 -lgflags -L ~/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/build/intel64/Release/lib -lformat_reader

if you don't see the entire command you can copy to clipboard and paste to a text editor - data is there but browsers can hide it sometimes

 

ldd   test
	linux-vdso.so.1 =>  (0x00007fff2c517000)
	libinference_engine.so => /home/x/intel//computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64/libinference_engine.so (0x00007f8e1b25f000)
	libcpu_extension.so => ./libcpu_extension.so (0x00007f8e1afac000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8e1ada8000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8e1ab8b000)
	libiomp5.so => /home/x/intel//computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib/libiomp5.so (0x00007f8e1a7af000)
	libgflags.so.2 => /usr/lib/x86_64-linux-gnu/libgflags.so.2 (0x00007f8e1a58e000)
    libformat_reader.so => ./libformat_reader.so (0x00007f06b8813000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8e1a202000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8e19ef9000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8e19ce1000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8e19917000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8e1b888000)

 

View solution in original post

DOjik
Beginner
1,208 Views

Ah. I missed that one -- all omp related errors are now gone. The only errors point to gflags:

/tmp/ccHlfv9c.o: In function `ParseAndCheckCommandLine(int, char**)':
main.cpp:(.text+0x6a5): undefined reference to `gflags::ParseCommandLineNonHelpFlags(int*, char***, bool)'
/tmp/ccHlfv9c.o: In function `parseInputFilesArguments(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> > > >&)':
main.cpp:(.text+0x1444): undefined reference to `gflags::GetArgvs[abi:cxx11]()'
/tmp/ccHlfv9c.o: In function `main':
main.cpp:(.text.startup+0x7be): undefined reference to `CreateFormatReader'
/tmp/ccHlfv9c.o: In function `_GLOBAL__sub_I__Z23readInputFilesArgumentsRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERKS5_':
main.cpp:(.text.startup+0x3f8d): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x3ff7): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4095): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4134): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x41d6): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x423a): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4269): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x42d3): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x4372): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x43d6): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4405): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
main.cpp:(.text.startup+0x4434): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
main.cpp:(.text.startup+0x44a9): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
main.cpp:(.text.startup+0x450d): undefined reference to `gflags::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
collect2: error: ld returned 1 exit status

g++  -O3 -o main --std=c++11 main.cpp -I.  \

-L/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib -liomp5  /

<other-project-dependencies-like-you-pointed-out>  \

-lgflags

DOjik
Beginner
1,208 Views

Here is command

g++  -O3 -o main --std=c++11 main.cpp -I. \
            -I/opt/intel/computer_vision_sdk/opencv/include/ \
            -I/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/include/ \
            -I/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/include/cpp \
	    -I/home/upsquared/inference_engine_samples_src/thirdparty/gflags/include \
	    -I/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/src/extension \
	    -I/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common \
	    -I/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/samples/common/format_reader \
            -L/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64 -linference_engine \
            -L/home/upsquared/openvino_samples/build/intel64/Release/lib -ldl -lpthread -lcpu_extension \
	    -L/opt/intel/computer_vision_sdk_2018.5.445/deployment_tools/inference_engine/external/omp/lib -liomp5 -lgflags

 

nikos1
Valued Contributor I
1,208 Views

out - sorry back in 2hrs 

DOjik
Beginner
1,208 Views

Ok, the culprit was the gflag include that I was using. Removed it and problem solved. Thanks lots for your assistance. 

1,208 Views

Hi, I have a related problem with linking, so decided to ask for help here. I have tried to compile OpenCV 4.1.1 with OpenVINO 2019_R1 and got several problems with linking.

If I build it without disabling performance tests 

cmake ../opencv/ -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -DWITH_INF_ENGINE=ON -DENABLE_CXX11=ON -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON

 

cmake finds inference engine:

-- Inference Engine: YES (2019010000 / 1.6.0) -- libs: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/lib/intel64/libinference_engine.so -- includes: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/include

 

but i get the following errors:

../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::SigmoidLayer::SigmoidLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PoolingLayer::PoolingLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::OutputLayer::OutputLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ConcatLayer::ConcatLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::MVNLayer::MVNLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::FullyConnectedLayer::FullyConnectedLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ReLULayer::ReLULayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PSROIPoolingLayer::PSROIPoolingLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ROIPoolingLayer::ROIPoolingLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Port::setParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, InferenceEngine::Parameter const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::EltwiseLayer::EltwiseLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Layer::Layer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ReorgYoloLayer::ReorgYoloLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PReLULayer::PReLULayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ClampLayer::ClampLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PermuteLayer::PermuteLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ConvolutionLayer::ConvolutionLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Network::Network(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PowerLayer::PowerLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::InputLayer::InputLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ProposalLayer::ProposalLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Port::getParameters[abi:cxx11]() const' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Layer::getName[abi:cxx11]() const' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Layer::setName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Data::Data(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, InferenceEngine::Precision, InferenceEngine::Layout)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ReshapeLayer::ReshapeLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PriorBoxClusteredLayer::PriorBoxClusteredLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::DetectionOutputLayer::setCodeType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::SoftMaxLayer::SoftMaxLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ConstLayer::ConstLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::PriorBoxLayer::PriorBoxLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::GRNLayer::GRNLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::NormLayer::NormLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Layer::setType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ELULayer::ELULayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::ScaleShiftLayer::ScaleShiftLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::NormalizeLayer::NormalizeLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::Layer::getParameters[abi:cxx11]()' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::TanHLayer::TanHLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::DeconvolutionLayer::DeconvolutionLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libopencv_dnn.so.4.1.1: undefined reference to `InferenceEngine::Builder::DetectionOutputLayer::DetectionOutputLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: *** [bin/opencv_perf_dnn] Error 1

 

If I build with flag BUILD_PERF_TESTS=OFF then in runtime after the to readNet in OpenCV ddn module I get the following error:

/usr/lib/jvm/java-1.8.0-openjdk/bin/java: symbol lookup error: /root/opencv-build/lib/libopencv_dnn.so.4.1: undefined symbol: _ZN15InferenceEngine4DataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorImSaImEENS_9PrecisionENS_6LayoutE

And readelf -Ws really shows no such symbol in libinference_engine.so. I appreciate for any help, because I do not know where to dig from here.

F__Mark
Beginner
1,208 Views

I was having this problem.  It was because OpenVino was built with GCC-4 (CentOS 7), but I'm trying to build OpenCV with GCC-9 (Fedora-30).  If you want to link a new binary against an old library, you can specify:

  -D_GLIBCXX_USE_CXX11_ABI=0

See here:  https://stackoverflow.com/questions/33394934/converting-std-cxx11string-to-stdstring

and here:  https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

(that seems to be my problem, anyway...)