Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

OpenCV and ICC linker error

zvonimir_b_
Beginner
785 Views

I am trying to run a test program using ICC in Eclipse. I previously ran the same program with GCC and it worked fine but now when I am building it with ICC and ICC built OpenCV libraries I get the following error:

**** Incremental Build of configuration Debug for project DisplayImage_Intel ****
make all 
Building target: libDisplayImage_Intel.so
Invoking: Intel C++ Linker
icpc -L/home/mninicfe/OpenCV_intel/opencv-3.0.0/IntelBuild/install/lib/ -shared -o "libDisplayImage_Intel.so"  ./src/DisplayImage_Intel.o   -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui
ld: ./src/DisplayImage_Intel.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
./src/DisplayImage_Intel.o: could not read symbols: Bad value
make: *** [libDisplayImage_Intel.so] Error 1

 

My program code looks like this:

//#include <cv.h>
//#include <highgui.h>

#include <opencv2/opencv.hpp>
#include <stdio.h>

using namespace cv;

int main( int argc, char** argv )
{
  Mat image;
  image = imread( argv[1], 1 );

  if( argc != 2 || !image.data )
    {
      printf( "No image data \n" );
      return -1;
    }

  namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
  imshow( "Display Image", image );

  waitKey(0);

  return 0;
}

I tried to solve this problem by adding these flags and building OpenCV from the beginning but it didn't help: 
COMPILE_FLAGS+=-fPIC
export CFLAGS="$CFLAGS -fPIC"
export CXXFLAGS="$CXXFLAGS -fPIC"

Any help would be appreciated.

0 Kudos
1 Reply
Monique_J_Intel
Employee
785 Views

Hi Zvonimir,

This is an interesting issue. I will reproduce it and investigate to see what I find.

Kind Regards,

Monique Jones

0 Kudos
Reply