OpenCV4.7 Cross Compilation, runtime error: rebuild the library with windows, gtk+ 2.x or cocoa support

I have an IMX8 based target system for which i need to implement OpenCV4.7
So I downloaded the sources and did the build on my development PC by:

  1. Downloaded the sources
  2. Compiled the opencv sources with
    cmake -DWITH_OPENCL=ON -DBUILD_SHARED_LIBS=ON -DBUILD_OPENJPEG=ON -DCMAKE_INSTALL_PREFIX=/opt/imx8/sysroots/cortexa35-poky-linux/usr …

then did make and install.

Then i wrote a sample program to display image slideshow and compiled the program with target’s compiler on the development pc.

Then i copied all the opencv libraries to the target board and i tried to execute the program on my target
I got the following error:
home/Development_PC/opencv/opencv-4.7.0/modules/highgui/src/windows.cpp error: (-2:unspecified error). the function is not implemented. rebuild the library with windows, gtk+ 2.x or cocoa support. if you are on ubuntu or debian install libgtk2.0-dev and pkgconfig, then re-run cmake or configure script in function ‘cvNamedWindow’

It is trying to access a file in my development pc
I dont know what to do

Thank You

what does your question have to do with “ARM”? you tagged this thread as “ARM”.

it is not.

that is debug information. it refers to the source file on your development computer.

this means you built opencv without GUI support.

The board is arm based.

The board is based on wayland-weston
what change do i need to do?

IDK. what GUI libraries do you think are available for that target? GTK? you’ll have to figure out how to have this available in your crosscompilation environment.

always check the output of the cmake configuration step. it’s a report of OpenCV’s build time configuration. you can get also at runtime by calling std::cout << cv::getBuildInformation();

So I should try to redo the cmake with GTK and then check it right?

also after build and compilation
if copying the libraries from the target’s /usr/lib present in the developement board to the target’s /usr/lib is enough for the program to run ro do i need to do anything else?

when i tried to rebuild with -DWITH_OPENGL=ON and -DWITH_GTK=ON also, i still got
– GTK+: NO
– OpenGL support: NO