Step Build With Opencv2411

download Step Build With Opencv2411

If you can't read please download the document

description

Compile OpenCV 2411 for Ubuntu and friendlyArm Tiny4412

Transcript of Step Build With Opencv2411

++++++++++++++++++++++++++++++++ 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_filesCMAKE_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) from: 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_2411"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/binPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfigexport 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-compilingOperating System: arm-linux | Processor: ARMCompiler:C /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gccC++ /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:STRING=-lpthread -lrtcd 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.objLinking 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 statusmake[2]: *** [bin/opencv_perf_ocl] Error 1make[1]: *** [modules/ocl/CMakeFiles/opencv_perf_ocl.dir/all] Error 2make: *** [all] Error 2Solve: add -ldl to CmakeCache.txt as below, then make clean, makeCMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -ldl -lrt(Eslapse time from 8:50AM - 10:25AM)make installDone! (installed to opencv2411_lib_kit)+++++++++++++++++++++++++++++++++++++++++++++++++ 3. compile tslib for arm, follow guide is OK +++++++++++++++++++++++++++++++++++++++++++++++++create /home/qtTut folder, then clone tslib source.cd /home/qtTutgit-clone git clone http://github.com/kergoth/tslib.gitcd tslib./autogen.sh./configure --host=arm-angstrom-linux-gnueabi --prefix=/usr/local/tslib --enable-static --enable-sharedmakemake installYou 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 fileextract 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.5PATH=$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++.confQMAKE_CC = arm-linux-gccQMAKE_CXX = arm-linux-g++QMAKE_LINK = arm-linux-g++QMAKE_LINK_SHLIB = arm-linux-g++# modifications to linux.confQMAKE_AR = arm-linux-ar cqsQMAKE_OBJCOPY = arm-linux-objcopyQMAKE_STRIP = arm-linux-stripload(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++.confQMAKE_CC = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gccQMAKE_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 to linux.confQMAKE_AR = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-ar cqsQMAKE_OBJCOPY = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-objcopyQMAKE_STRIP = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-stripQMAKE_INCDIR += /opt/tslib/includeQMAKE_LIBDIR += /opt/tslib/libload(qt_config)------end ---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-mouse-tslib -little-endian -no-qt3support -fast -no-largefile -qt-sql-sqlite -nomake tools -nomake demos -nomake examples -no-webkit -no-multimedia -no-javascript-jitIf error:https://forum.qt.io/topic/26245/solved-error-while-making-qt-4-8-4-for-armfatal error: .pch/debug-shared-emb-arm/QtGui: No such file or directorycompilation terminated.Reconfig with -no-pch option as below:./configure --prefix=/opt/qte -embedded arm -xplatform qws/linux-arm-g++ -qt-mouse-tslib -little-endian -no-qt3support -fast -no-largefile -qt-sql-sqlite -nomake tools -nomake demos -nomake examples -no-webkit -no-multimedia -no-javascript-jit -no-pchConfigure Done.- Download http://www.opensource.apple.com/source/gcc/gcc-5664/gcc/config/arm/arm_neon.h, copy paste to /home/giang/friendlyArm_tools/arm-qte-4.8.5/qt-everywhere-opensource-src-4.8.5/src/gui/image- Modify qimage_neon.cpp: add "#include " 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 below option: -marm-remove all *.pch in qt-everywhere-opensource/src/corelib & qt-everywhere-opensource/src/gui-make -j4-make installDone.Output here: /opt/qte