0% found this document useful (0 votes)
134 views

Step Build With Opencv2411

This document provides instructions for building OpenCV and QT libraries for the PC and an ARM-based kit. It describes downloading and compiling OpenCV 2.4.11 from source for the PC and kit. It also explains how to set up the toolchain and compile QT Everywhere 4.8.5 from source for the kit, including fixes needed for NEON support.

Uploaded by

hagasy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views

Step Build With Opencv2411

This document provides instructions for building OpenCV and QT libraries for the PC and an ARM-based kit. It describes downloading and compiling OpenCV 2.4.11 from source for the PC and kit. It also explains how to set up the toolchain and compile QT Everywhere 4.8.5 from source for the kit, including fixes needed for NEON support.

Uploaded by

hagasy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

+++++++++++++++++++++++++++++++

+ 1. Build opencv2411 for PC +


+++++++++++++++++++++++++++++++
- download opencv2411.zip to D:\Download\ubuntu_pkg\opencv2411.zip
- extract here
- create 2 folder on desktop:
+ cmake_cfg_files: contain cmake configure files
+ opencv_lib_pc: output library for pc (make install)
open CMake, config src: browse to d:\download\ubuntu_pkg\opencv2411
des: desktop\cmake_cfg_files
CMAKE_INSTALL_PREFIX: /usr/local (default)
uncheck WITH_OPENEXR, WITH_TIFF, click Configure (Done), click Generate (done).
Open Terminal, cd to cmake_cfg_files, then type make (elapse time (1:30 min) fro
m: 19:46PM-21:04PM)
- make install, will install opencv library to CMAKE_INSTALL_PREFIX directory.
for my example: I installed opencv2411 to "opencv_lib_pc" and "opencv_lib_pc_241
1"
Done..
+++++++++++++++++++++++++++++++
+ 2. Build opencv2411 for Kit +
+++++++++++++++++++++++++++++++
- use arm-gcc toolchain from DISKA, extract arm-linux-gcc-4.5.1-v6-vfp-20120301.
tgz to /opt/FriendlyARM/toolschain/4.5.1/bin
- add path of toolchain to PATH: vi ~/.bashrc, add this to the end of file:
PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
- check toolchain work: open terminal type arm-linux-gcc --version
- create folder "cmake_cfg_files_kit": contain cmake configuration file
- create folder "opencv2411_lib_kit": installed folder (make install)
- open CMake, Unix makefiles - Specify options for cross-compiling
Operating System: arm-linux
| Processor: ARM
Compiler:C /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc
C++ /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++
Target Root: /opt/FriendlyARM/toolschain/4.5.1. Finish
- INSTALL PREFIX: browse to "opencv2411_lib_kit" folder, uncheck OPENEXR, TIFF
- modify "/home/giang/Desktop/cmake_cfg_files_kit/CMakeCache.txt" LINKER_FLAG:ST
RING=-lpthread -lrt
cd to cmake_cfg_files_kit directory, then make, eslapse time from: 21:25PM***ERROR ****
Ref from: http://blog.csdn.net/jiebaoabcabc/article/details/22935185
[ 63%] Building CXX object modules/ocl/CMakeFiles/opencv_perf_ocl.dir/perf/perf_
stat.cpp.obj
Linking CXX executable ../../bin/opencv_perf_ocl
../../lib/libopencv_ocl.so: undefined reference to `dlopen'
../../lib/libopencv_ocl.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_ocl] Error 1
make[1]: *** [modules/ocl/CMakeFiles/opencv_perf_ocl.dir/all] Error 2
make: *** [all] Error 2
Solve: add -ldl to CmakeCache.txt as below, then make clean, make
CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -ldl -lrt
(Eslapse time from 8:50AM - 10:25AM)
make install

Done! (installed to opencv2411_lib_kit)


++++++++++++++++++++++++++++++++++++++++++++++++
+ 3. compile tslib for arm, follow guide is OK +
++++++++++++++++++++++++++++++++++++++++++++++++
create /home/qtTut folder, then clone tslib source.
cd /home/qtTut
git-clone git clone http://github.com/kergoth/tslib.git
cd tslib
./autogen.sh
./configure --host=arm-angstrom-linux-gnueabi --prefix=/usr/local/tslib --enable
-static --enable-shared
make
make install
You will see tslib is installed to /usr/local/tslib
++++++++++++++++++++++++++++++++++++++++++++++++
+ 4. QT Everywhere
++++++++++++++++++++++++++++++++++++++++++++++++
copy arm-qte-4.8.5-20131207.tar.gz from DISK_A, then extract gz file you will qt
-everywhere-opensource-src-4.8.5.tar.gz file
extract this file to "qt-everywhere-opensource-src-4.8.5"
Here: /home/giang/friendlyArm_tools
- add path environtment: $HOME/qt-everywhere-opensource-src-4.8.5
PATH=$PATH:/home/giang/friendlyArm_tools/arm-qte-4.8.5
-modify /home/giang/friendlyArm_tools/arm-qte-4.8.5/qt-everywhere-opensource-src
-4.8.5/mkspecs/qws/linux-arm-g++/qmake.conf
---qmake.conf origin---#
# qmake configuration for building with arm-linux-g++
#
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC
= arm-linux-gcc
QMAKE_CXX
= arm-linux-g++
QMAKE_LINK
= arm-linux-g++
QMAKE_LINK_SHLIB
= arm-linux-g++
# modifications to linux.conf
QMAKE_AR
= arm-linux-ar cqs
QMAKE_OBJCOPY
= arm-linux-objcopy
QMAKE_STRIP
= arm-linux-strip
load(qt_config)
-----------------------qmake.conf new-------#
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)

include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-g
cc
QMAKE_CXX
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-g
++
QMAKE_LINK
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-g
++
QMAKE_LINK_SHLIB= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-g
++
# modifications
QMAKE_AR
r cqs
QMAKE_OBJCOPY
bjcopy
QMAKE_STRIP
trip
QMAKE_INCDIR
QMAKE_LIBDIR
load(qt_config)
------end ---

to linux.conf
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-a
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-o
= /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-s
+= /opt/tslib/include
+= /opt/tslib/lib

cd to /home/giang/friendlyArm_tools/arm-qte-4.8.5/qt-everywhere-opensource-src-4
.8.5
./configure --prefix=/opt/qte -embedded arm -xplatform qws/linux-arm-g++ -qt-mou
se-tslib -little-endian -no-qt3support -fast -no-largefile -qt-sql-sqlite -nomak
e tools -nomake demos -nomake examples -no-webkit -no-multimedia -no-javascriptjit
If error:https://forum.qt.io/topic/26245/solved-error-while-making-qt-4-8-4-forarm
fatal error: .pch/debug-shared-emb-arm/QtGui: No such file or directory
compilation terminated.
Reconfig with -no-pch option as below:
./configure --prefix=/opt/qte -embedded arm -xplatform qws/linux-arm-g++ -qt-mou
se-tslib -little-endian -no-qt3support -fast -no-largefile -qt-sql-sqlite -nomak
e tools -nomake demos -nomake examples -no-webkit -no-multimedia -no-javascriptjit -no-pch
Configure Done.
- Download http://www.opensource.apple.com/source/gcc/gcc-5664/gcc/config/arm/ar
m_neon.h, copy paste to
/home/giang/friendlyArm_tools/arm-qte-4.8.5/qt-everywhere-opensource-src-4.8.5/s
rc/gui/image
- Modify qimage_neon.cpp: add "#include <arm_neon.h>" below this line #ifdef QT_
HAVE_NEON:
-gedit qt-everywhere-opensource/src/gui/Makefile, add to CFLAGS this option
-mfloat-abi=softfp -mfpu=neon
-gedit qt-everywhere-opensource/src/corelib/Makefile, add to CFLAGS & CXXFLAGS b
elow option: -marm
-remove all *.pch in qt-everywhere-opensource/src/corelib & qt-everywhere-openso
urce/src/gui
-make -j4
-make install

Done.
Output here: /opt/qte

You might also like