Cross compiling opencv for BBB

443 views
Skip to first unread message

sajeevan k

unread,
Mar 6, 2017, 8:00:37 AM3/6/17
to BeagleBoard
Hi everybody,

I am trying to cross compile opencv for Beagle Bone Black in Ubuntu 16.04 Host machine(x86_64).


I am referring
http://docs.opencv.org/2.4/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html and
https://indranilsinharoy.com/2012/11/01/installing-opencv-on-linux/ for this
The cmake options are as shown below.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_ZLIB=ON -D BUILD_PYTHON_SUPPORT=ON -D CMAKE_TOOLCHAIN_FILE=/home/sajeevank/opencv-3.2.0/platforms/linux/arm-gnueabi.toolchain.cmake /home/sajeevank/opencv-3.2.0

The configuration output is as given below.

 
 
--   GUI:
--     QT:                          NO
--     GTK+:                        NO
--     GThread :                    NO
--     GtkGlExt:                    NO
--     OpenGL support:              NO
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        build (ver 1.2.8)
--     JPEG:                        libjpeg (ver 90)
--     WEBP:                        build (ver 0.3.1)
--     PNG:                         build (ver 1.6.24)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     GDAL:                        NO
--     GDCM:                        NO
--
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       avcodec:                   NO
--       avformat:                  NO
--       avutil:                    NO
--       swscale:                   NO
--       avresample:                NO
--     GStreamer:                   NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     Aravis SDK:                  NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    NO/YES
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO
--
--   Parallel framework:            pthreads
--
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Lapack:                  NO
--     Use Eigen:                   NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
--     Use OpenVX:                  NO
--     Use custom HAL:              YES (carotene (ver 0.0.1))
--
--   OpenCL:                        <Dynamic loading of OpenCL library>
--     Include path:                /home/sajeevank/opencv-3.2.0/3rdparty/include/opencl/1.2
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
--
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.2)
--
--   Python (for build):            /usr/bin/python2.7
--
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Matlab:                        Matlab not found or implicitly disabled
--
--   Documentation:
--     Doxygen:                     NO
--
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              NO
--
--   Install path:                  /usr/local
--
--   cvconfig.h is in:              /home/sajeevank/opencv-3.2.0
-- -----------------------------------------------------------------
--

It can be seen that many options like QT, GTK+,  GThread ,   GtkGlExt, OpenGL support, VTK support,    FFMPEG,  GStreamer are marked as NO.


On exploring it, I could understand that, it is because of libraries for armhf machine are not installed in x86_64 machine.
I tried this as per the web page: https://wiki.mozilla.org/Embedding/IPCLiteAPI_BeagleBoardHF (section -Qt build with X ),

I tried installing qt5 libraries

apt-get install qt5-default:armhf libpango1.0-dev:armhf libdbus-glib-1-dev:armhf libasound2-dev:armhf libxt-dev:armhf mesa-common-dev:armhf

But this is not successful as shown below

sajeevank@sajeevank-Vostro-3559:~$ sudo apt-get install qt5-default:armhf
[sudo] password for sajeevank:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package qt5-default:armhf


It seems this document is a little older.
B

Q1) Is there any updated method for installing libraries for one architecture(here armhf), from another architecture (here x86_64) ?

I tried to run some qt programs which uses opencv libraries.
One of the program correctly compiled, when selecting desktop as the device in qt creator, is showing
following error when selecting Beaglebone black as the device

opencv2/opencv.hpp: No Such file or directory
opencv2/highgui/highgui.hpp:
No Such file or directory

Opencv is correctly cross compiled and installed. Even then this error is coming.

Q2) Why this error is coming even after the correct cross compilation and installation of opencv ?

My .pro file is as shown below.

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = PanTiltOperation
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += mainwindow.h

FORMS += mainwindow.ui

target.path = /root
INSTALLS += target

DISTFILES +=
INCLUDEPATH += /usr/local/include/opencv
LIBS += -I/usr/local/include/opencv
LIBS += -I/usr/local/include
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
#LIBS += -lopencv_shape
LIBS += -lopencv_stitching
LIBS +=-lopencv_objdetect
LIBS +=-lopencv_superres
LIBS += -lopencv_videostab
LIBS += -lopencv_calib3d
LIBS +=-lopencv_features2d
LIBS +=-lopencv_highgui
#LIBS +=-lopencv_videoio
#LIBS +=-lopencv_imgcodecs
LIBS +=-lopencv_video
LIBS +=-lopencv_photo
LIBS +=-lopencv_ml
LIBS +=-lopencv_imgproc
LIBS +=-lopencv_flann
LIBS +=-lopencv_core


Thanks in advance for the help.

Sajeevan.K




 




Reply all
Reply to author
Forward
0 new messages