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.
6572 Discussions

How to add libraries to the runtime/embeddem_arm_sdk cross-compilation environment

STATEABC
Novice
1,196 Views

Hello,

I'm running the object_detection_demo in my SoC to process an image, but I get the following error:
[ ERROR ] 0opencv(4.8.0)/home/coredla_work/runtime/hps packages/opencv/modules/highgui/src/window.cpp:1272: 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 pkg-config, then re-run cmake or configure the script in function 'cvshowImage'

So I ran the sudo apt install libgtk2.0-dev command on Ubuntu and set the CMAKE_FLAGS="${CMAKE_FLAGS}" in build_hpspackages.sh. -DWITH_GTK:BOOL=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DWITH_GTK_2_X:BOOL=ON" and re-ran ./create_hps_image.sh, but the generated executable still reports the above error.

In runtime/embedded_arm_sdk, I found that after running source environment-setup-linux, the GTK version number cannot be returned using pkg-config --modversion gtk+-2.0. Therefore, I would like to know how to install the libgtk2.0 library when cross-compiling for embedded_arm_sdk.

0 Kudos
6 Replies
Peh_Intel
Moderator
977 Views

Hi STATEABC,


How you install or build OpenCV?


Below is the common solution for the encountered OpenCV error:

https://bobbyhadz.com/blog/python-error-unspecified-error-the-function-is-not-implemented


Try this command to install target-specific GTK2 Development libraries:

sudo apt-get install libgtk2.0-dev:armhf



Regards,

Peh


0 Kudos
STATEABC
Novice
933 Views

Hello,
Thanks so much for your solution, but it doesn't work for me.

I installed OpenCV according to the instructions at https://www.intel.com/content/www/us/en/docs/programmable/768970/2024-3/installing-toolkit.html

I tried installing it using sudo apt-get install libgtk2.0-dev:armhf, but I get the following error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libgtk2.0-dev:armhf
E: Couldn't find any package by glob 'libgtk2.0-dev'
E: Couldn't find any package by regex 'libgtk2.0-dev'

0 Kudos
Peh_Intel
Moderator
591 Views

Hi STATEABC,


I noticed that you mentioned cross-compiling for embedded_arm_sdk before. Does it mean you installed OpenCV via apt on the build host and then installed the prerequisites (sudo apt install libgtk2.0-dev pkg-config) later on SoC after facing the error?



Regards,

Peh


0 Kudos
STATEABC
Novice
564 Views

Hello,
Yes, I tried this. When I ran the cross-compiled executable, I got an error about missing libgtk2.0-dev. I installed it in the SoC environment using `sudo apt install libgtk2.0-dev pkg-config`, but it didn't work.

It seems that when I ran `build_hpspackages.sh`, it failed to find GTK during the `do opencv` command, as the following output appears:
-- OpenCV modules:
-- To be built: core highgui imgcodecs imgproc videoio
-- Disabled: calib3d dnn features2d flann gapi java_bindings_generator js_bindings_generator ml objc_bindings_generator objdetect photo python_bindings_generator python_tests stitching ts video world
-- Disabled by dependency: -
-- Unavailable: java python2 python3
-- Applications: -
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI: NONE
-- GTK+: NO
--
-- Media I/O:
-- ZLib: build (ver 1.2.13)
-- JPEG: build-libjpeg-turbo (ver 2.1.3-62)
-- SIMD Support Request: YES
-- SIMD Support: YES
-- PNG: build (ver 1.6.37)
-- TIFF: build (ver 42 - 4.2.0)
-- JPEG 2000: build (ver 2.5.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
--PFM: YES
--
-- Video I/O:
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
--avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)

0 Kudos
Peh_Intel
Moderator
480 Views

Hi STATEABC,


Can i know your SoC hardware information and OS environment?



Regards,

Peh


0 Kudos
STATEABC
Novice
316 Views

Hello

I followed the instructions at https://www.intel.com/content/www/us/en/docs/programmable/848957/2024-3/soc-design-example-quick-start-tutorial.html. My FPGA is an Agilex 7 and my operating system is Ubuntu 20.04.

I'd like to know how to install libgtk2.0 in runtime/embedded_arm_sdk so I can compile OpenCV and enable the GUI using build_hpspackages.sh.

0 Kudos
Reply