qt - QMake: how to choose version of library to link to -
there simple computer vision application uses opencv. compiling on host system deploy nvidia jetson tk1 (no problems here, use qt creator configured kit). use sshfs
mount jetson's filesystem root host /mnt/sysroot_tegra_tk1
.
the problem: i've compiled opencv version 3.2 on jetson (installed board /usr/local/lib
). there still system opencv version 2.4 in /usr/local
. don't know how configure qmake on host system cross compile , link new version instead of jetson's system default.
my .pro file:
qt += core qt -= gui config += c++11 target = markerextractionchromakey config += console config -= app_bundle unix: includepath += /usr/local/include unix: qmake_libdir = /usr/local/lib unix: libs += -lopencv_imgproc\ -lopencv_core.so\ -lopencv_video\ -lopencv_highgui\ -lopencv_gpu template = app headers += cameraworker.h sources += main.cpp \ cameraworker.cpp target.path = /home/ubuntu/alan/markerextractionchromakey target.files += markerextractionchromakey installs += target
project linkage output:
/usr/bin/arm-linux-gnueabihf-g++ -wl,-rpath-link,/mnt/sysroot_tegra_tk1/usr/lib -wl,-rpath-link,/mnt/sysroot_tegra_tk1/usr/lib/arm-linux-gnueabihf -wl,-rpath-link,/mnt/sysroot_tegra_tk1/lib/arm-linux-gnueabihf -mfloat-abi=hard --sysroot=/mnt/sysroot_tegra_tk1 -wl,-rpath,/usr/local/qt5/lib -o markerextractionchromakey main.o cameraworker.o -l/usr/local/lib -lopencv_imgproc -lopencv_core -lopencv_video -lopencv_highgui -lopencv_gpu -l/opt/qt5_for_tegra/qt-everywhere-opensource-src-5.5.1/qtbase/lib -lqt5core -l/mnt/sysroot_tegra_tk1/usr/lib -l/mnt/sysroot_tegra_tk1/lib/arm-linux-gnueabihf -l/mnt/sysroot_tegra_tk1/usr/lib/arm-linux-gnueabihf -lpthread
problem solved. key moments:
- different versions placed in different locations (using explicit soname option, in case libraries placed outside linker default scope).
- there must correct
-rpath/-rpath-link
tell linker for. default
-rpath
locations jetson specified in<path qt>/qt-everywhere-opensource-src-5.5.1/qtbase/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf
. add directory before default ones:qmake_incdir += \ $$[qt_sysroot]/usr/local/include \ $$[qt_sysroot]/usr/include \ $$[qt_sysroot]/usr/include/arm-linux-gnueabihf qmake_libdir += \ $$[qt_sysroot]/usr/local/lib \ $$[qt_sysroot]/usr/lib \ $$[qt_sysroot]/lib/arm-linux-gnueabihf \ $$[qt_sysroot]/usr/lib/arm-linux-gnueabihf qmake_lflags += \ -wl,-rpath-link,$$[qt_sysroot]/usr/local/lib \ -wl,-rpath-link,$$[qt_sysroot]/usr/lib \ -wl,-rpath-link,$$[qt_sysroot]/usr/lib/arm-linux-gnueabihf \ -wl,-rpath-link,$$[qt_sysroot]/lib/arm-linux-gnueabihf
Comments
Post a Comment